diff --git a/GuiWPF/App.config b/GuiWPF/App.config
new file mode 100644
index 0000000..56efbc7
--- /dev/null
+++ b/GuiWPF/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GuiWPF/App.xaml b/GuiWPF/App.xaml
index 24a8184..e551053 100644
--- a/GuiWPF/App.xaml
+++ b/GuiWPF/App.xaml
@@ -1,7 +1,7 @@
-
diff --git a/GuiWPF/App.xaml.cs b/GuiWPF/App.xaml.cs
index d8f7545..4cb5730 100644
--- a/GuiWPF/App.xaml.cs
+++ b/GuiWPF/App.xaml.cs
@@ -6,13 +6,12 @@ using System.Linq;
using System.Threading.Tasks;
using System.Windows;
-namespace GuiWPF
+namespace WPF
{
///
- /// Interaction logic for App.xaml
+ /// Interaktionslogik für "App.xaml"
///
public partial class App : Application
{
-
}
}
diff --git a/GuiWPF/AssemblyInfo.cs b/GuiWPF/AssemblyInfo.cs
deleted file mode 100644
index 2211234..0000000
--- a/GuiWPF/AssemblyInfo.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-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)
-)]
diff --git a/GuiWPF/DelegateCommand.cs b/GuiWPF/DelegateCommand.cs
index 563c40e..0fb734a 100644
--- a/GuiWPF/DelegateCommand.cs
+++ b/GuiWPF/DelegateCommand.cs
@@ -1,8 +1,14 @@
-using System;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
using System.Windows.Input;
-namespace GuiWPF {
- public class DelegateCommand : ICommand {
+namespace WPF
+{
+ public class DelegateCommand : ICommand
+ {
///
/// Action to be performed when this command is executed
///
@@ -72,4 +78,4 @@ namespace GuiWPF {
this.executionAction(parameter);
}
}
-}
\ No newline at end of file
+}
diff --git a/GuiWPF/GuiWPF.csproj.user b/GuiWPF/GuiWPF.csproj.user
new file mode 100644
index 0000000..b5309f2
--- /dev/null
+++ b/GuiWPF/GuiWPF.csproj.user
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/GuiWPF/HomePage.cs b/GuiWPF/HomePage.cs
index 29d1360..16feaa0 100644
--- a/GuiWPF/HomePage.cs
+++ b/GuiWPF/HomePage.cs
@@ -1,5 +1,13 @@
-namespace GuiWPF {
- public class HomePage {
- public string PageTitle {get;set;}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WPF
+{
+ public class HomePage
+ {
+ public string PageTitle { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/GuiWPF/HomePageView.xaml b/GuiWPF/HomePageView.xaml
index b523fba..160631c 100644
--- a/GuiWPF/HomePageView.xaml
+++ b/GuiWPF/HomePageView.xaml
@@ -1,12 +1,13 @@
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
diff --git a/GuiWPF/HomePageView.xaml.cs b/GuiWPF/HomePageView.xaml.cs
new file mode 100644
index 0000000..e3d1408
--- /dev/null
+++ b/GuiWPF/HomePageView.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace WPF
+{
+ ///
+ /// Interaktionslogik für HomePageView.xaml
+ ///
+ public partial class HomePageView : UserControl
+ {
+ public HomePageView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/GuiWPF/HomePageViewModel.cs b/GuiWPF/HomePageViewModel.cs
index 3e4073f..69eafaa 100644
--- a/GuiWPF/HomePageViewModel.cs
+++ b/GuiWPF/HomePageViewModel.cs
@@ -1,27 +1,26 @@
-using System;
+using System;
using System.Collections.Generic;
-using System.Diagnostics;
+using System.Linq;
using System.Text;
+using System.Threading.Tasks;
-namespace GuiWPF
+namespace WPF
{
- public class HomePageViewModel : ViewModelBase {
- //public string PageTitle = "HomePage";
- public HomePage Model {get; private set;}
- public HomePageViewModel(HomePage model) {
+ public class HomePageViewModel : ViewModelBase
+ {
+ public HomePageViewModel(HomePage model)
+ {
this.Model = model;
-
}
-
- public string PageTitle {
- get {
- return Model.PageTitle;
- }
- set {
- Model.PageTitle = value;
- OnPropertyChanged();
+ public HomePage Model { get; private set; }
+ public string PageTitle
+ {
+ get => this.Model.PageTitle;
+ set
+ {
+ this.Model.PageTitle = value;
+ this.OnPropertyChanged("PageTitle");
}
}
}
-
-}
\ No newline at end of file
+}
diff --git a/GuiWPF/MainViewModel.cs b/GuiWPF/MainViewModel.cs
deleted file mode 100644
index da5c659..0000000
--- a/GuiWPF/MainViewModel.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Text;
-using System.Windows.Input;
-
-namespace GuiWPF
-{
- public class MainViewModel : ViewModelBase
- {
- public string PageTitle { get; set; }
- public ICommand LoadHomePageCommand {get; private set;}
- public ICommand LoadSettingsPageCommand {get; private set;}
-
- private ViewModelBase _currentViewModel;
- public ViewModelBase CurrentViewModel {
- get {
- Trace.WriteLine("CurrentAbgefragt");
- return _currentViewModel;
- }
- set {
- Trace.WriteLine("CurrentView ist geändert worden");
- _currentViewModel = value;
- OnPropertyChanged();
- }
- }
-
- public MainViewModel()
- {
- PageTitle = "Dichtheitsprüfung by Damian";
- LoadHomePage();
- LoadHomePageCommand = new DelegateCommand(o => this.LoadHomePage());
- LoadSettingsPageCommand = new DelegateCommand(o => this.LoadSettingsPage());
-
- //Initialisieren();
- }
-
- private void LoadHomePage() {
- CurrentViewModel = new HomePageViewModel(new HomePage() { PageTitle = "Home"});
- }
- private void LoadSettingsPage() {
- CurrentViewModel = new SettingsPageViewModel();
- }
- }
-}
diff --git a/GuiWPF/MainWindow.xaml b/GuiWPF/MainWindow.xaml
index 856eefe..be2f97a 100644
--- a/GuiWPF/MainWindow.xaml
+++ b/GuiWPF/MainWindow.xaml
@@ -1,11 +1,11 @@
-
+ Title="MainWindow" Height="450" Width="800">
@@ -17,8 +17,8 @@
-
+
-
+
diff --git a/GuiWPF/MainWindow.xaml.cs b/GuiWPF/MainWindow.xaml.cs
index 302f829..61b6188 100644
--- a/GuiWPF/MainWindow.xaml.cs
+++ b/GuiWPF/MainWindow.xaml.cs
@@ -13,17 +13,17 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
-namespace GuiWPF
+namespace WPF
{
///
- /// Interaction logic for MainWindow.xaml
+ /// Interaktionslogik für MainWindow.xaml
///
public partial class MainWindow : Window
{
public MainWindow()
{
- //InitializeComponent();
- //this.DataContext = new MainViewModel();
+ InitializeComponent();
+ this.DataContext = new MainWindowViewModel();
}
}
}
diff --git a/GuiWPF/MainWindowViewModel.cs b/GuiWPF/MainWindowViewModel.cs
new file mode 100644
index 0000000..c46eedd
--- /dev/null
+++ b/GuiWPF/MainWindowViewModel.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Input;
+
+namespace WPF
+{
+ public class MainWindowViewModel : ViewModelBase
+ {
+ public ICommand LoadHomePageCommand { get; private set; }
+ public ICommand LoadSettingsPageCommand { get; private set;}
+
+ private ViewModelBase _currentViewModel;
+ public ViewModelBase CurrentViewModel
+ {
+ get => _currentViewModel;
+ set
+ {
+ _currentViewModel = value;
+ OnPropertyChanged("CurrentViewModel");
+ }
+ }
+
+ public MainWindowViewModel()
+ {
+ this.LoadHomePage();
+ this.LoadHomePageCommand = new DelegateCommand(o => this.LoadHomePage());
+ this.LoadSettingsPageCommand = new DelegateCommand(o => this.LoadSettingsPage());
+ }
+
+ private void LoadHomePage()
+ {
+ CurrentViewModel = new HomePageViewModel(
+ new HomePage { PageTitle = "This is the Home Page" });
+ }
+
+ private void LoadSettingsPage()
+ {
+ CurrentViewModel = new SettingsPageViewModel(
+ new SettingsPage() { PageTitle = "This is the SettingsPage" });
+ }
+ }
+}
diff --git a/GuiWPF/NotificationObject.cs b/GuiWPF/NotificationObject.cs
deleted file mode 100644
index 94a10c7..0000000
--- a/GuiWPF/NotificationObject.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-
-namespace GuiWPF
-{
- public class NotificationObject : INotifyPropertyChanged
- {
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected virtual void OnPropertyChanged([CallerMemberName]string propertyName="")
- {
- if(PropertyChanged != null)
- {
- PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
- Trace.WriteLine(string.Format("OnPropertyChanged {0}",propertyName));
- }
- }
- }
-}
diff --git a/GuiWPF/SettingsPage.cs b/GuiWPF/SettingsPage.cs
new file mode 100644
index 0000000..740a5dc
--- /dev/null
+++ b/GuiWPF/SettingsPage.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WPF
+{
+ public class SettingsPage
+ {
+ public string PageTitle { get; set; }
+ }
+}
diff --git a/GuiWPF/SettingsPageView.xaml b/GuiWPF/SettingsPageView.xaml
index 7e2af54..686eef8 100644
--- a/GuiWPF/SettingsPageView.xaml
+++ b/GuiWPF/SettingsPageView.xaml
@@ -1,11 +1,12 @@
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
diff --git a/GuiWPF/SettingsPageView.xaml.cs b/GuiWPF/SettingsPageView.xaml.cs
new file mode 100644
index 0000000..0cb00ce
--- /dev/null
+++ b/GuiWPF/SettingsPageView.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace WPF
+{
+ ///
+ /// Interaktionslogik für SettingsPageView.xaml
+ ///
+ public partial class SettingsPageView : UserControl
+ {
+ public SettingsPageView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/GuiWPF/SettingsPageViewModel.cs b/GuiWPF/SettingsPageViewModel.cs
index f0cfb01..c240c33 100644
--- a/GuiWPF/SettingsPageViewModel.cs
+++ b/GuiWPF/SettingsPageViewModel.cs
@@ -1,11 +1,26 @@
-using System;
+using System;
using System.Collections.Generic;
+using System.Linq;
using System.Text;
+using System.Threading.Tasks;
-namespace GuiWPF
+namespace WPF
{
- public class SettingsPageViewModel : ViewModelBase {
- public string PageTitle = "SettingsPage";
+ public class SettingsPageViewModel : ViewModelBase
+ {
+ public SettingsPageViewModel(SettingsPage model)
+ {
+ this.Model = model;
+ }
+ public SettingsPage Model { get; private set; }
+ public string PageTitle
+ {
+ get => this.Model.PageTitle;
+ set
+ {
+ this.Model.PageTitle = value;
+ this.OnPropertyChanged("PageTitle");
+ }
+ }
}
-
-}
\ No newline at end of file
+}
diff --git a/GuiWPF/ViewModelBase.cs b/GuiWPF/ViewModelBase.cs
index 46e2b38..7f40984 100644
--- a/GuiWPF/ViewModelBase.cs
+++ b/GuiWPF/ViewModelBase.cs
@@ -1,37 +1,25 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
using System.Text;
+using System.Threading.Tasks;
-namespace GuiWPF
+namespace WPF
{
- public class ViewModelBase : NotificationObject
+ public abstract class ViewModelBase : INotifyPropertyChanged
{
- private bool valIsBusy;
- private string valBusyMessage;
-
- public bool IsBusy
+ public event PropertyChangedEventHandler PropertyChanged;
+ protected void OnPropertyChanged(string propertyName)
{
- get => valIsBusy;
- set
- {
- if(valIsBusy != value)
- {
- valIsBusy = value;
- OnPropertyChanged();
- }
- }
+ this.OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
}
- public string BusyMessage
+
+ protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
{
- get => valBusyMessage;
- set
- {
- if(valBusyMessage != value)
- {
- valBusyMessage = value;
- OnPropertyChanged();
- }
- }
+ var handler = this.PropertyChanged;
+ if (handler != null)
+ handler(this, e);
}
}
}