-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Error icon on Snackbar error messages
Add WpfAppDemo application
- Loading branch information
Showing
12 changed files
with
182 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Application x:Class="WpfAppDemo.App" | ||
xmlns="http:https://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http:https://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:WpfAppDemo" | ||
xmlns:materialDesign="http:https://materialdesigninxaml.net/winfx/xaml/themes" | ||
StartupUri="pack:https://application:,,,/WpfApp;component/MainWindow.xaml"> | ||
<Application.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<materialDesign:BundledTheme BaseTheme="Light" PrimaryColor="Orange" SecondaryColor="Pink" /> | ||
<ResourceDictionary Source="pack:https://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" /> | ||
</ResourceDictionary.MergedDictionaries> | ||
</ResourceDictionary> | ||
</Application.Resources> | ||
</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,18 @@ | ||
using Leosac.SharedServices; | ||
using System.Configuration; | ||
using System.Data; | ||
using System.Windows; | ||
|
||
namespace WpfAppDemo | ||
{ | ||
/// <summary> | ||
/// Interaction logic for App.xaml | ||
/// </summary> | ||
public partial class App : Application | ||
{ | ||
public App() | ||
{ | ||
LeosacAppInfo.Instance = new DemoAppInfo(); | ||
} | ||
} | ||
} |
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 @@ | ||
using System.Windows; | ||
|
||
[assembly: ThemeInfo( | ||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located | ||
//(used if a resource is not found in the page, | ||
// or application resource dictionaries) | ||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located | ||
//(used if a resource is not found in the page, | ||
// app, or any theme specific resource dictionaries) | ||
)] |
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,37 @@ | ||
using CommunityToolkit.Mvvm.Input; | ||
using Leosac.WpfApp; | ||
using Leosac.WpfApp.Domain; | ||
using WpfAppDemo.Domain; | ||
|
||
namespace WpfAppDemo | ||
{ | ||
public class DemoAppInfo : LeosacWinAppInfo | ||
{ | ||
public DemoAppInfo() | ||
{ | ||
ApplicationName = "Demo App"; | ||
ApplicationTitle = "Leosac Wpf Demo App"; | ||
} | ||
|
||
public override void InitializeAboutWindow(AboutWindowViewModel model) | ||
{ | ||
|
||
} | ||
|
||
public override void InitializeMainWindow(MainWindowViewModel model) | ||
{ | ||
var HomeCommand = new RelayCommand( | ||
() => | ||
{ | ||
model.SelectedIndex = 0; | ||
}); | ||
|
||
model.MenuItems.Add(new NavItem( | ||
"Home", | ||
typeof(HomeControl), | ||
"House", | ||
new HomeControlViewModel(model.SnackbarMessageQueue) | ||
)); | ||
} | ||
} | ||
} |
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,31 @@ | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
using CommunityToolkit.Mvvm.Input; | ||
using Leosac.WpfApp; | ||
using MaterialDesignThemes.Wpf; | ||
|
||
namespace WpfAppDemo.Domain | ||
{ | ||
public class HomeControlViewModel : ObservableValidator | ||
{ | ||
private readonly ISnackbarMessageQueue _snackbarMessageQueue; | ||
|
||
public HomeControlViewModel(ISnackbarMessageQueue snackbarMessageQueue) | ||
{ | ||
_snackbarMessageQueue = snackbarMessageQueue; | ||
|
||
SnackbarInfoCommand = new RelayCommand(() => | ||
{ | ||
SnackbarHelper.EnqueueMessage(_snackbarMessageQueue, "Simple information message."); | ||
}); | ||
|
||
SnackbarErrorCommand = new RelayCommand(() => | ||
{ | ||
SnackbarHelper.EnqueueError(_snackbarMessageQueue, "An error message. This message is usually longer than other messages as some details may be included."); | ||
}); | ||
} | ||
|
||
public RelayCommand SnackbarInfoCommand { get; } | ||
|
||
public RelayCommand SnackbarErrorCommand { get; } | ||
} | ||
} |
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 @@ | ||
<UserControl x:Class="WpfAppDemo.HomeControl" | ||
xmlns="http:https://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http:https://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http:https://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http:https://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:WpfAppDemo" | ||
xmlns:domain="clr-namespace:WpfAppDemo.Domain" | ||
mc:Ignorable="d" | ||
d:DataContext="{d:DesignInstance domain:HomeControlViewModel}" | ||
d:DesignHeight="450" d:DesignWidth="800"> | ||
<StackPanel Margin="5"> | ||
<Button Content="Snackbar Information Message" Width="250" Command="{Binding SnackbarInfoCommand}" Margin="5" /> | ||
<Button Content="Snackbar Error Message" Width="250" Command="{Binding SnackbarErrorCommand}" Margin="5" /> | ||
</StackPanel> | ||
</UserControl> |
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 @@ | ||
using System.Windows.Controls; | ||
|
||
namespace WpfAppDemo | ||
{ | ||
/// <summary> | ||
/// Interaction logic for MainWindow.xaml | ||
/// </summary> | ||
public partial class HomeControl : UserControl | ||
{ | ||
public HomeControl() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
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 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>WinExe</OutputType> | ||
<TargetFramework>net8.0-windows</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<UseWPF>true</UseWPF> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\WpfApp\WpfApp.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |