b31a32e0d1 | ||
---|---|---|
Images | ||
SqueakyApp | ||
SqueakyApp.Gtk | ||
.gitignore | ||
README.MD | ||
SqueakyApp.sln |
README.MD
Squeaky app for Linux
This is a version of a Fabulous app created from the Fabulous template. The difference here is this runs on Linux using GTK#.
How to recreate this
If you want to create this yourself, follow these steps.
Create the solution
Install the template, and create a new project using:
dotnet new -i Fabulous.Templates
dotnet new fabulous-app -lang F# -n SqueakyApp
Launch the solution file using MonoDevelop - I used the nightly builds as these have better support for the underlying technology used by Fabulous. Then delete the Android
and iOS
apps.
Creating the Linux app
-
Right-click on the solution and select Add -> Add New Project.... Choose Other -> .NET -> Gtk# 2.0 project. Select F# from the drop down, then click Next. Give your project a name, such as
SqueakyApp.Gtk
, then click Create. -
Add the Xamarin.Forms and Xamarin.Forms.Platform.GTK NuGet packages to this project, and update the Xamarin.Forms package used by the SqueakyApp .NET Standard project to the same version as you have just installed.
-
Add a reference to the SqueakyApp .NET Standard project to your new GTK project.
-
Open up
Main.fs
, and change the code to match the following:namespace SqueakyApp.Gtk module Main = open System open Xamarin.Forms open Xamarin.Forms.Platform.GTK [<EntryPoint>] let Main(args) = Gtk.Application.Init() Forms.Init() let app = new SqueakyApp.App() let window = new FormsWindow() window.LoadApplication(app) window.SetApplicationTitle("Hello Fabulous Linux") window.Show(); Gtk.Application.Run() 0
This code will initialize GTK, initialize Xamarin.Forms, then launch the Forms app inside a GTK window.
-
Run your app!
You can read more on adding Xamarin.Forms GTK support for Linux on docs.microsoft.com.