-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e054cb
commit 622fa83
Showing
65 changed files
with
1,368 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
namespace MultipleMvus | ||
|
||
open Fabulous | ||
open Fabulous.Maui | ||
|
||
open type Fabulous.Maui.View | ||
|
||
module Counter = | ||
type Model = { Count: int } | ||
type Msg = Increment | Decrement | ||
|
||
let init() = { Count = 0 } | ||
|
||
let update msg model = | ||
match msg with | ||
| Increment -> { Count = model.Count + 1 } | ||
| Decrement -> { Count = model.Count - 1 } | ||
|
||
let program = Program.ForComponent.stateful init update | ||
|
||
module Form = | ||
type Model = | ||
{ FirstName: string | ||
LastName: string } | ||
|
||
type Msg = | ||
| FirstNameChanged of string | ||
| LastNameChanged of string | ||
|
||
let init() = { FirstName = ""; LastName = "" } | ||
|
||
let update msg model = | ||
match msg with | ||
| FirstNameChanged s -> { model with FirstName = s } | ||
| LastNameChanged s -> { model with LastName = s } | ||
|
||
let program = Program.ForComponent.stateful init update | ||
|
||
module App = | ||
let view() = | ||
Application() { | ||
ContentPage() { | ||
(VStack(spacing = 25.) { | ||
Label("App") | ||
|
||
MvuComponent(Counter.program) { | ||
let! model = Mvu.State | ||
|
||
VStack() { | ||
Label($"Count = {model.Count}") | ||
Button("Increment", Counter.Increment) | ||
Button("Decrement", Counter.Decrement) | ||
} | ||
} | ||
|
||
MvuComponent(Form.program) { | ||
let! model = Mvu.State | ||
|
||
VStack() { | ||
Label($"Hello {model.FirstName} {model.LastName}") | ||
Entry(model.FirstName, Form.FirstNameChanged) | ||
Entry(model.LastName, Form.LastNameChanged) | ||
} | ||
} | ||
}) | ||
.width(250.) | ||
.center() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace MultipleMvus | ||
|
||
open Microsoft.Maui.Hosting | ||
open Fabulous.Maui | ||
|
||
type MauiProgram = | ||
static member CreateMauiApp() = | ||
MauiApp | ||
.CreateBuilder() | ||
.UseFabulousApp(App.view()) | ||
.ConfigureFonts(fun fonts -> | ||
fonts | ||
.AddFont("OpenSans-Regular.ttf", "OpenSansRegular") | ||
.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold") | ||
|> ignore) | ||
.Build() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks> | ||
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks> | ||
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET --> | ||
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> --> | ||
<OutputType>Exe</OutputType> | ||
<UseMaui>true</UseMaui> | ||
<SingleProject>true</SingleProject> | ||
<EnableDefaultItems>false</EnableDefaultItems> | ||
|
||
<!-- Display name --> | ||
<ApplicationTitle>MultipleMvus</ApplicationTitle> | ||
|
||
<!-- App Identifier --> | ||
<ApplicationId>org.fabulous.maui.multiplemvus</ApplicationId> | ||
<ApplicationIdGuid>418b4576-ed03-4236-a506-5b7c0660f414</ApplicationIdGuid> | ||
|
||
<!-- Versions --> | ||
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion> | ||
<ApplicationVersion>1</ApplicationVersion> | ||
|
||
<TargetPlatformIdentifier Condition=" $(TargetPlatformIdentifier) == '' ">$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</TargetPlatformIdentifier> | ||
|
||
<SupportedOSPlatformVersion Condition="$(TargetPlatformIdentifier) == 'ios'">14.2</SupportedOSPlatformVersion> | ||
<SupportedOSPlatformVersion Condition="$(TargetPlatformIdentifier) == 'maccatalyst'">14.0</SupportedOSPlatformVersion> | ||
<SupportedOSPlatformVersion Condition="$(TargetPlatformIdentifier) == 'android'">21.0</SupportedOSPlatformVersion> | ||
<SupportedOSPlatformVersion Condition="$(TargetPlatformIdentifier) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion> | ||
<TargetPlatformMinVersion Condition="$(TargetPlatformIdentifier) == 'windows'">10.0.17763.0</TargetPlatformMinVersion> | ||
<SupportedOSPlatformVersion Condition="$(TargetPlatformIdentifier) == 'tizen'">6.5</SupportedOSPlatformVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="App.fs" /> | ||
<Compile Include="MauiProgram.fs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<!-- App Icon --> | ||
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" /> | ||
|
||
<!-- Custom Fonts --> | ||
<MauiFont Include="Resources\Fonts\*" /> | ||
|
||
<!-- Images --> | ||
<MauiImage Include="Resources\Images\*" /> | ||
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" /> | ||
|
||
<!-- Raw Assets (also remove the "Resources\Raw" prefix) --> | ||
<MauiAsset Include="Resources\Raw\*" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" /> | ||
|
||
<!-- Splash Screen --> | ||
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="$(TargetPlatformIdentifier) == 'android'"> | ||
<AndroidResource Include="$(AndroidProjectFolder)Resources/*/*" /> | ||
<AndroidResource Remove="$(AndroidProjectFolder)Resources/raw/.*" /> | ||
<AndroidResource Update="$(AndroidProjectFolder)Resources/raw/*" /> | ||
<AndroidAsset Include="$(AndroidProjectFolder)Assets/**/*" Exclude="$(AndroidProjectFolder)Assets/**/.*/**" /> | ||
<AndroidManifest Include="$(AndroidProjectFolder)AndroidManifest.xml" /> | ||
<Compile Include="$(AndroidProjectFolder)MainActivity.fs" /> | ||
<Compile Include="$(AndroidProjectFolder)MainApplication.fs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="$(TargetPlatformIdentifier) == 'ios'"> | ||
<None Include="$(iOSProjectFolder)Info.plist" LogicalName="Info.plist" /> | ||
<Compile Include="$(iOSProjectFolder)AppDelegate.fs" /> | ||
<Compile Include="$(iOSProjectFolder)Program.fs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="$(TargetPlatformIdentifier) == 'maccatalyst'"> | ||
<None Include="$(MacCatalystProjectFolder)Info.plist" LogicalName="Info.plist" /> | ||
<Compile Include="$(MacCatalystProjectFolder)AppDelegate.fs" /> | ||
<Compile Include="$(MacCatalystProjectFolder)Program.fs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="$(TargetPlatformIdentifier) == 'windows'"> | ||
<Manifest Include="$(WindowsProjectFolder)app.manifest" /> | ||
<AppxManifest Include="$(WindowsProjectFolder)Package.appxmanifest" /> | ||
<Compile Include="$(WindowsProjectFolder)App.fs" /> | ||
<Compile Include="$(WindowsProjectFolder)Main.fs" /> | ||
|
||
<PackageReference Include="FSharp.Maui.WinUICompat" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="$(TargetPlatformIdentifier) == 'tizen'"> | ||
<TizenManifestFile Include="$(TizenProjectFolder)tizen-manifest.xml" /> | ||
<Compile Include="$(TizenProjectFolder)Main.fs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="FSharp.Core" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration" /> | ||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" /> | ||
<PackageReference Include="Microsoft.Maui.Controls" /> | ||
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\src\Fabulous.MauiControls\Fabulous.MauiControls.fsproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
6 changes: 6 additions & 0 deletions
6
samples/Components/MultipleMvus/Platforms/Android/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
</manifest> |
17 changes: 17 additions & 0 deletions
17
samples/Components/MultipleMvus/Platforms/Android/MainActivity.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace MultipleMvus | ||
|
||
open Android.App | ||
open Android.Content.PM | ||
open Microsoft.Maui | ||
|
||
[<Activity(Theme = "@style/Maui.SplashTheme", | ||
MainLauncher = true, | ||
ConfigurationChanges = | ||
(ConfigChanges.ScreenSize | ||
||| ConfigChanges.Orientation | ||
||| ConfigChanges.UiMode | ||
||| ConfigChanges.ScreenLayout | ||
||| ConfigChanges.SmallestScreenSize | ||
||| ConfigChanges.Density))>] | ||
type MainActivity() = | ||
inherit MauiAppCompatActivity() |
10 changes: 10 additions & 0 deletions
10
samples/Components/MultipleMvus/Platforms/Android/MainApplication.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace MultipleMvus | ||
|
||
open Android.App | ||
open Microsoft.Maui | ||
|
||
[<Application>] | ||
type MainApplication(handle, ownership) = | ||
inherit MauiApplication(handle, ownership) | ||
|
||
override _.CreateMauiApp() = MauiProgram.CreateMauiApp() |
6 changes: 6 additions & 0 deletions
6
samples/Components/MultipleMvus/Platforms/Android/Resources/values/colors.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<color name="colorPrimary">#512BD4</color> | ||
<color name="colorPrimaryDark">#2B0B98</color> | ||
<color name="colorAccent">#2B0B98</color> | ||
</resources> |
10 changes: 10 additions & 0 deletions
10
samples/Components/MultipleMvus/Platforms/MacCatalyst/AppDelegate.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace MultipleMvus | ||
|
||
open Foundation | ||
open Microsoft.Maui | ||
|
||
[<Register("AppDelegate")>] | ||
type AppDelegate() = | ||
inherit MauiUIApplicationDelegate() | ||
|
||
override this.CreateMauiApp() = MauiProgram.CreateMauiApp() |
30 changes: 30 additions & 0 deletions
30
samples/Components/MultipleMvus/Platforms/MacCatalyst/Info.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>UIDeviceFamily</key> | ||
<array> | ||
<integer>1</integer> | ||
<integer>2</integer> | ||
</array> | ||
<key>UIRequiredDeviceCapabilities</key> | ||
<array> | ||
<string>arm64</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations~ipad</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationPortraitUpsideDown</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>XSAppIconAssets</key> | ||
<string>Assets.xcassets/appicon.appiconset</string> | ||
</dict> | ||
</plist> |
9 changes: 9 additions & 0 deletions
9
samples/Components/MultipleMvus/Platforms/MacCatalyst/Program.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace MultipleMvus | ||
|
||
open UIKit | ||
|
||
module Program = | ||
[<EntryPoint>] | ||
let main args = | ||
UIApplication.Main(args, null, typeof<AppDelegate>) | ||
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace CounterApp | ||
|
||
open System | ||
open Microsoft.Maui | ||
open Microsoft.Maui.Hosting | ||
|
||
type Program() = | ||
inherit MauiApplication() | ||
|
||
override this.CreateMauiApp() = MauiProgram.CreateMauiApp() | ||
|
||
module Program = | ||
[<EntryPoint>] | ||
let main args = | ||
let app = Program() | ||
app.Run(args) |
15 changes: 15 additions & 0 deletions
15
samples/Components/MultipleMvus/Platforms/Tizen/tizen-manifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest package="com.companyname.CounterApp" version="1.0.0" api-version="7" xmlns="http://tizen.org/ns/packages"> | ||
<profile name="common" /> | ||
<ui-application appid="com.companyname.CounterApp" exec="CounterApp.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single"> | ||
<label>CounterApp</label> | ||
<icon>appicon.xhigh.png</icon> | ||
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" /> | ||
</ui-application> | ||
<shortcut-list /> | ||
<privileges> | ||
<privilege>http://tizen.org/privilege/internet</privilege> | ||
</privileges> | ||
<dependencies /> | ||
<provides-appdefined-privileges /> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace CounterApp.WinUI | ||
|
||
/// <summary> | ||
/// Provides application-specific behavior to supplement the default Application class. | ||
/// </summary> | ||
type App() = | ||
inherit FSharp.Maui.WinUICompat.App() | ||
|
||
override this.CreateMauiApp() = CounterApp.MauiProgram.CreateMauiApp() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace CounterApp.WinUI | ||
|
||
open System | ||
|
||
module Program = | ||
[<EntryPoint; STAThread>] | ||
let main args = | ||
do FSharp.Maui.WinUICompat.Program.Main(args, typeof<CounterApp.WinUI.App>) | ||
0 |
Oops, something went wrong.