From d12d28e45c769c08583c5f38284547bfea96db85 Mon Sep 17 00:00:00 2001 From: Stricted Date: Mon, 25 Jan 2016 04:42:32 +0100 Subject: [PATCH] solve some issues --- .../util.cs | 2 +- .../Data/SpeedportHybrid.cs | 4 +-- .../PageModel/AboutPageModel.cs | 2 +- .../PageModel/LoginPageModel.cs | 33 ++++++++++--------- .../PageModel/LteInfoModel.cs | 11 +++++++ .../PageModel/ltepopupModel.cs | 2 ++ SpeedportHybridControl/page/LoginPage.xaml | 4 +-- 7 files changed, 36 insertions(+), 22 deletions(-) diff --git a/SpeedportHybridControl.Implementations/util.cs b/SpeedportHybridControl.Implementations/util.cs index 4187db9..a3c814e 100644 --- a/SpeedportHybridControl.Implementations/util.cs +++ b/SpeedportHybridControl.Implementations/util.cs @@ -131,7 +131,7 @@ namespace SpeedportHybridControl.Implementations { return Brushes.Red; } - else if (rsrp >= -126) + else if (rsrp <= -126) { return Brushes.DarkRed; } diff --git a/SpeedportHybridControl/Data/SpeedportHybrid.cs b/SpeedportHybridControl/Data/SpeedportHybrid.cs index 329aded..e13da8e 100644 --- a/SpeedportHybridControl/Data/SpeedportHybrid.cs +++ b/SpeedportHybridControl/Data/SpeedportHybrid.cs @@ -282,9 +282,7 @@ namespace SpeedportHybridControl.Data } } } - - // overview.days_online = ""; // TODO - + overview.datetime = time.ToString(format); jArray = null; diff --git a/SpeedportHybridControl/PageModel/AboutPageModel.cs b/SpeedportHybridControl/PageModel/AboutPageModel.cs index e68e403..aff67ba 100644 --- a/SpeedportHybridControl/PageModel/AboutPageModel.cs +++ b/SpeedportHybridControl/PageModel/AboutPageModel.cs @@ -43,7 +43,7 @@ namespace SpeedportHybridControl.PageModel private void OnBugtrackerCommandExecute() { - Process.Start("https://stricted.net/bugtracker/index.php/ProductList/"); + Process.Start("https://bugtracker.stricted.net/index.php/ProductList/"); } private void OnUpdateCommandExecute() diff --git a/SpeedportHybridControl/PageModel/LoginPageModel.cs b/SpeedportHybridControl/PageModel/LoginPageModel.cs index 513eb4c..c61b5a7 100644 --- a/SpeedportHybridControl/PageModel/LoginPageModel.cs +++ b/SpeedportHybridControl/PageModel/LoginPageModel.cs @@ -19,7 +19,6 @@ namespace SpeedportHybridControl.PageModel private Visibility _loginFieldsVisibility = Visibility.Visible; private DelegateCommand _showPasswordCommand; - private DelegateCommand _savePasswordCommand; private DelegateCommand _loginCommand; public string ip @@ -31,7 +30,16 @@ namespace SpeedportHybridControl.PageModel public string password { get { return _password; } - set { SetProperty(ref _password, value); } + set { + // TODO: find a better way + if (value.IsNullOrEmpty().Equals(true)) + { + if (SavePassword.Equals(true)) + return; + + } + SetProperty(ref _password, value); + } } public string LoginButtonText @@ -76,12 +84,6 @@ namespace SpeedportHybridControl.PageModel set { SetProperty(ref _showPasswordCommand, value); } } - public DelegateCommand SavePasswordCommand - { - get { return _savePasswordCommand; } - set { SetProperty(ref _savePasswordCommand, value); } - } - public DelegateCommand LoginCommand { get { return _loginCommand; } @@ -101,11 +103,6 @@ namespace SpeedportHybridControl.PageModel } } - private void OnSavePasswordCommandExecute() - { - Console.WriteLine(SavePassword); - } - private void OnLoginCommandExecute() { MainWindowModel mwm = Application.Current.FindResource("MainWindowModel") as MainWindowModel; @@ -139,6 +136,7 @@ namespace SpeedportHybridControl.PageModel Settings.save(SettingsModel); } + LoginFieldsVisibility = Visibility.Hidden; mwm.ButtonOverviewPageIsActive = true; mwm.ButtonDSLPageIsActive = true; @@ -161,7 +159,6 @@ namespace SpeedportHybridControl.PageModel else { if (SpeedportHybridAPI.getInstance().logout().Equals(true)) { - // TODO: util.logout(); LogoutAction(); } } @@ -169,6 +166,13 @@ namespace SpeedportHybridControl.PageModel public void LogoutAction() { + LteInfoModel lim = Application.Current.FindResource("LteInfoModel") as LteInfoModel; + lim.ClosePopup(); + lim.StopTimer(); + + DslPageModel dpm = Application.Current.FindResource("DslPageModel") as DslPageModel; + dpm.StopTimer(); + MainWindowModel mwm = Application.Current.FindResource("MainWindowModel") as MainWindowModel; LoginFieldsVisibility = Visibility.Visible; mwm.ButtonOverviewPageIsActive = false; @@ -202,7 +206,6 @@ namespace SpeedportHybridControl.PageModel } ShowPasswordCommand = new DelegateCommand(new Action(OnShowPasswordCommandExecute)); - SavePasswordCommand = new DelegateCommand(new Action(OnSavePasswordCommandExecute)); LoginCommand = new DelegateCommand(new Action(OnLoginCommandExecute)); } } diff --git a/SpeedportHybridControl/PageModel/LteInfoModel.cs b/SpeedportHybridControl/PageModel/LteInfoModel.cs index 8948eb0..9ec3551 100644 --- a/SpeedportHybridControl/PageModel/LteInfoModel.cs +++ b/SpeedportHybridControl/PageModel/LteInfoModel.cs @@ -244,6 +244,17 @@ namespace SpeedportHybridControl.PageModel set { SetProperty(ref _frequenz, value); } } + public void ClosePopup() + { + ltepopupModel lm = Application.Current.FindResource("ltepopupModel") as ltepopupModel; + lm.StopTimer(); + if (Object.Equals(_ltepopup, null).Equals(false)) + { + _ltepopup.Close(); + _ltepopup = null; + } + } + public LteInfoModel() { ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute)); diff --git a/SpeedportHybridControl/PageModel/ltepopupModel.cs b/SpeedportHybridControl/PageModel/ltepopupModel.cs index 803daad..7466736 100644 --- a/SpeedportHybridControl/PageModel/ltepopupModel.cs +++ b/SpeedportHybridControl/PageModel/ltepopupModel.cs @@ -154,6 +154,8 @@ namespace SpeedportHybridControl.PageModel public void StartTimer() { + StopTimer(); + _timer = new System.Timers.Timer { Interval = 1000, // every second diff --git a/SpeedportHybridControl/page/LoginPage.xaml b/SpeedportHybridControl/page/LoginPage.xaml index e6c9d7c..33b14fc 100644 --- a/SpeedportHybridControl/page/LoginPage.xaml +++ b/SpeedportHybridControl/page/LoginPage.xaml @@ -16,9 +16,9 @@ - + - +