update Overview and DSL page
authorStricted <info@stricted.de>
Wed, 11 Nov 2015 15:20:48 +0000 (16:20 +0100)
committerStricted <info@stricted.de>
Wed, 11 Nov 2015 15:20:48 +0000 (16:20 +0100)
13 files changed:
SpeedportHybridControl/App.xaml
SpeedportHybridControl/Data/SpeedportHybrid.cs
SpeedportHybridControl/Model/Connection.cs [new file with mode: 0644]
SpeedportHybridControl/Model/DSLViewModel.cs [deleted file]
SpeedportHybridControl/Model/Line.cs [new file with mode: 0644]
SpeedportHybridControl/Model/OverviewModel.cs [deleted file]
SpeedportHybridControl/PageModel/DslPageModel.cs [new file with mode: 0644]
SpeedportHybridControl/PageModel/MainWindowModel.cs
SpeedportHybridControl/PageModel/OverviewPageModel.cs [new file with mode: 0644]
SpeedportHybridControl/SpeedportHybridControl.csproj
SpeedportHybridControl/page/DslPage.xaml
SpeedportHybridControl/page/OverviewPage.xaml
SpeedportHybridControl/page/OverviewPage.xaml.cs

index dbc3ae393b5c27293066738cc0a3b0fcc274bd69..38ec605bc6da3b6c29e87e69c918b6c610cc6986 100644 (file)
             <pagemodel:MainWindowModel x:Key="MainWindowModel"></pagemodel:MainWindowModel>
             <pagemodel:LoginPageModel x:Key="LoginPageModel"></pagemodel:LoginPageModel>
             <pagemodel:StatusPageModel x:Key="StatusPageModel"></pagemodel:StatusPageModel>
+            <pagemodel:OverviewPageModel x:Key="OverviewPageModel"></pagemodel:OverviewPageModel>
+            <pagemodel:DslPageModel x:Key="DslPageModel"></pagemodel:DslPageModel>
             
             <model:LTE x:Key="LTE"></model:LTE>
             <model:LTE x:Key="LTE2"></model:LTE>
-            <model:DSLViewModel x:Key="DSL"></model:DSLViewModel>
             <model:SyslogData x:Key="SyslogData"></model:SyslogData>
             <model:TR181 x:Key="TR181"></model:TR181>
             <model:PhoneCallData x:Key="PhoneCallData"></model:PhoneCallData>
             <model:DeviceData x:Key="DeviceData"></model:DeviceData>
-            <model:OverviewModel x:Key="OverviewModel"></model:OverviewModel>
         </ResourceDictionary>
     </Application.Resources>
 </Application>
index 0b964cfed96f5937e4c4b1b8451ffd31c051ca07..079ec1837fb048f3cb67d481f4e2003e7552e092 100644 (file)
@@ -17,7 +17,7 @@ namespace SpeedportHybridControl.Data {
                                if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false))
                                        return;
 
-                               OverviewModel overview = Application.Current.FindResource("OverviewModel") as OverviewModel;
+                               OverviewPageModel overview = Application.Current.FindResource("OverviewPageModel") as OverviewPageModel;
 
                                string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/Overview.json");
                                if (response.IsNullOrEmpty())
@@ -365,14 +365,14 @@ namespace SpeedportHybridControl.Data {
                        if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false))
                                return;
 
