From bee257dd1e366141fcdc3ee81f5b587bfa829d49 Mon Sep 17 00:00:00 2001 From: Stricted Date: Sun, 8 Nov 2015 15:01:38 +0100 Subject: [PATCH] more --- SpeedportHybridControl/App.xaml | 6 ++-- .../Data/SpeedportHybridAPI.cs | 1 + .../{Model => PageModel}/LoginPageModel.cs | 7 ++--- .../{model => PageModel}/MainWindowModel.cs | 3 +- .../PageModel/StatusPageModel.cs | 28 +++++++++++++++++++ .../SpeedportHybridControl.csproj | 5 ++-- SpeedportHybridControl/page/StatusPage.xaml | 2 +- 7 files changed, 41 insertions(+), 11 deletions(-) rename SpeedportHybridControl/{Model => PageModel}/LoginPageModel.cs (98%) rename SpeedportHybridControl/{model => PageModel}/MainWindowModel.cs (99%) create mode 100644 SpeedportHybridControl/PageModel/StatusPageModel.cs diff --git a/SpeedportHybridControl/App.xaml b/SpeedportHybridControl/App.xaml index 40e8a08..21f351c 100644 --- a/SpeedportHybridControl/App.xaml +++ b/SpeedportHybridControl/App.xaml @@ -3,11 +3,13 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:SpeedportHybridControl" xmlns:model="clr-namespace:SpeedportHybridControl.Model" + xmlns:pagemodel="clr-namespace:SpeedportHybridControl.PageModel" StartupUri="MainWindow.xaml"> - - + + + diff --git a/SpeedportHybridControl/Data/SpeedportHybridAPI.cs b/SpeedportHybridControl/Data/SpeedportHybridAPI.cs index bb7fc48..1119882 100644 --- a/SpeedportHybridControl/Data/SpeedportHybridAPI.cs +++ b/SpeedportHybridControl/Data/SpeedportHybridAPI.cs @@ -12,6 +12,7 @@ using SpeedportHybridControl.Implementations; using SpeedportHybridControl.Model; using Newtonsoft.Json; using System.Security; +using SpeedportHybridControl.PageModel; namespace SpeedportHybridControl.Data { public class SpeedportHybridAPI : SingletonFactory { diff --git a/SpeedportHybridControl/Model/LoginPageModel.cs b/SpeedportHybridControl/PageModel/LoginPageModel.cs similarity index 98% rename from SpeedportHybridControl/Model/LoginPageModel.cs rename to SpeedportHybridControl/PageModel/LoginPageModel.cs index 4164356..42b439b 100644 --- a/SpeedportHybridControl/Model/LoginPageModel.cs +++ b/SpeedportHybridControl/PageModel/LoginPageModel.cs @@ -4,8 +4,9 @@ using SpeedportHybridControl.Data; using System.Windows; using System.Threading; using System.Security; +using SpeedportHybridControl.Model; -namespace SpeedportHybridControl.Model { +namespace SpeedportHybridControl.PageModel { class LoginPageModel : SuperViewModel { private string _ip = "speedport.ip"; private string _password; @@ -101,24 +102,20 @@ namespace SpeedportHybridControl.Model { bool login = SpeedportHybridAPI.getInstance().login(password); if (login.Equals(true)) { if (SavePassword.Equals(true)) { - SettingsModel SettingsModel = new SettingsModel { password = password, ip = SpeedportHybridAPI.getInstance().ip }; Settings.save(SettingsModel); - } else { - SettingsModel SettingsModel = new SettingsModel { password = string.Empty, ip = SpeedportHybridAPI.getInstance().ip }; Settings.save(SettingsModel); - } LoginFieldsVisibility = Visibility.Hidden; mwm.ButtonOverviewPageIsActive = true; diff --git a/SpeedportHybridControl/model/MainWindowModel.cs b/SpeedportHybridControl/PageModel/MainWindowModel.cs similarity index 99% rename from SpeedportHybridControl/model/MainWindowModel.cs rename to SpeedportHybridControl/PageModel/MainWindowModel.cs index 5a17a39..ce95de7 100644 --- a/SpeedportHybridControl/model/MainWindowModel.cs +++ b/SpeedportHybridControl/PageModel/MainWindowModel.cs @@ -5,8 +5,9 @@ using SpeedportHybridControl.page; using System.Windows.Media; using System.Threading; using SpeedportHybridControl.Data; +using SpeedportHybridControl.Model; -namespace SpeedportHybridControl.Model { +namespace SpeedportHybridControl.PageModel { class MainWindowModel : SuperViewModel { private string _loginButtonContent = "Login"; diff --git a/SpeedportHybridControl/PageModel/StatusPageModel.cs b/SpeedportHybridControl/PageModel/StatusPageModel.cs new file mode 100644 index 0000000..002b3a1 --- /dev/null +++ b/SpeedportHybridControl/PageModel/StatusPageModel.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SpeedportHybridControl.Model; +using SpeedportHybridControl.Implementations; +using System.Threading; +using SpeedportHybridControl.Data; + +namespace SpeedportHybridControl.PageModel { + class StatusPageModel : SuperViewModel { + private DelegateCommand _reloadCommand; + + public DelegateCommand ReloadCommand { + get { return _reloadCommand; } + set { SetProperty(ref _reloadCommand, value); } + } + + private void OnReloadCommandExecute () { + new Thread(() => { SpeedportHybrid.initStatus(); }).Start(); + } + + public StatusPageModel () { + ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute)); + } + } +} diff --git a/SpeedportHybridControl/SpeedportHybridControl.csproj b/SpeedportHybridControl/SpeedportHybridControl.csproj index e9e0c5b..619182a 100644 --- a/SpeedportHybridControl/SpeedportHybridControl.csproj +++ b/SpeedportHybridControl/SpeedportHybridControl.csproj @@ -66,9 +66,9 @@ - + - + @@ -134,6 +134,7 @@ + AboutPage.xaml diff --git a/SpeedportHybridControl/page/StatusPage.xaml b/SpeedportHybridControl/page/StatusPage.xaml index 6ba326e..b84476c 100644 --- a/SpeedportHybridControl/page/StatusPage.xaml +++ b/SpeedportHybridControl/page/StatusPage.xaml @@ -111,6 +111,6 @@ -