Initial commit.
This commit is contained in:
11
Shared.Wpf/BaseViewModel.cs
Normal file
11
Shared.Wpf/BaseViewModel.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace ClientApiPoC.Shared.Wpf {
|
||||
public abstract class BaseViewModel : NotifyPropertyChangedBase {
|
||||
protected async Task HandleErrorAsync(Exception ex) {
|
||||
if (ex == null) return;
|
||||
MessageBox.Show(ex.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Shared.Wpf/MvvmWindow.cs
Normal file
13
Shared.Wpf/MvvmWindow.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace ClientApiPoC.Shared.Wpf {
|
||||
public abstract class MvvmWindow<TViewModel> : Window where TViewModel : BaseViewModel {
|
||||
protected TViewModel ViewModel { get; }
|
||||
|
||||
public MvvmWindow(TViewModel viewModel) : base() {
|
||||
if (viewModel == null) throw new ArgumentNullException(nameof(viewModel));
|
||||
this.ViewModel = viewModel;
|
||||
this.DataContext = this.ViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
23
Shared.Wpf/Shared.Wpf.csproj
Normal file
23
Shared.Wpf/Shared.Wpf.csproj
Normal file
@@ -0,0 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>ClientApiPoC.Shared.Wpf</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<DebugType>portable</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Shared\Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user