Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Uno Hello Linux

Uno Hello Linux

The goal of this session to introduce Linux fans to a onestop solution for building custom Linux tools with. NET. Ship to the Web as well from the same codebase — with some help from VS Code.

Chika Onoh

February 25, 2023
Tweet

More Decks by Chika Onoh

Other Decks in Programming

Transcript

  1. February 24, 2023 Aba Microsoft User Hangout Uno Hello Linux

    Running Uno Platform App on Linux for the first time.
  2. Quite simply Uno Platform is the only choice if you

    want cross platform, high quality applications written in C#. James Hancock Aba Microsoft User Hangout February 24, 2023
  3. Intro Presenter @cyromaven Name: David Onoh Job: Software Developer |

    Educator Tag: Supporting the .NET ecosystem through Meetups and shared resources. Time: 30 minutes
  4. Today's Agenda 1 Session Introduction 2 Prerequisites 3 Environment and

    App Canvas 4 Modify Template and Run Aba Microsoft User Hangout February 24, 2023
  5. Introduction Build Pixel Perfect Cross-Platform Apps From Linux with .NET

    and VS Code The goal of this session to introduce Linux fans to a one- stop solution for building custom Linux tools with. NET. Ship to the Web as well from the same codebase — with some help from VS Code. February 24, 2023 Aba Microsoft User Hangout
  6. Prerequisites START RUN END Visual Studio Code The Uno Platform

    Visual Studio Code Extension .NET SDK .NET 7.0 SDK (version 7.0 (SDK 7.0.102) or later) Optionally, you might need the Gtk+3 runtime, as well Use dotnet --version from the terminal to get the version installed.
  7. Environment 1* Open a Terminal START RUN END 2* b*

    To update the tool, if you already have a legacy one: 2* a* Install the tool by running the following command from the command prompt: dotnet tool install -g uno.check dotnet tool update -g uno.check
  8. Environment START RUN END 3* Run the tool from the

    command prompt with the following command: 4* Follow the instructions indicated by the tool If the above command fails, use the following: uno-check ~/.dotnet/tools/uno-check
  9. App Canvas 1* In the terminal, type the following to

    create a new project: START RUN END This will create the Canvas that includes support for only the WebAssembly and Skia+GTK platforms dotnet new unoapp -o UnoHelloLinux -mobile=false --skia- wpf=false --skia-linux-fb=false --vscode
  10. App Canvas START RUN END the following code from the

    Terminal: 2* Open Visual Studio Code to see the generated codebase or run 4* Once the project has been loaded, in the status bar at the bottom left of VS Code, UnoHelloLinux.sln is selected by default. Select UnoHelloLinux.Skia.Gtk.csproj instead. code ./UnoHelloLinux 3* Visual Studio Code will ask to restore the NuGet packages.
  11. Modify Template START RUN END <Grid> <StackPanel> <TextBlock Text="Hello, linux!"

    Margin="20" FontSize="30" /> <TextBlock Text="{Binding Value, ElementName=slider}" Margin="20" FontSize="30" /> <Slider x:Name="slider"/> </StackPanel> </Grid> Replace the Grid's content with the following lines of code. This will add a StackPanel, a TextBlock, a Slider, and a Binder to give a dynamic result on the first try. Your new Grid layout should look like this: In your UnoHelloLinux Class Library project, open up MainPage.xaml
  12. Run START RUN END On Linux In the debugger section

    of the Code activity bar, select Skia.GTK (Debug) Press F5 to start the debugging session Place a breakpoint inside the OnClick method Click the button in the app, and the breakpoint will hit 1. 2. 3. 4. On WebAssembly In the debugger section of the Code activity bar, select Debug (Chrome, WebAssembly) Press F5 to start the debugging session Place a breakpoint inside the OnClick method Click the button in the app, and the breakpoint will hit 1. 2. 3. 4.
  13. Preview You can finally see a screenshot of the code

    run here. For more information you can follow up on next steps at: https://platform.uno/docs/articles/getting-started- tutorial-2.html February 24, 2023 Aba Microsoft User Hangout
  14. February 24, 2023 Aba Microsoft User Hangout With the Uno

    Platform, I can expose powerful, flexible user experiences on every single platform my users need. Billy Hollis