A version of the default Fabulous app template running on Linux
Перейти к файлу
Jim Bennett b31a32e0d1
Update README.MD
2018-09-12 14:40:34 +01:00
Images First cut 2018-09-12 14:38:14 +01:00
SqueakyApp First cut 2018-09-12 14:38:14 +01:00
SqueakyApp.Gtk First cut 2018-09-12 14:38:14 +01:00
.gitignore First cut 2018-09-12 14:38:14 +01:00
README.MD Update README.MD 2018-09-12 14:40:34 +01:00
SqueakyApp.sln First cut 2018-09-12 14:38:14 +01:00

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!

    The app running onLinux

You can read more on adding Xamarin.Forms GTK support for Linux on docs.microsoft.com.