-                       DSLViewModel dsl = Application.Current.FindResource("DSL") as DSLViewModel;
+                       DslPageModel dsl = Application.Current.FindResource("DslPageModel") as DslPageModel;
 
                        string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/dsl.json");
                        if (response.IsNullOrEmpty())
                                return;
                        
                        try {
-                               DSLViewModel obj = JsonConvert.DeserializeObject<DSLViewModel>(response);
+                               DslPageModel obj = JsonConvert.DeserializeObject<DslPageModel>(response);
 
                                double difference = Math.Ceiling((DateTime.Now - SpeedportHybridAPI.getInstance().getLastReboot()).TotalSeconds) / 60;
 
diff --git a/SpeedportHybridControl/Model/Connection.cs b/SpeedportHybridControl/Model/Connection.cs
new file mode 100644 (file)
index 0000000..1c2af63
--- /dev/null
@@ -0,0 +1,40 @@
+namespace SpeedportHybridControl.Model {
+       class Connection : SuperViewModel {
+               private string _dsl_operaing_mode;
+               private string _path_mode;
+               private string _state;
+               private string _training_results;
+               private string _mode_lo;
+               private string _vpi_vpc;
+
+               public string dsl_operaing_mode {
+                       get { return _dsl_operaing_mode; }
+                       set { SetProperty(ref _dsl_operaing_mode, value); }
+               }
+
+               public string path_mode {
+                       get { return _path_mode; }
+                       set { SetProperty(ref _path_mode, value); }
+               }
+
+               public string state {
+                       get { return _state; }
+                       set { SetProperty(ref _state, value); }
+               }
+
+               public string training_results {
+                       get { return _training_results; }
+                       set { SetProperty(ref _training_results, value); }
+               }
+
+               public string mode_lo {
+                       get { return _mode_lo; }
+                       set { SetProperty(ref _mode_lo, value); }
+               }
+
+               public string vpi_vci {
+                       get { return _vpi_vpc; }
+                       set { SetProperty(ref _vpi_vpc, value); }
+               }
+       }
+}
diff --git a/SpeedportHybridControl/Model/DSLViewModel.cs b/SpeedportHybridControl/Model/DSLViewModel.cs
deleted file mode 100644 (file)
index b378954..0000000
+++ /dev/null
@@ -1,264 +0,0 @@
-namespace SpeedportHybridControl.Model {
-       class DSLViewModel : SuperViewModel {
-               private Connection _Connection;
-               private Line _Line;
-               private string _datetime;
-
-               private string _lastCRC;
-               private string _lastHEC;
-               private string _lastFEC;
-
-               public Connection Connection {
-                       get { return _Connection; }
-                       set { SetProperty(ref _Connection, value); }
-               }
-               
-               public Line Line {
-                       get { return _Line; }
-                       set { SetProperty(ref _Line, value); }
-               }
-
-               public string datetime {
-                       get { return _datetime; }
-                       set { SetProperty(ref _datetime, value); }
-               }
-
-               public string lastCRC {
-                       get { return _lastCRC; }
-                       set { SetProperty(ref _lastCRC, value); }
-               }
-
-               public string lastFEC {
-                       get { return _lastFEC; }
-                       set { SetProperty(ref _lastFEC, value); }
-               }
-
-               public string lastHEC {
-                       get { return _lastHEC; }
-                       set { SetProperty(ref _lastHEC, value); }
-               }
-}
-
-       class Connection : SuperViewModel {
-               private string _dsl_operaing_mode;
-               private string _path_mode;
-               private string _state;
-               private string _training_results;
-               private string _mode_lo;
-               private string _vpi_vpc;
-
-               public string dsl_operaing_mode {
-                       get { return _dsl_operaing_mode; }
-                       set { SetProperty(ref _dsl_operaing_mode, value); }
-               }
-
-               public string path_mode {
-                       get { return _path_mode; }
-                       set { SetProperty(ref _path_mode, value); }
-               }
-
-               public string state {
-                       get { return _state; }
-                       set { SetProperty(ref _state, value); }
-               }
-
-               public string training_results {
-                       get { return _training_results; }
-                       set { SetProperty(ref _training_results, value); }
-               }
-
-               public string mode_lo {
-                       get { return _mode_lo; }
-                       set { SetProperty(ref _mode_lo, value); }
-               }
-
-               public string vpi_vci {
-                       get { return _vpi_vpc; }
-                       set { SetProperty(ref _vpi_vpc, value); }
-               }
-       }
-
-       class Line : SuperViewModel {
-               private string _uactual;
-               private string _dactual;
-               private string _uattainable;
-               private string _dattainable;
-               private string _uSNR;
-               private string _dSNR;
-               private string _uSignal;
-               private string _dSignal;
-               private string _uLine;
-               private string _dLine;
-               private string _uBIN;
-               private string _dBIN;
-               private string _uFEC_size;
-               private string _dFEC_size;
-               private string _uCodeword;
-               private string _dCodeword;
-               private string _uInterleave;
-               private string _dInterleave;
-               private int _uCRC;
-               private int _dCRC;
-               private int _uHEC;
-               private int _dHEC;
-               private int _uFEC;
-               private int _dFEC;
-
-               private double _uCRCsec;
-               private double _dCRCsec;
-               private double _uHECsec;
-               private double _dHECsec;
-               private double _uFECsec;
-               private double _dFECsec;
-
-               public string uactual {
-                       get { return _uactual; }
-                       set { SetProperty(ref _uactual, value); }
-               }
-
-               public string dactual {
-                       get { return _dactual; }
-                       set { SetProperty(ref _dactual, value); }
-               }
-
-               public string uattainable {
-                       get { return _uattainable; }
-                       set { SetProperty(ref _uattainable, value); }
-               }
-
-               public string dattainable {
-                       get { return _dattainable; }
-                       set { SetProperty(ref _dattainable, value); }
-               }
-
-               public string uSNR {
-                       get { return _uSNR; }
-                       set { SetProperty(ref _uSNR, value); }
-               }
-
-               public string dSNR {
-                       get { return _dSNR; }
-                       set { SetProperty(ref _dSNR, value); }
-               }
-
-               public string uSignal {
-                       get { return _uSignal; }
-                       set { SetProperty(ref _uSignal, value); }
-               }
-
-               public string dSignal {
-                       get { return _dSignal; }
-                       set { SetProperty(ref _dSignal, value); }
-               }
-
-               public string uLine {
-                       get { return _uLine; }
-                       set { SetProperty(ref _uLine, value); }
-               }
-
-               public string dLine {
-                       get { return _dLine; }
-                       set { SetProperty(ref _dLine, value); }
-               }
-
-               public string uBIN {
-                       get { return _uBIN; }
-                       set { SetProperty(ref _uBIN, value); }
-               }
-
-               public string dBIN {
-                       get { return _dBIN; }
-                       set { SetProperty(ref _dBIN, value); }
-               }
-
-               public string uFEC_size {
-                       get { return _uFEC_size; }
-                       set { SetProperty(ref _uFEC_size, value); }
-               }
-
-               public string dFEC_size {
-                       get { return _dFEC_size; }
-                       set { SetProperty(ref _dFEC_size, value); }
-               }
-
-               public string uCodeword {
-                       get { return _uCodeword; }
-                       set { SetProperty(ref _uCodeword, value); }
-               }
-
-               public string dCodeword {
-                       get { return _dCodeword; }
-                       set { SetProperty(ref _dCodeword, value); }
-               }
-
-               public string uInterleave {
-                       get { return _uInterleave; }
-                       set { SetProperty(ref _uInterleave, value); }
-               }
-
-               public string dInterleave {
-                       get { return _dInterleave; }
-                       set { SetProperty(ref _dInterleave, value); }
-               }
-
-               public int uCRC {
-                       get { return _uCRC; }
-                       set { SetProperty(ref _uCRC, value); }
-               }
-
-               public int dCRC {
-                       get { return _dCRC; }
-                       set { SetProperty(ref _dCRC, value); }
-               }
-
-               public int uHEC {
-                       get { return _uHEC; }
-                       set { SetProperty(ref _uHEC, value); }
-               }
-
-               public int dHEC {
-                       get { return _dHEC; }
-                       set { SetProperty(ref _dHEC, value); }
-               }
-
-               public int uFEC {
-                       get { return _uFEC; }
-                       set { SetProperty(ref _uFEC, value); }
-               }
-
-               public int dFEC {
-                       get { return _dFEC; }
-                       set { SetProperty(ref _dFEC, value); }
-               }
-
-               public double uCRCsec {
-                       get { return _uCRCsec; }
-                       set { SetProperty(ref _uCRCsec, value); }
-               }
-
-               public double dCRCsec {
-                       get { return _dCRCsec; }
-                       set { SetProperty(ref _dCRCsec, value); }
-               }
-
-               public double uHECsec {
-                       get { return _uHECsec; }
-                       set { SetProperty(ref _uHECsec, value); }
-               }
-
-               public double dHECsec {
-                       get { return _dHECsec; }
-                       set { SetProperty(ref _dHECsec, value); }
-               }
-
-               public double uFECsec {
-                       get { return _uFECsec; }
-                       set { SetProperty(ref _uFECsec, value); }
-               }
-
-               public double dFECsec {
-                       get { return _dFECsec; }
-                       set { SetProperty(ref _dFECsec, value); }
-               }
-       }
-}
diff --git a/SpeedportHybridControl/Model/Line.cs b/SpeedportHybridControl/Model/Line.cs
new file mode 100644 (file)
index 0000000..26e0393
--- /dev/null
@@ -0,0 +1,185 @@
+namespace SpeedportHybridControl.Model {
+       class Line : SuperViewModel {
+               private string _uactual;
+               private string _dactual;
+               private string _uattainable;
+               private string _dattainable;
+               private string _uSNR;
+               private string _dSNR;
+               private string _uSignal;
+               private string _dSignal;
+               private string _uLine;
+               private string _dLine;
+               private string _uBIN;
+               private string _dBIN;
+               private string _uFEC_size;
+               private string _dFEC_size;
+               private string _uCodeword;
+               private string _dCodeword;
+               private string _uInterleave;
+               private string _dInterleave;
+               private int _uCRC;
+               private int _dCRC;
+               private int _uHEC;
+               private int _dHEC;
+               private int _uFEC;
+               private int _dFEC;
+
+               private double _uCRCsec;
+               private double _dCRCsec;
+               private double _uHECsec;
+               private double _dHECsec;
+               private double _uFECsec;
+               private double _dFECsec;
+
+               public string uactual {
+                       get { return _uactual; }
+                       set { SetProperty(ref _uactual, value); }
+               }
+
+               public string dactual {
+                       get { return _dactual; }
+                       set { SetProperty(ref _dactual, value); }
+               }
+
+               public string uattainable {
+                       get { return _uattainable; }
+                       set { SetProperty(ref _uattainable, value); }
+               }
+
+               public string dattainable {
+                       get { return _dattainable; }
+                       set { SetProperty(ref _dattainable, value); }
+               }
+
+               public string uSNR {
+                       get { return _uSNR; }
+                       set { SetProperty(ref _uSNR, value); }
+               }
+
+               public string dSNR {
+                       get { return _dSNR; }
+                       set { SetProperty(ref _dSNR, value); }
+               }
+
+               public string uSignal {
+                       get { return _uSignal; }
+                       set { SetProperty(ref _uSignal, value); }
+               }
+
+               public string dSignal {
+                       get { return _dSignal; }
+                       set { SetProperty(ref _dSignal, value); }
+               }
+
+               public string uLine {
+                       get { return _uLine; }
+                       set { SetProperty(ref _uLine, value); }
+               }
+
+               public string dLine {
+                       get { return _dLine; }
+                       set { SetProperty(ref _dLine, value); }
+               }
+
+               public string uBIN {
+                       get { return _uBIN; }
+                       set { SetProperty(ref _uBIN, value); }
+               }
+
+               public string dBIN {
+                       get { return _dBIN; }
+                       set { SetProperty(ref _dBIN, value); }
+               }
+
+               public string uFEC_size {
+                       get { return _uFEC_size; }
+                       set { SetProperty(ref _uFEC_size, value); }
+               }
+
+               public string dFEC_size {
+                       get { return _dFEC_size; }
+                       set { SetProperty(ref _dFEC_size, value); }
+               }
+
+               public string uCodeword {
+                       get { return _uCodeword; }
+                       set { SetProperty(ref _uCodeword, value); }
+               }
+
+               public string dCodeword {
+                       get { return _dCodeword; }
+                       set { SetProperty(ref _dCodeword, value); }
+               }
+
+               public string uInterleave {
+                       get { return _uInterleave; }
+                       set { SetProperty(ref _uInterleave, value); }
+               }
+
+               public string dInterleave {
+                       get { return _dInterleave; }
+                       set { SetProperty(ref _dInterleave, value); }
+               }
+
+               public int uCRC {
+                       get { return _uCRC; }
+                       set { SetProperty(ref _uCRC, value); }
+               }
+
+               public int dCRC {
+                       get { return _dCRC; }
+                       set { SetProperty(ref _dCRC, value); }
+               }
+
+               public int uHEC {
+                       get { return _uHEC; }
+                       set { SetProperty(ref _uHEC, value); }
+               }
+
+               public int dHEC {
+                       get { return _dHEC; }
+                       set { SetProperty(ref _dHEC, value); }
+               }
+
+               public int uFEC {
+                       get { return _uFEC; }
+                       set { SetProperty(ref _uFEC, value); }
+               }
+
+               public int dFEC {
+                       get { return _dFEC; }
+                       set { SetProperty(ref _dFEC, value); }
+               }
+
+               public double uCRCsec {
+                       get { return _uCRCsec; }
+                       set { SetProperty(ref _uCRCsec, value); }
+               }
+
+               public double dCRCsec {
+                       get { return _dCRCsec; }
+                       set { SetProperty(ref _dCRCsec, value); }
+               }
+
+               public double uHECsec {
+                       get { return _uHECsec; }
+                       set { SetProperty(ref _uHECsec, value); }
+               }
+
+               public double dHECsec {
+                       get { return _dHECsec; }
+                       set { SetProperty(ref _dHECsec, value); }
+               }
+
+               public double uFECsec {
+                       get { return _uFECsec; }
+                       set { SetProperty(ref _uFECsec, value); }
+               }
+
+               public double dFECsec {
+                       get { return _dFECsec; }
+                       set { SetProperty(ref _dFECsec, value); }
+               }
+       }
+}
diff --git a/SpeedportHybridControl/Model/OverviewModel.cs b/SpeedportHybridControl/Model/OverviewModel.cs
deleted file mode 100644 (file)
index d5a9c85..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-namespace SpeedportHybridControl.Model {
-       public class OverviewModel : SuperViewModel {
-               private string _onlinestatus;
-               private string _dsl_link_status;
-               private string _lte_image = "../assets/lte0.png";
-               private string _number_status;
-               private string _use_dect;
-               private string _dect_devices;
-               private string _devices;
-               private string _use_wlan;
-               private string _use_wlan_5ghz;
-               private string _wlan_enc;
-               private string _wlan_power;
-               private string _external_devices; 
-               private string _nas_sync_active;
-               private string _nas_backup_active;
-               private string _mc_state;
-               private string _days_online;
-               private string _datetime;
-
-               public string onlinestatus {
-                       get { return _onlinestatus; }
-                       set { SetProperty(ref _onlinestatus, value); }
-               }
-
-               public string dsl_link_status {
-                       get { return _dsl_link_status; }
-                       set { SetProperty(ref _dsl_link_status, value); }
-               }
-
-               public string lte_image {
-                       get { return _lte_image; }
-                       set { SetProperty(ref _lte_image, value); }
-               }
-
-               public string number_status {
-                       get { return _number_status; }
-                       set { SetProperty(ref _number_status, 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 devices {
-                       get { return _devices; }
-                       set { SetProperty(ref _devices, 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_enc {
-                       get { return _wlan_enc; }
-                       set { SetProperty(ref _wlan_enc, value); }
-               }
-
-               public string wlan_power {
-                       get { return _wlan_power; }
-                       set { SetProperty(ref _wlan_power, value); }
-               }
-
-               public string external_devices {
-                       get { return _external_devices; }
-                       set { SetProperty(ref _external_devices, value); }
-               }
-
-               public string nas_sync_active {
-                       get { return _nas_sync_active; }
-                       set { SetProperty(ref _nas_sync_active, value); }
-               }
-
-               public string nas_backup_active {
-                       get { return _nas_backup_active; }
-                       set { SetProperty(ref _nas_backup_active, value); }
-               }
-
-               public string mc_state {
-                       get { return _mc_state; }
-                       set { SetProperty(ref _mc_state, value); }
-               }
-
-               public string days_online {
-                       get { return _days_online; }
-                       set { SetProperty(ref _days_online, value); }
-               }
-
-               public string datetime {
-                       get { return _datetime; }
-                       set { SetProperty(ref _datetime, value); }
-               }
-
-               public OverviewModel () {
-
-               }
-       }
-}
diff --git a/SpeedportHybridControl/PageModel/DslPageModel.cs b/SpeedportHybridControl/PageModel/DslPageModel.cs
new file mode 100644 (file)
index 0000000..edac250
--- /dev/null
@@ -0,0 +1,154 @@
+using SpeedportHybridControl.Data;
+using SpeedportHybridControl.Implementations;
+using SpeedportHybridControl.Model;
+using System;
+using System.IO;
+using System.Threading;
+using System.Timers;
+using System.Windows;
+
+namespace SpeedportHybridControl.PageModel {
+       class DslPageModel : SuperViewModel {
+               private DelegateCommand _reloadCommand;
+               private DelegateCommand _autoReloadCommand;
+               private bool _autoReload;
+               private bool _log;
+               private bool _logEnabled;
+               private System.Timers.Timer _timer;
+
+               private Connection _Connection;
+               private Line _Line;
+               private string _datetime;
+
+               private string _lastCRC;
+               private string _lastHEC;
+               private string _lastFEC;
+
+
+               public Connection Connection {
+                       get { return _Connection; }
+                       set { SetProperty(ref _Connection, value); }
+               }
+
+               public Line Line {
+                       get { return _Line; }
+                       set { SetProperty(ref _Line, value); }
+               }
+
+               public string datetime {
+                       get { return _datetime; }
+                       set { SetProperty(ref _datetime, value); }
+               }
+
+               public string lastCRC {
+                       get { return _lastCRC; }
+                       set { SetProperty(ref _lastCRC, value); }
+               }
+
+               public string lastFEC {
+                       get { return _lastFEC; }
+                       set { SetProperty(ref _lastFEC, value); }
+               }
+
+               public string lastHEC {
+                       get { return _lastHEC; }
+                       set { SetProperty(ref _lastHEC, value); }
+               }
+
+
+               public DelegateCommand ReloadCommand {
+                       get { return _reloadCommand; }
+                       set { SetProperty(ref _reloadCommand, value); }
+               }
+
+               public DelegateCommand AutoReloadCommand {
+                       get { return _autoReloadCommand; }
+                       set { SetProperty(ref _autoReloadCommand, value); }
+               }
+               public bool AutoReload {
+                       get { return _autoReload; }
+                       set { SetProperty(ref _autoReload, value); }
+               }
+
+               public bool Log {
+                       get { return _log; }
+                       set { SetProperty(ref _log, value); }
+               }
+
+               public bool LogEnabled {
+                       get { return _logEnabled; }
+                       set { SetProperty(ref _logEnabled, value); }
+               }
+
+               private void OnReloadCommandExecute () {
+                       new Thread(() => { SpeedportHybrid.initDSL(); }).Start();
+               }
+
+               private void OnAutoReloadCommandExecute () {
+                       if (AutoReload.Equals(true)) {
+                               StartTimer();
+                               LogEnabled = true;
+                       }
+                       else {
+                               StopTimer();
+                       }
+               }
+
+               public void StopTimer () {
+                       if (Object.Equals(_timer, null).Equals(false)) {
+                               _timer.Stop();
+                       }
+
+                       if (AutoReload.Equals(true)) {
+                               AutoReload = false;
+                       }
+
+                       if (Log.Equals(true)) {
+                               Log = false;
+                       }
+
+                       LogEnabled = false;
+               }
+
+               private void StartTimer () {
+                       _timer = new System.Timers.Timer {
+                               Interval = 1000, // every second
+                       };
+
+                       _timer.Elapsed += timer_Elapsed;
+                       _timer.Start();
+               }
+
+               private void timer_Elapsed (object sender, ElapsedEventArgs e) {
+                       SpeedportHybrid.initDSL();
+
+                       Application.Current.Dispatcher.BeginInvoke(new Action(() => {
+                               if (Log.Equals(true)) {
+                                       //log
+                                       string prepare = "State: {0}, Actual Data Rate: up: {1} down: {2}, Attainable Data Rate: up: {3} down: {4}, SNR Margin up: {5} down: {6}, CRC error count: up: {7} down: {8}, HEC error count: up: {9} down: {10}, FEC error count: up: {11} down: {12}";
+                                       log(string.Format(prepare, Connection.state, Line.uactual, Line.dactual, Line.uattainable, Line.dattainable, Line.uSNR, Line.dSNR, Line.uCRC, Line.dCRC, Line.uHEC, Line.dHEC, Line.uFEC, Line.dFEC));
+                                       log(string.Format("CRC/min up: {0} down: {1}, HEC/min up: {2} down: {3}, FEC/min up: {4} down: {5}", Line.uCRCsec, Line.dCRCsec, Line.uHECsec, Line.dHECsec, Line.uFECsec, Line.dFECsec));
+                               }
+                       }));
+               }
+
+               private void log (string value) {
+                       DateTime time = DateTime.Now;
+
+                       if (Directory.Exists("log/").Equals(false))
+                               Directory.CreateDirectory("log/");
+
+                       if (Directory.Exists("log/dsl/").Equals(false))
+                               Directory.CreateDirectory("log/dsl/");
+
+                       StreamWriter file = new StreamWriter(string.Concat("log/dsl/", time.ToString("dd.MM.yyyy"), ".txt"), true);
+                       file.WriteLine(string.Concat("[", time.ToString("dd.MM.yyyy HH:mm:ss"), "]: ", value));
+                       file.Close();
+               }
+
+               public DslPageModel () {
+                       ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
+                       AutoReloadCommand = new DelegateCommand(new Action(OnAutoReloadCommandExecute));
+               }
+       }
+}
index 9b35b5fa571385162ba7da5263c83c5f45dd8290..7b02efdae1f917d64b3ba2974c870356713ef612 100644 (file)
@@ -263,12 +263,14 @@ namespace SpeedportHybridControl.PageModel {
 
                private void changePage (string page) {
                        if (object.Equals(FrameSource, null).Equals(false)) {
-                               if (FrameSource.Content.GetType().Equals(typeof(LteInfoPage))) {
+                               Console.WriteLine("HERE!!!");
+                               if (FrameSource.GetType().Equals(typeof(LteInfoPage))) {
                                        // TODO: lteInfoPage.StopTimer();
                                }
 
-                               if (FrameSource.Content.GetType().Equals(typeof(DslPage))) {
-                                       // TODO: dslPage.StopTimer();
+                if (FrameSource.GetType().Equals(typeof(DslPage))) {
+                                       DslPageModel dsl = Application.Current.FindResource("DslPageModel") as DslPageModel;
+                                       dsl.StopTimer();
                                }
                        }
 
diff --git a/SpeedportHybridControl/PageModel/OverviewPageModel.cs b/SpeedportHybridControl/PageModel/OverviewPageModel.cs
new file mode 100644 (file)
index 0000000..10f2984
--- /dev/null
@@ -0,0 +1,127 @@
+using SpeedportHybridControl.Data;
+using SpeedportHybridControl.Implementations;
+using SpeedportHybridControl.Model;
+using System;
+using System.Threading;
+
+namespace SpeedportHybridControl.PageModel {
+       class OverviewPageModel : SuperViewModel {
+               private DelegateCommand _reloadCommand;
+
+               private string _onlinestatus;
+               private string _dsl_link_status;
+               private string _lte_image = "../assets/lte0.png";
+               private string _number_status;
+               private string _use_dect;
+               private string _dect_devices;
+               private string _devices;
+               private string _use_wlan;
+               private string _use_wlan_5ghz;
+               private string _wlan_enc;
+               private string _wlan_power;
+               private string _external_devices;
+               private string _nas_sync_active;
+               private string _nas_backup_active;
+               private string _mc_state;
+               private string _days_online;
+               private string _datetime;
+
+               public DelegateCommand ReloadCommand {
+                       get { return _reloadCommand; }
+                       set { SetProperty(ref _reloadCommand, value); }
+               }
+
+               private void OnReloadCommandExecute () {
+                       new Thread(() => { SpeedportHybrid.initOverview(); }).Start();
+               }
+
+               public string onlinestatus {
+                       get { return _onlinestatus; }
+                       set { SetProperty(ref _onlinestatus, value); }
+               }
+
+               public string dsl_link_status {
+                       get { return _dsl_link_status; }
+                       set { SetProperty(ref _dsl_link_status, value); }
+               }
+
+               public string lte_image {
+                       get { return _lte_image; }
+                       set { SetProperty(ref _lte_image, value); }
+               }
+
+               public string number_status {
+                       get { return _number_status; }
+                       set { SetProperty(ref _number_status, 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 devices {
+                       get { return _devices; }
+                       set { SetProperty(ref _devices, 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_enc {
+                       get { return _wlan_enc; }
+                       set { SetProperty(ref _wlan_enc, value); }
+               }
+
+               public string wlan_power {
+                       get { return _wlan_power; }
+                       set { SetProperty(ref _wlan_power, value); }
+               }
+
+               public string external_devices {
+                       get { return _external_devices; }
+                       set { SetProperty(ref _external_devices, value); }
+               }
+
+               public string nas_sync_active {
+                       get { return _nas_sync_active; }
+                       set { SetProperty(ref _nas_sync_active, value); }
+               }
+
+               public string nas_backup_active {
+                       get { return _nas_backup_active; }
+                       set { SetProperty(ref _nas_backup_active, value); }
+               }
+
+               public string mc_state {
+                       get { return _mc_state; }
+                       set { SetProperty(ref _mc_state, value); }
+               }
+
+               public string days_online {
+                       get { return _days_online; }
+                       set { SetProperty(ref _days_online, value); }
+               }
+
+               public string datetime {
+                       get { return _datetime; }
+                       set { SetProperty(ref _datetime, value); }
+               }
+
+               public OverviewPageModel () {
+                       ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
+               }
+       }
+}
index f01cea1a7cc858f6d5e44c12352b16be324ec4e7..0f77678d4ae5e8d68fbda028224814639923a06a 100644 (file)
     </ApplicationDefinition>
     <Compile Include="Data\SpeedportHybrid.cs" />
     <Compile Include="Model\bonding_client.cs" />
+    <Compile Include="Model\Connection.cs" />
     <Compile Include="Model\DeviceViewModel.cs" />
-    <Compile Include="Model\DSLViewModel.cs" />
+    <Compile Include="Model\Line.cs" />
     <Compile Include="Model\StatusPhoneListModel.cs" />
+    <Compile Include="PageModel\DslPageModel.cs" />
     <Compile Include="PageModel\LoginPageModel.cs" />
     <Compile Include="Model\LTEViewModel.cs" />
     <Compile Include="PageModel\MainWindowModel.cs" />
-    <Compile Include="Model\OverviewModel.cs" />
     <Compile Include="Model\PhoneCallViewModel.cs" />
     <Compile Include="Model\SuperViewModel.cs" />
     <Compile Include="Data\SpeedportHybridAPI.cs" />
   <ItemGroup>
     <Compile Include="Model\SyslogViewModel.cs" />
     <Compile Include="Model\TR181ViewModel.cs" />
+    <Compile Include="PageModel\OverviewPageModel.cs" />
     <Compile Include="PageModel\StatusPageModel.cs" />
     <Compile Include="page\AboutPage.xaml.cs">
       <DependentUpon>AboutPage.xaml</DependentUpon>
index 5f5dcc332fcfc58fa1c7d7531fc98614e01fe28a..460c09a33323f744b5b9fc7603fe7054ef08eaa8 100644 (file)
@@ -1,15 +1,15 @@
 <Page x:Class="SpeedportHybridControl.page.DslPage"
       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
-      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
       xmlns:local="clr-namespace:SpeedportHybridControl.page"
       xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0"
       mc:Ignorable="d"
       Width="Auto" Height="Auto"
       Title="DslPage">
 
-    <Grid DataContext="{StaticResource DSL}">
+    <Grid DataContext="{StaticResource DslPageModel}">
         <GroupBox Header="Connection Status" HorizontalAlignment="Left" VerticalAlignment="Top" Width="213">
             <Grid>
                 <StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Width="120">
             </Grid>
         </GroupBox>
 
-        <ToggleButton x:Name="autoreload" Content="Automatisch aktualisieren" HorizontalAlignment="Left" VerticalAlignment="Bottom" Click="button_click"/>
-        <ToggleButton x:Name="btnLog" Content="Log" HorizontalAlignment="Left" VerticalAlignment="Bottom" Click="button_click" Margin="145,0,0,0" IsEnabled="False"/>
+        <ToggleButton Command="{Binding Path=AutoReloadCommand}" x:Name="autoreload" Content="Automatisch aktualisieren" HorizontalAlignment="Left" IsChecked="{Binding Path=AutoReload}" VerticalAlignment="Bottom"/>
+        <ToggleButton x:Name="btnLog" Content="Log" HorizontalAlignment="Left" VerticalAlignment="Bottom" IsChecked="{Binding Path=Log}" Margin="145,0,0,0" IsEnabled="{Binding Path=LogEnabled}"/>
 
-        <Button x:Name="reload" Content="Aktualisieren" Margin="218,0,218,0" VerticalAlignment="Bottom" Click="button_click" />
+        <Button Command="{Binding Path=ReloadCommand}" x:Name="reload" Content="Aktualisieren" Margin="218,0,218,0" VerticalAlignment="Bottom" />
         <TextBlock Text="{Binding datetime}" Margin="0,0,10,0" HorizontalAlignment="Right" VerticalAlignment="Bottom" />
     </Grid>
 </Page>
index 9aa818fabf26c5025d8689334fd9f64680d048bd..9e2466b99264fed47f88751ff515d2366d09cd3e 100644 (file)
@@ -1,14 +1,14 @@
 <Page x:Class="SpeedportHybridControl.page.OverviewPage"
       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
-      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
       xmlns:local="clr-namespace:SpeedportHybridControl"
-      mc:Ignorable="d" 
+      mc:Ignorable="d"
       Width="Auto" Height="Auto"
       Title="OverviewPage">
 
-    <Grid DataContext="{StaticResource OverviewModel}">
+    <Grid DataContext="{StaticResource OverviewPageModel}">
         <GroupBox Header="Internet" HorizontalAlignment="Left" VerticalAlignment="Top"  Width="174">
             <Grid>
                 <StackPanel>
@@ -66,6 +66,6 @@
         </GroupBox>
         
         <TextBlock Text="{Binding datetime}" Margin="0,0,10,0" HorizontalAlignment="Right" VerticalAlignment="Bottom" />
-        <Button x:Name="reload" Content="Aktualisieren" Margin="218,0,218,0" VerticalAlignment="Bottom" Click="button_click" />
+        <Button Command="{Binding Path=ReloadCommand}" x:Name="reload" Content="Aktualisieren" Margin="218,0,218,0" VerticalAlignment="Bottom" />
     </Grid>
 </Page>
index 44d7b8afb43cd5e55b42a1dd312f1ec1cefa497d..d93ecc8358cd545c8a2da6cb7c6b4879ccc685b6 100644 (file)
@@ -1,6 +1,4 @@
-using SpeedportHybridControl.Model;
-using System.Windows;
-using System.Windows.Controls;
+using System.Windows.Controls;
 
 namespace SpeedportHybridControl.page {
        /// <summary>
@@ -10,13 +8,5 @@ namespace SpeedportHybridControl.page {
                public OverviewPage() {
                        InitializeComponent();
                }
-
-               private void button_click (object sender, RoutedEventArgs e) {
-                       /*
-                       if (sender.Equals(reload)) {
-                               util.init("Overview");
-                       }
-                       */
-               }
        }
 }