-
Notifications
You must be signed in to change notification settings - Fork 9
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
bbd5efa
commit 69dfabc
Showing
61 changed files
with
1,800 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<Application xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:fluentContentDialog="clr-namespace:Demo.FluentContentDialog" | ||
xmlns:sty="using:FluentAvalonia.Styling" | ||
x:Class="Demo.FluentContentDialog.App"> | ||
<Application.DataTemplates> | ||
<fluentContentDialog:ViewLocator/> | ||
</Application.DataTemplates> | ||
|
||
<Application.Styles> | ||
<sty:FluentAvaloniaTheme /> | ||
<!-- <FluentTheme Mode="Light"/> --> | ||
<Style Selector="Button"> | ||
<Setter Property="VerticalAlignment" Value="Stretch" /> | ||
<Setter Property="HorizontalAlignment" Value="Stretch" /> | ||
<Setter Property="VerticalContentAlignment" Value="Center" /> | ||
<Setter Property="HorizontalContentAlignment" Value="Center" /> | ||
</Style> | ||
<Style Selector="TextBlock"> | ||
<Setter Property="TextWrapping" Value="Wrap" /> | ||
</Style> | ||
</Application.Styles> | ||
</Application> |
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,47 @@ | ||
using System; | ||
using Avalonia; | ||
using Avalonia.Controls.ApplicationLifetimes; | ||
using Avalonia.Markup.Xaml; | ||
using HanumanInstitute.MvvmDialogs; | ||
using HanumanInstitute.MvvmDialogs.Avalonia; | ||
using Microsoft.Extensions.Logging; | ||
using Splat; | ||
|
||
namespace Demo.FluentContentDialog; | ||
|
||
public class App : Application | ||
{ | ||
public override void Initialize() | ||
{ | ||
AvaloniaXamlLoader.Load(this); | ||
|
||
var build = Locator.CurrentMutable; | ||
var loggerFactory = LoggerFactory.Create(builder => builder.AddFilter(logLevel => true).AddDebug()); | ||
|
||
build.RegisterLazySingleton(() => (IDialogService)new DialogService( | ||
new DialogManager( | ||
viewLocator: new ViewLocator(), | ||
logger: loggerFactory.CreateLogger<DialogManager>(), | ||
dialogFactory: new DialogFactory().AddFluent()), | ||
viewModelFactory: x => Locator.Current.GetService(x))); | ||
|
||
SplatRegistrations.Register<MainWindowViewModel>(); | ||
SplatRegistrations.SetupIOC(); | ||
} | ||
|
||
public override void OnFrameworkInitializationCompleted() | ||
{ | ||
GC.KeepAlive(typeof(DialogService)); | ||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) | ||
{ | ||
desktop.MainWindow = new MainWindow | ||
{ | ||
DataContext = MainWindow | ||
}; | ||
} | ||
|
||
base.OnFrameworkInitializationCompleted(); | ||
} | ||
|
||
public static MainWindowViewModel MainWindow => Locator.Current.GetService<MainWindowViewModel>(); | ||
} |
28 changes: 28 additions & 0 deletions
28
samples/Avalonia/Demo.FluentContentDialog/Demo.FluentContentDialog.csproj
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,28 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>WinExe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<LangVersion>default</LangVersion> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<None Remove=".gitignore" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Avalonia" Version="0.10.15" /> | ||
<PackageReference Include="Avalonia.Desktop" Version="0.10.15" /> | ||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.--> | ||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.15" /> | ||
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.15" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" /> | ||
<PackageReference Include="Splat.DependencyInjection.SourceGenerator" Version="1.1.33"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\src\MvvmDialogs.Avalonia.Fluent\MvvmDialogs.Avalonia.Fluent.csproj" /> | ||
<ProjectReference Include="..\..\..\src\MvvmDialogs.Avalonia.MessageBox\MvvmDialogs.Avalonia.MessageBox.csproj" /> | ||
<ProjectReference Include="..\..\..\src\MvvmDialogs.Avalonia\MvvmDialogs.Avalonia.csproj" /> | ||
</ItemGroup> | ||
</Project> |
39 changes: 39 additions & 0 deletions
39
samples/Avalonia/Demo.FluentContentDialog/MainWindow.axaml
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,39 @@ | ||
<Window | ||
x:Class="Demo.FluentContentDialog.MainWindow" | ||
xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:fluentContentDialog="clr-namespace:Demo.FluentContentDialog" | ||
mc:Ignorable="d" | ||
WindowStartupLocation="CenterScreen" | ||
Title="Demo - Message Box" | ||
Width="300" | ||
Height="200" | ||
d:DataContext="{x:Static fluentContentDialog:App.MainWindow}"> | ||
|
||
<UniformGrid Columns="2" Rows="3"> | ||
<Button | ||
Command="{Binding ShowMessageBoxWithMessageCommand}"> | ||
<TextBlock Text="Show message box with message" /> | ||
</Button> | ||
<Button | ||
Command="{Binding ShowMessageBoxWithCaptionCommand}"> | ||
<TextBlock Text="Show message box with caption" /> | ||
</Button> | ||
<Button | ||
Command="{Binding ShowMessageBoxWithButtonCommand}"> | ||
<TextBlock Text="Show message box with buttons" /> | ||
</Button> | ||
<Button | ||
Command="{Binding ShowMessageBoxWithIconCommand}"> | ||
<TextBlock Text="Show message box with icon" /> | ||
</Button> | ||
<Button | ||
Command="{Binding ShowMessageBoxWithDefaultResultCommand}"> | ||
<TextBlock Text="Show message box with default result" /> | ||
</Button> | ||
<TextBlock TextWrapping="Wrap" | ||
Text="{Binding Confirmation}" /> | ||
</UniformGrid> | ||
</Window> |
18 changes: 18 additions & 0 deletions
18
samples/Avalonia/Demo.FluentContentDialog/MainWindow.axaml.cs
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,18 @@ | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
using Avalonia.Markup.Xaml; | ||
|
||
namespace Demo.FluentContentDialog; | ||
|
||
public partial class MainWindow : Window | ||
{ | ||
public MainWindow() | ||
{ | ||
InitializeComponent(); | ||
#if DEBUG | ||
this.AttachDevTools(); | ||
#endif | ||
} | ||
|
||
private void InitializeComponent() => AvaloniaXamlLoader.Load(this); | ||
} |
Oops, something went wrong.