@@ -14,55 +14,58 @@ or if you have an older version
14
14
15
15
Add a Caliburn.Micro.Maui nuget package to your solution. From the terminal window you can use this command
16
16
17
- dotnet add package Caliburn.Micro.Maui --version 5.0.183-beta --source "https://nuget.pkg.github.com/caliburn-micro/index.json "
17
+ dotnet add package Caliburn.Micro.Maui --version 5.0.183-beta --source "https://nuget.pkg.github.com/caliburn-micro/index.json"
18
18
19
19
In the platforms folder android modify the MainApplication class to this
20
20
21
- [ Application]
22
- public class MainApplication : Caliburn.Micro.Maui.CaliburnApplication
23
- {
24
- public MainApplication(IntPtr handle, JniHandleOwnership ownership)
25
- : base(handle, ownership)
26
- {
27
- Initialize();
28
- }
29
-
30
- protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
31
-
32
- protected override void Configure()
33
- {
34
- base.Configure();
35
- }
36
-
37
- protected override IEnumerable<Assembly > SelectAssemblies()
38
- {
39
- return new List<Assembly >() { typeof(App).Assembly };
40
- }
41
- }
21
+ [Application]
22
+ public class MainApplication : Caliburn.Micro.Maui.CaliburnApplication
23
+ {
24
+ public MainApplication(IntPtr handle, JniHandleOwnership ownership)
25
+ : base(handle, ownership)
26
+ {
27
+ Initialize();
28
+ }
29
+
30
+ protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
31
+
32
+ protected override void Configure()
33
+ {
34
+ base.Configure();
35
+ }
36
+
37
+ protected override IEnumerable<Assembly> SelectAssemblies()
38
+ {
39
+ return new List<Assembly>() { typeof(App).Assembly };
40
+ }
41
+ }
42
+
42
43
In the iOS folder modify AppDelgate to this
43
44
44
- [ Register("AppDelegate")]
45
- public class AppDelegate : Caliburn.Micro.Maui.CaliburnApplicationDelegate
46
- {
47
- public AppDelegate()
45
+ [Register("AppDelegate")]
46
+ public class AppDelegate : Caliburn.Micro.Maui.CaliburnApplicationDelegate
48
47
{
49
- Initialize();
50
- }
48
+ public AppDelegate()
49
+ {
50
+ Initialize();
51
+ }
51
52
52
- protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
53
- }
53
+ protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
54
+ }
55
+
54
56
In the MacCatalyst folder modify AppDelegate to this
55
57
56
- [ Register("AppDelegate")]
57
- public class AppDelegate : Caliburn.Micro.Maui.CaliburnApplicationDelegate
58
- {
59
- public AppDelegate()
60
- {
61
- Initialize();
62
- }
58
+ [Register("AppDelegate")]
59
+ public class AppDelegate : Caliburn.Micro.Maui.CaliburnApplicationDelegate
60
+ {
61
+ public AppDelegate()
62
+ {
63
+ Initialize();
64
+ }
63
65
64
- protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
65
- }
66
+ protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
67
+ }
68
+
66
69
In the Windows folder modify the App.Xaml to this
67
70
68
71
<cal: CaliburnApplication
@@ -78,49 +81,51 @@ Make sure you replace x:Class with your apps name
78
81
79
82
cs file
80
83
81
- public partial class App : Caliburn.Micro.Maui.CaliburnApplication
82
- {
83
- /// <summary >
84
- /// Initializes the singleton application object. This is the first line of authored code
85
- /// executed, and as such is the logical equivalent of main() or WinMain().
86
- /// </summary >
87
- public App()
88
- {
89
- this.InitializeComponent();
90
- Initialize();
91
- }
92
-
93
- protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
94
- }
84
+ public partial class App : Caliburn.Micro.Maui.CaliburnApplication
85
+ {
86
+ /// <summary>
87
+ /// Initializes the singleton application object. This is the first line of authored code
88
+ /// executed, and as such is the logical equivalent of main() or WinMain().
89
+ /// </summary>
90
+ public App()
91
+ {
92
+ this.InitializeComponent();
93
+ Initialize();
94
+ }
95
+
96
+ protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
97
+
98
+
95
99
The App.Xaml in project root folder should be modified like this
96
100
97
- <? xml version = "1.0" encoding = "UTF-8" ?>
98
- <cal: MauiApplication xmlns="http://schemas.microsoft.com/dotnet/2021/maui "
99
- xmlns: x ="http://schemas.microsoft.com/winfx/2009/xaml "
100
- xmlns: local ="clr-namespace: MauiApp2 "
101
- xmlns: cal ="using: Caliburn .Micro.Maui"
102
- x: Class ="MauiApp2.App">
103
- <Application.Resources>
104
- <ResourceDictionary >
105
- <ResourceDictionary.MergedDictionaries>
106
- <ResourceDictionary Source =" Resources/Styles/Colors.xaml " />
107
- <ResourceDictionary Source =" Resources/Styles/Styles.xaml " />
108
- </ResourceDictionary.MergedDictionaries>
109
- </ResourceDictionary >
110
- </Application.Resources>
111
- </cal: MauiApplication >
101
+ <?xml version = "1.0" encoding = "UTF-8" ?>
102
+ <cal:MauiApplication xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
103
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
104
+ xmlns:local="clr-namespace:MauiApp2"
105
+ xmlns:cal="using:Caliburn.Micro.Maui"
106
+ x:Class="MauiApp2.App">
107
+ <Application.Resources>
108
+ <ResourceDictionary>
109
+ <ResourceDictionary.MergedDictionaries>
110
+ <ResourceDictionary Source="Resources/Styles/Colors.xaml" />
111
+ <ResourceDictionary Source="Resources/Styles/Styles.xaml" />
112
+ </ResourceDictionary.MergedDictionaries>
113
+ </ResourceDictionary>
114
+ </Application.Resources>
115
+ </cal:MauiApplication>
116
+
112
117
Replace xmlns: Local with your app name
113
118
114
119
The App.Xamal.cs file
115
120
116
- public partial class App : Caliburn.Micro.Maui.MauiApplication
117
- {
118
- public App()
121
+ public partial class App : Caliburn.Micro.Maui.MauiApplication
119
122
{
120
- InitializeComponent();
123
+ public App()
124
+ {
125
+ InitializeComponent();
121
126
122
- Initialize();
127
+ Initialize();
123
128
124
- DisplayRootViewForAsync<MainViewModel>();
129
+ DisplayRootViewForAsync<MainViewModel>();
130
+ }
125
131
}
126
- }
0 commit comments