From: Stricted Date: Wed, 11 Nov 2015 13:33:06 +0000 (+0100) Subject: move some stuff around and remove unused stuff X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7e17b625b5398db0e73ba142abeed89f6911a940;p=GitHub%2FStricted%2FSpeedportHybridControl.git move some stuff around and remove unused stuff --- diff --git a/SpeedportHybridControl.Implementations/PasswordHelper.cs b/SpeedportHybridControl.Implementations/PasswordHelper.cs index 7b5e0ae..316a815 100644 --- a/SpeedportHybridControl.Implementations/PasswordHelper.cs +++ b/SpeedportHybridControl.Implementations/PasswordHelper.cs @@ -1,8 +1,4 @@ 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; diff --git a/SpeedportHybridControl.Implementations/util.cs b/SpeedportHybridControl.Implementations/util.cs index 09e8bbf..b3d3911 100644 --- a/SpeedportHybridControl.Implementations/util.cs +++ b/SpeedportHybridControl.Implementations/util.cs @@ -4,8 +4,6 @@ using System; using System.Linq; using System.Security.Cryptography; using System.Text; -using System.Threading; -using System.Windows; using System.Windows.Media; using System.Xml; @@ -174,97 +172,6 @@ namespace SpeedportHybridControl.Implementations { return false; } - /** - * process login stuff - */ - /* - public static void login () { - try { - Application.Current.Dispatcher.BeginInvoke(new Action(() => { - MainWindow MainWindow = Application.Current.MainWindow as MainWindow; - - // LoginPage - LoginPage LoginPage = MainWindow.loginPage as LoginPage; - LoginPage.button1.Content = "Logout"; - LoginPage.PasswordCheckBox.Visibility = Visibility.Hidden; - LoginPage.tbip.Visibility = Visibility.Hidden; - LoginPage.diTextBlock.Visibility = Visibility.Hidden; - LoginPage.tbpw.Visibility = Visibility.Hidden; - LoginPage.PasswordBox.Visibility = Visibility.Hidden; - LoginPage.cbSave.Visibility = Visibility.Hidden; - - // MainWindow - MainWindow.btnLogin.Content = "Logout"; - - MainWindow.btnOverview.IsEnabled = true; - MainWindow.btnDsl.IsEnabled = true; - MainWindow.btnLteInfo.IsEnabled = true; - MainWindow.btnSyslog.IsEnabled = true; - MainWindow.btnTR181.IsEnabled = true; - MainWindow.btnPhone.IsEnabled = true; - MainWindow.btnLan.IsEnabled = true; - MainWindow.btnControls.IsEnabled = true; - })); - } - catch (Exception ex) { - Console.WriteLine(ex.Message); - } - } - */ - /** - * process logout stuff - */ - /* - public static void logout () { - try { - Application.Current.Dispatcher.BeginInvoke(new Action(() => { - MainWindow MainWindow = Application.Current.MainWindow as MainWindow; - - // LteInfoPage - LteInfoPage lteInfo = MainWindow.lteInfoPage as LteInfoPage; - if (Object.Equals(lteInfo._ltepopup, null).Equals(false)) { - lteInfo._ltepopup.StopTimer(); - lteInfo._ltepopup.Hide(); - lteInfo._ltepopup = null; - } - lteInfo.StopTimer(); - - // DslPage - DslPage dslInfo = MainWindow.dslPage as DslPage; - dslInfo.StopTimer(); - - // LoginPage - LoginPage LoginPage = MainWindow.loginPage as LoginPage; - LoginPage.PasswordBox.Visibility = Visibility.Visible; - LoginPage.tbip.Visibility = Visibility.Visible; - LoginPage.diTextBlock.Visibility = Visibility.Visible; - LoginPage.tbpw.Visibility = Visibility.Visible; - LoginPage.PasswordCheckBox.Visibility = Visibility.Visible; - LoginPage.button1.Content = "Login"; - LoginPage.cbSave.Visibility = Visibility.Visible; - LoginPage.PasswordBox.Focus(); - - // MainWindow - MainWindow.btnLogin.Content = "Login"; - MainWindow.frame.Content = MainWindow.loginPage; - MainWindow.changeColor(MainWindow.btnLogin); - - MainWindow.btnOverview.IsEnabled = false; - MainWindow.btnDsl.IsEnabled = false; - MainWindow.btnLteInfo.IsEnabled = false; - MainWindow.btnSyslog.IsEnabled = false; - MainWindow.btnTR181.IsEnabled = false; - MainWindow.btnPhone.IsEnabled = false; - MainWindow.btnLan.IsEnabled = false; - MainWindow.btnControls.IsEnabled = false; - })); - } - catch (Exception ex) { - Console.WriteLine(ex.Message); - } - } - */ - public static bool checkInstalled (string c_name) { string displayName = string.Empty; diff --git a/SpeedportHybridControl/App.xaml b/SpeedportHybridControl/App.xaml index 21f351c..dbc3ae3 100644 --- a/SpeedportHybridControl/App.xaml +++ b/SpeedportHybridControl/App.xaml @@ -11,7 +11,6 @@ - diff --git a/SpeedportHybridControl/App.xaml.cs b/SpeedportHybridControl/App.xaml.cs index e614b40..74481b4 100644 --- a/SpeedportHybridControl/App.xaml.cs +++ b/SpeedportHybridControl/App.xaml.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; -using System.Linq; -using System.Threading.Tasks; -using System.Windows; +using System.Windows; namespace SpeedportHybridControl { /// diff --git a/SpeedportHybridControl/Data/SpeedportHybrid.cs b/SpeedportHybridControl/Data/SpeedportHybrid.cs index fac5cdb..0b964cf 100644 --- a/SpeedportHybridControl/Data/SpeedportHybrid.cs +++ b/SpeedportHybridControl/Data/SpeedportHybrid.cs @@ -5,6 +5,7 @@ using Newtonsoft.Json.Linq; using System.Linq; using System.Windows; using SpeedportHybridControl.Model; +using SpeedportHybridControl.PageModel; using SpeedportHybridControl.Implementations; namespace SpeedportHybridControl.Data { @@ -402,7 +403,7 @@ namespace SpeedportHybridControl.Data { public static void initStatus() { try { - Status status = Application.Current.FindResource("Status") as Status; + StatusPageModel status = Application.Current.FindResource("StatusPageModel") as StatusPageModel; string response = SpeedportHybridAPI.getInstance().sendRequest("data/status.json"); if (response.IsNullOrEmpty()) return; @@ -450,7 +451,7 @@ namespace SpeedportHybridControl.Data { status.dsl_downstream = string.Concat(jArray.getVar("dsl_downstream"), " kBit/s"); status.dsl_upstream = string.Concat(jArray.getVar("dsl_upstream"), " kBit/s"); - List statusPhoneList = new List(); + List statusPhoneList = new List(); status.addphonenumber = null; foreach (JToken jToken in jArray) { @@ -465,7 +466,7 @@ namespace SpeedportHybridControl.Data { pstatus = "Nicht aktiv"; } - statusPhoneList.Add(new StatusPhoneList() { number = pnumber, status = pstatus }); + statusPhoneList.Add(new StatusPhoneListModel() { number = pnumber, status = pstatus }); } } diff --git a/SpeedportHybridControl/Data/SpeedportHybridAPI.cs b/SpeedportHybridControl/Data/SpeedportHybridAPI.cs index 1119882..8683163 100644 --- a/SpeedportHybridControl/Data/SpeedportHybridAPI.cs +++ b/SpeedportHybridControl/Data/SpeedportHybridAPI.cs @@ -11,7 +11,6 @@ using System.Collections.Generic; using SpeedportHybridControl.Implementations; using SpeedportHybridControl.Model; using Newtonsoft.Json; -using System.Security; using SpeedportHybridControl.PageModel; namespace SpeedportHybridControl.Data { diff --git a/SpeedportHybridControl/MainWindow.xaml.cs b/SpeedportHybridControl/MainWindow.xaml.cs index 1ff9fa9..c8eb6d1 100644 --- a/SpeedportHybridControl/MainWindow.xaml.cs +++ b/SpeedportHybridControl/MainWindow.xaml.cs @@ -1,20 +1,4 @@ -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; -using System.ComponentModel; -using SpeedportHybridControl.Implementations; -using Microsoft.Win32; +using System.Windows; namespace SpeedportHybridControl { /// diff --git a/SpeedportHybridControl/Model/StatusPhoneListModel.cs b/SpeedportHybridControl/Model/StatusPhoneListModel.cs new file mode 100644 index 0000000..c08d448 --- /dev/null +++ b/SpeedportHybridControl/Model/StatusPhoneListModel.cs @@ -0,0 +1,20 @@ +namespace SpeedportHybridControl.Model { + class StatusPhoneListModel : SuperViewModel { + private string _number; + private string _status; + + public string number { + get { return _number; } + set { SetProperty(ref _number, value); } + } + + public string status { + get { return _status; } + set { SetProperty(ref _status, value); } + } + + public StatusPhoneListModel () { + + } + } +} diff --git a/SpeedportHybridControl/Model/StatusViewModel.cs b/SpeedportHybridControl/Model/StatusViewModel.cs deleted file mode 100644 index 88eebb5..0000000 --- a/SpeedportHybridControl/Model/StatusViewModel.cs +++ /dev/null @@ -1,190 +0,0 @@ -using System.Collections.Generic; - -namespace SpeedportHybridControl.Model { - public class Status : SuperViewModel { - private string _device_name; - private string _lte_status; - private string _lte_signal; - private string _lte_image = "../assets/lte0.png"; - private string _datetime; - private string _imei; - private string _dsl_link_status; - private string _status; - private string _dsl_downstream; - private string _dsl_upstream; - private List _addphonenumber; - private string _use_dect; - private string _dect_devices; - private string _wlan_ssid; - private string _wlan_5ghz_ssid; - private string _use_wlan; - private string _use_wlan_5ghz; - private string _wlan_devices; - private string _wlan_5ghz_devices; - private string _lan1_device = "../assets/x.png"; - private string _lan2_device = "../assets/x.png"; - private string _lan3_device = "../assets/x.png"; - private string _lan4_device = "../assets/x.png"; - private string _hsfon_status; - private string _firmware_version; - private string _serial_number; - private string _uptime; - - public string device_name { - get { return _device_name; } - set { SetProperty(ref _device_name, value); } - } - - public string lte_status { - get { return _lte_status; } - set { SetProperty(ref _lte_status, value); } - } - - public string lte_signal { - get { return _lte_signal; } - set { SetProperty(ref _lte_signal, value); } - } - - public string lte_image { - get { return _lte_image; } - set { SetProperty(ref _lte_image, value); } - } - - public string datetime { - get { return _datetime; } - set { SetProperty(ref _datetime, value); } - } - - public string imei { - get { return _imei; } - set { SetProperty(ref _imei, value); } - } - - public string dsl_link_status { - get { return _dsl_link_status; } - set { SetProperty(ref _dsl_link_status, value); } - } - - public string status { - get { return _status; } - set { SetProperty(ref _status, value); } - } - - public string dsl_downstream { - get { return _dsl_downstream; } - set { SetProperty(ref _dsl_downstream, value); } - } - - public string dsl_upstream { - get { return _dsl_upstream; } - set { SetProperty(ref _dsl_upstream, value); } - } - - public List addphonenumber { - get { return _addphonenumber; } - set { SetProperty(ref _addphonenumber, value); } - } - - public string use_dect { - get { return _use_dect; } - set { SetProperty(ref _use_dect, value); } - } - - public string dect_devices { - get { return _dect_devices; } - set { SetProperty(ref _dect_devices, value); } - } - - public string wlan_ssid { - get { return _wlan_ssid; } - set { SetProperty(ref _wlan_ssid, value); } - } - - public string wlan_5ghz_ssid { - get { return _wlan_5ghz_ssid; } - set { SetProperty(ref _wlan_5ghz_ssid, value); } - } - - public string use_wlan { - get { return _use_wlan; } - set { SetProperty(ref _use_wlan, value); } - } - - public string use_wlan_5ghz { - get { return _use_wlan_5ghz; } - set { SetProperty(ref _use_wlan_5ghz, value); } - } - - public string wlan_devices { - get { return _wlan_devices; } - set { SetProperty(ref _wlan_devices, value); } - } - - public string wlan_5ghz_devices { - get { return _wlan_5ghz_devices; } - set { SetProperty(ref _wlan_5ghz_devices, value); } - } - - public string lan1_device { - get { return _lan1_device; } - set { SetProperty(ref _lan1_device, value); } - } - - public string lan2_device { - get { return _lan2_device; } - set { SetProperty(ref _lan2_device, value); } - } - - public string lan3_device { - get { return _lan3_device; } - set { SetProperty(ref _lan3_device, value); } - } - - public string lan4_device { - get { return _lan4_device; } - set { SetProperty(ref _lan4_device, value); } - } - - public string hsfon_status { - get { return _hsfon_status; } - set { SetProperty(ref _hsfon_status, value); } - } - - public string firmware_version { - get { return _firmware_version; } - set { SetProperty(ref _firmware_version, value); } - } - - public string serial_number { - get { return _serial_number; } - set { SetProperty(ref _serial_number, value); } - } - - public string uptime { - get { return _uptime; } - set { SetProperty(ref _uptime, value); } - } - - public Status() { - } - } - - public class StatusPhoneList : SuperViewModel { - private string _number; - private string _status; - - public string number { - get { return _number; } - set { SetProperty(ref _number, value); } - } - - public string status { - get { return _status; } - set { SetProperty(ref _status, value); } - } - - public StatusPhoneList () { - - } - } -} diff --git a/SpeedportHybridControl/PageModel/LoginPageModel.cs b/SpeedportHybridControl/PageModel/LoginPageModel.cs index 42b439b..94f9c1d 100644 --- a/SpeedportHybridControl/PageModel/LoginPageModel.cs +++ b/SpeedportHybridControl/PageModel/LoginPageModel.cs @@ -3,7 +3,6 @@ using SpeedportHybridControl.Implementations; using SpeedportHybridControl.Data; using System.Windows; using System.Threading; -using System.Security; using SpeedportHybridControl.Model; namespace SpeedportHybridControl.PageModel { diff --git a/SpeedportHybridControl/PageModel/StatusPageModel.cs b/SpeedportHybridControl/PageModel/StatusPageModel.cs index 002b3a1..1432a45 100644 --- a/SpeedportHybridControl/PageModel/StatusPageModel.cs +++ b/SpeedportHybridControl/PageModel/StatusPageModel.cs @@ -1,8 +1,5 @@ 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; @@ -12,6 +9,34 @@ namespace SpeedportHybridControl.PageModel { class StatusPageModel : SuperViewModel { private DelegateCommand _reloadCommand; + private string _device_name; + private string _lte_status; + private string _lte_signal; + private string _lte_image = "../assets/lte0.png"; + private string _datetime; + private string _imei; + private string _dsl_link_status; + private string _status; + private string _dsl_downstream; + private string _dsl_upstream; + private List _addphonenumber; + private string _use_dect; + private string _dect_devices; + private string _wlan_ssid; + private string _wlan_5ghz_ssid; + private string _use_wlan; + private string _use_wlan_5ghz; + private string _wlan_devices; + private string _wlan_5ghz_devices; + private string _lan1_device = "../assets/x.png"; + private string _lan2_device = "../assets/x.png"; + private string _lan3_device = "../assets/x.png"; + private string _lan4_device = "../assets/x.png"; + private string _hsfon_status; + private string _firmware_version; + private string _serial_number; + private string _uptime; + public DelegateCommand ReloadCommand { get { return _reloadCommand; } set { SetProperty(ref _reloadCommand, value); } @@ -21,6 +46,141 @@ namespace SpeedportHybridControl.PageModel { new Thread(() => { SpeedportHybrid.initStatus(); }).Start(); } + public string device_name { + get { return _device_name; } + set { SetProperty(ref _device_name, value); } + } + + public string lte_status { + get { return _lte_status; } + set { SetProperty(ref _lte_status, value); } + } + + public string lte_signal { + get { return _lte_signal; } + set { SetProperty(ref _lte_signal, value); } + } + + public string lte_image { + get { return _lte_image; } + set { SetProperty(ref _lte_image, value); } + } + + public string datetime { + get { return _datetime; } + set { SetProperty(ref _datetime, value); } + } + + public string imei { + get { return _imei; } + set { SetProperty(ref _imei, value); } + } + + public string dsl_link_status { + get { return _dsl_link_status; } + set { SetProperty(ref _dsl_link_status, value); } + } + + public string status { + get { return _status; } + set { SetProperty(ref _status, value); } + } + + public string dsl_downstream { + get { return _dsl_downstream; } + set { SetProperty(ref _dsl_downstream, value); } + } + + public string dsl_upstream { + get { return _dsl_upstream; } + set { SetProperty(ref _dsl_upstream, value); } + } + + public List addphonenumber { + get { return _addphonenumber; } + set { SetProperty(ref _addphonenumber, value); } + } + + public string use_dect { + get { return _use_dect; } + set { SetProperty(ref _use_dect, value); } + } + + public string dect_devices { + get { return _dect_devices; } + set { SetProperty(ref _dect_devices, value); } + } + + public string wlan_ssid { + get { return _wlan_ssid; } + set { SetProperty(ref _wlan_ssid, value); } + } + + public string wlan_5ghz_ssid { + get { return _wlan_5ghz_ssid; } + set { SetProperty(ref _wlan_5ghz_ssid, value); } + } + + public string use_wlan { + get { return _use_wlan; } + set { SetProperty(ref _use_wlan, value); } + } + + public string use_wlan_5ghz { + get { return _use_wlan_5ghz; } + set { SetProperty(ref _use_wlan_5ghz, value); } + } + + public string wlan_devices { + get { return _wlan_devices; } + set { SetProperty(ref _wlan_devices, value); } + } + + public string wlan_5ghz_devices { + get { return _wlan_5ghz_devices; } + set { SetProperty(ref _wlan_5ghz_devices, value); } + } + + public string lan1_device { + get { return _lan1_device; } + set { SetProperty(ref _lan1_device, value); } + } + + public string lan2_device { + get { return _lan2_device; } + set { SetProperty(ref _lan2_device, value); } + } + + public string lan3_device { + get { return _lan3_device; } + set { SetProperty(ref _lan3_device, value); } + } + + public string lan4_device { + get { return _lan4_device; } + set { SetProperty(ref _lan4_device, value); } + } + + public string hsfon_status { + get { return _hsfon_status; } + set { SetProperty(ref _hsfon_status, value); } + } + + public string firmware_version { + get { return _firmware_version; } + set { SetProperty(ref _firmware_version, value); } + } + + public string serial_number { + get { return _serial_number; } + set { SetProperty(ref _serial_number, value); } + } + + public string uptime { + get { return _uptime; } + set { SetProperty(ref _uptime, value); } + } + public StatusPageModel () { ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute)); } diff --git a/SpeedportHybridControl/SpeedportHybridControl.csproj b/SpeedportHybridControl/SpeedportHybridControl.csproj index 82a708c..f01cea1 100644 --- a/SpeedportHybridControl/SpeedportHybridControl.csproj +++ b/SpeedportHybridControl/SpeedportHybridControl.csproj @@ -66,12 +66,12 @@ + - diff --git a/SpeedportHybridControl/page/LoginPage.xaml.cs b/SpeedportHybridControl/page/LoginPage.xaml.cs index a78eedf..367586a 100644 --- a/SpeedportHybridControl/page/LoginPage.xaml.cs +++ b/SpeedportHybridControl/page/LoginPage.xaml.cs @@ -1,9 +1,4 @@ -using System.Windows; -using System.Windows.Controls; -using System.Threading; -using System; -using SpeedportHybridControl.Model; -using SpeedportHybridControl.Implementations; +using System.Windows.Controls; namespace SpeedportHybridControl.page { /// diff --git a/SpeedportHybridControl/page/StatusPage.xaml b/SpeedportHybridControl/page/StatusPage.xaml index b84476c..5b2e542 100644 --- a/SpeedportHybridControl/page/StatusPage.xaml +++ b/SpeedportHybridControl/page/StatusPage.xaml @@ -8,7 +8,7 @@ Width="Auto" Height="Auto" Title="StatusPage"> - + @@ -111,6 +111,6 @@ -