-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from AvaloniaCommunity/feature/Avalonia-0.11pre4
Avalonia v11.0.0-preview4
- Loading branch information
Showing
35 changed files
with
498 additions
and
224 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
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
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
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
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 |
---|---|---|
@@ -1,76 +1,90 @@ | ||
using System; | ||
using Avalonia; | ||
using Avalonia.Markup.Xaml; | ||
using SampleMvvmApp.ViewModels; | ||
using SampleMvvmApp.Views; | ||
using Prism.DryIoc; | ||
using Prism.Ioc; | ||
using Prism.Modularity; | ||
using Prism.Regions; | ||
using SampleMvvmApp.Services; | ||
using SampleMvvmApp.ViewModels; | ||
using SampleMvvmApp.Views; | ||
|
||
namespace SampleMvvmApp; | ||
|
||
namespace SampleMvvmApp | ||
/// <summary> | ||
/// Application entry point. | ||
/// | ||
/// The methods below are laid out in their order of operation to assist | ||
/// you getting started with Prism.Avalonia. | ||
/// </summary> | ||
public class App : PrismApplication | ||
{ | ||
/// <summary> | ||
/// Application entry point. | ||
/// The methods in this file are layed out in their respective calling order | ||
/// to help you learn the order of operation. | ||
/// </summary> | ||
public class App : PrismApplication | ||
/// <summary>App entry point.</summary> | ||
public App() | ||
{ | ||
/// <summary>App entry point.</summary> | ||
public App() | ||
{ | ||
Console.WriteLine("Constructor()"); | ||
} | ||
Console.WriteLine("Constructor()"); | ||
} | ||
|
||
// Note: | ||
// Though, Prism.WPF v8.1 uses, `protected virtual void Initialize()` | ||
// Avalonia's AppBuilderBase.cs calls, `.Setup() { ... Instance.Initialize(); ... }` | ||
// Therefore, we need this as a `public override void` in PrismApplicationBase.cs | ||
public override void Initialize() | ||
{ | ||
Console.WriteLine("Initialize()"); | ||
AvaloniaXamlLoader.Load(this); | ||
// Note: | ||
// Though, Prism.WPF v8.1 uses, `protected virtual void Initialize()` | ||
// Avalonia's AppBuilderBase.cs calls, `.Setup() { ... Instance.Initialize(); ... }` | ||
// Therefore, we need this as a `public override void` in PrismApplicationBase.cs | ||
public override void Initialize() | ||
{ | ||
Console.WriteLine("Initialize()"); | ||
AvaloniaXamlLoader.Load(this); | ||
|
||
// DON'T FORGET TO CALL THIS | ||
base.Initialize(); | ||
} | ||
// Initializes Prism.Avalonia - DO NOT REMOVE | ||
base.Initialize(); | ||
} | ||
|
||
/// <summary>Called after Initialize.</summary> | ||
protected override void OnInitialized() | ||
{ | ||
// Register Views to the Region it will appear in. Don't register them in the ViewModel. | ||
var regionManager = Container.Resolve<IRegionManager>(); | ||
regionManager.RegisterViewWithRegion(RegionNames.ContentRegion, typeof(DashboardView)); | ||
regionManager.RegisterViewWithRegion(RegionNames.SidebarRegion, typeof(SidebarView)); | ||
/// <summary>Register Services and Views.</summary> | ||
/// <param name="containerRegistry"></param> | ||
protected override void RegisterTypes(IContainerRegistry containerRegistry) | ||
{ | ||
Console.WriteLine("RegisterTypes()"); | ||
|
||
////var logService = Container.Resolve<ILogService>(); | ||
////logService.Configure("swlog.config"); | ||
} | ||
// Services | ||
containerRegistry.RegisterSingleton<INotificationService, NotificationService>(); | ||
|
||
protected override void RegisterTypes(IContainerRegistry containerRegistry) | ||
{ | ||
Console.WriteLine("RegisterTypes()"); | ||
// Views - Generic | ||
//// containerRegistry.Register<SidebarView>(); // Not required | ||
//// containerRegistry.Register<MainWindow>(); | ||
|
||
// Services | ||
containerRegistry.RegisterSingleton<INotificationService, NotificationService>(); | ||
// Views - Region Navigation | ||
containerRegistry.RegisterForNavigation<DashboardView, DashboardViewModel>(); | ||
containerRegistry.RegisterForNavigation<SettingsView, SettingsViewModel>(); | ||
containerRegistry.RegisterForNavigation<SubSettingsView, SubSettingsViewModel>(); | ||
} | ||
|
||
/// <summary>Register optional modules in the catalog.</summary> | ||
/// <param name="moduleCatalog">Module Catalog.</param> | ||
protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog) | ||
{ | ||
base.ConfigureModuleCatalog(moduleCatalog); | ||
} | ||
|
||
// Views - Generic | ||
containerRegistry.Register<SidebarView>(); | ||
containerRegistry.Register<MainWindow>(); | ||
/// <summary>User interface entry point, called after Register and ConfigureModules.</summary> | ||
/// <returns>Startup View.</returns> | ||
protected override IAvaloniaObject CreateShell() | ||
{ | ||
Console.WriteLine("CreateShell()"); | ||
return Container.Resolve<MainWindow>(); | ||
} | ||
|
||
/// <summary>Called after Initialize.</summary> | ||
protected override void OnInitialized() | ||
{ | ||
// Register Views to the Region it will appear in. Don't register them in the ViewModel. | ||
var regionManager = Container.Resolve<IRegionManager>(); | ||
|
||
// Views - Region Navigation | ||
containerRegistry.RegisterForNavigation<DashboardView, DashboardViewModel>(); | ||
containerRegistry.RegisterForNavigation<SettingsView, SettingsViewModel>(); | ||
containerRegistry.RegisterForNavigation<SubSettingsView, SubSettingsViewModel>(); | ||
} | ||
// WARNING: Prism v11.0.0-prev4 | ||
// - DataTemplates MUST define a DataType or else an XAML error will be thrown | ||
// - Error: DataTemplate inside of DataTemplates must have a DataType set | ||
regionManager.RegisterViewWithRegion(RegionNames.ContentRegion, typeof(DashboardView)); | ||
regionManager.RegisterViewWithRegion(RegionNames.SidebarRegion, typeof(SidebarView)); | ||
|
||
/// <summary>User interface entry point, called after Register and ConfigureModules.</summary> | ||
/// <returns>Startup View.</returns> | ||
protected override IAvaloniaObject CreateShell() | ||
{ | ||
Console.WriteLine("CreateShell()"); | ||
return Container.Resolve<MainWindow>(); | ||
} | ||
////var logService = Container.Resolve<ILogService>(); | ||
////logService.Configure("swlog.config"); | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1,19 +1,18 @@ | ||
using Avalonia.Controls; | ||
using Avalonia.Markup.Xaml; | ||
|
||
namespace SampleMvvmApp.Views | ||
namespace SampleMvvmApp.Views; | ||
|
||
/// <summary>DashboardView.</summary> | ||
public partial class DashboardView : UserControl | ||
{ | ||
/// <summary>DashboardView.</summary> | ||
public partial class DashboardView : UserControl | ||
public DashboardView() | ||
{ | ||
public DashboardView() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
this.InitializeComponent(); | ||
} | ||
|
||
private void InitializeComponent() | ||
{ | ||
AvaloniaXamlLoader.Load(this); | ||
} | ||
private void InitializeComponent() | ||
{ | ||
AvaloniaXamlLoader.Load(this); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,7 @@ | ||
<prism:PrismApplication xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:prism="clr-namespace:Prism.DryIoc;assembly=Prism.DryIoc.Avalonia" | ||
x:Class="ViewDiscovery.App"> | ||
<Application xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
x:Class="ViewDiscovery.App"> | ||
<Application.Styles> | ||
<StyleInclude Source="resm:Avalonia.Themes.Default.DefaultTheme.xaml?assembly=Avalonia.Themes.Default"/> | ||
<StyleInclude Source="resm:Avalonia.Themes.Default.Accents.BaseLight.xaml?assembly=Avalonia.Themes.Default"/> | ||
<FluentTheme Mode="Light" /> | ||
</Application.Styles> | ||
</prism:PrismApplication> | ||
</Application> |
Oops, something went wrong.