From: Stricted Date: Wed, 11 Nov 2015 21:37:43 +0000 (+0100) Subject: update TR181 and Phone page X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=413a0c58dd29b7d8831e09ce705639d64a57900d;p=GitHub%2FStricted%2FSpeedportHybridControl.git update TR181 and Phone page --- diff --git a/SpeedportHybridControl/App.xaml b/SpeedportHybridControl/App.xaml index 5618ea5..b4a7629 100644 --- a/SpeedportHybridControl/App.xaml +++ b/SpeedportHybridControl/App.xaml @@ -15,9 +15,9 @@ + + - - diff --git a/SpeedportHybridControl/Data/SpeedportHybrid.cs b/SpeedportHybridControl/Data/SpeedportHybrid.cs index 6710f6b..27ac08e 100644 --- a/SpeedportHybridControl/Data/SpeedportHybrid.cs +++ b/SpeedportHybridControl/Data/SpeedportHybrid.cs @@ -253,13 +253,13 @@ namespace SpeedportHybridControl.Data { if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false)) return; - TR181 tr181 = Application.Current.FindResource("TR181") as TR181; + TR181PageModel tr181 = Application.Current.FindResource("TR181PageModel") as TR181PageModel; string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/bonding_tr181.json"); if (response.IsNullOrEmpty()) return; - TR181 obj = JsonConvert.DeserializeObject(response); + TR181PageModel obj = JsonConvert.DeserializeObject(response); response = null; tr181.enable1 = obj.enable1; @@ -274,7 +274,7 @@ namespace SpeedportHybridControl.Data { response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/bonding_tunnel.json"); - obj = JsonConvert.DeserializeObject(response); + obj = JsonConvert.DeserializeObject(response); response = null; tr181.lte_tunnel = obj.lte_tunnel; @@ -451,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) { @@ -466,7 +466,7 @@ namespace SpeedportHybridControl.Data { pstatus = "Nicht aktiv"; } - statusPhoneList.Add(new StatusPhoneListModel() { number = pnumber, status = pstatus }); + statusPhoneList.Add(new StatusPhoneList() { number = pnumber, status = pstatus }); } } @@ -656,7 +656,7 @@ namespace SpeedportHybridControl.Data { if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false)) return; - PhoneCallData phone = Application.Current.FindResource("PhoneCallData") as PhoneCallData; + PhonePageModel phone = Application.Current.FindResource("PhonePageModel") as PhonePageModel; List missedCalls = new List(); List takenCalls = new List(); diff --git a/SpeedportHybridControl/Data/SpeedportHybridAPI.cs b/SpeedportHybridControl/Data/SpeedportHybridAPI.cs index 23bacc8..3535f04 100644 --- a/SpeedportHybridControl/Data/SpeedportHybridAPI.cs +++ b/SpeedportHybridControl/Data/SpeedportHybridAPI.cs @@ -569,7 +569,7 @@ namespace SpeedportHybridControl.Data { if (response.IsNullOrEmpty()) return; try { - TR181 obj = JsonConvert.DeserializeObject(response); + TR181PageModel obj = JsonConvert.DeserializeObject(response); if (obj.QueueSkbTimeOut.Equals(value)) { new Thread(() => { MessageBox.Show("QueueSkbTimeOut geändert", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start(); diff --git a/SpeedportHybridControl/Model/PhoneCallList.cs b/SpeedportHybridControl/Model/PhoneCallList.cs new file mode 100644 index 0000000..58f01a9 --- /dev/null +++ b/SpeedportHybridControl/Model/PhoneCallList.cs @@ -0,0 +1,41 @@ +namespace SpeedportHybridControl.Model { + public class PhoneCallList : SuperViewModel { + private int _id; + private string _date; + private string _time; + private string _who; + private string _duration; + + public int id { + get { return _id; } + set { SetProperty(ref _id, value); } + } + + public string date { + get { return _date; } + set { SetProperty(ref _date, value); } + } + + public string time { + get { return _time; } + set { SetProperty(ref _time, value); } + } + + public string who { + get { return _who; } + set { SetProperty(ref _who, value); } + } + + public string duration { + get { return _duration; } + set { SetProperty(ref _duration, value); } + } + + public override string ToString () { + return string.Concat(date, " ", time, " ", who, " ", duration); + } + + public PhoneCallList () { + } + } +} diff --git a/SpeedportHybridControl/Model/PhoneCallViewModel.cs b/SpeedportHybridControl/Model/PhoneCallViewModel.cs deleted file mode 100644 index 8f5d57f..0000000 --- a/SpeedportHybridControl/Model/PhoneCallViewModel.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System.Collections.Generic; - -namespace SpeedportHybridControl.Model { - public class PhoneCallData : SuperViewModel { - private List _missedCalls; - private List _takenCalls; - private List _dialedCalls; - private string _datetime; - - public List missedCalls { - get { return _missedCalls; } - set { SetProperty(ref _missedCalls, value); } - } - - public List takenCalls { - get { return _takenCalls; } - set { SetProperty(ref _takenCalls, value); } - } - - public List dialedCalls { - get { return _dialedCalls; } - set { SetProperty(ref _dialedCalls, value); } - } - - public string datetime { - get { return _datetime; } - set { SetProperty(ref _datetime, value); } - } - - public PhoneCallData () { - } - } - - public class PhoneCallList : SuperViewModel { - private int _id; - private string _date; - private string _time; - private string _who; - private string _duration; - - public int id { - get { return _id; } - set { SetProperty(ref _id, value); } - } - - public string date { - get { return _date; } - set { SetProperty(ref _date, value); } - } - - public string time { - get { return _time; } - set { SetProperty(ref _time, value); } - } - - public string who { - get { return _who; } - set { SetProperty(ref _who, value); } - } - - public string duration { - get { return _duration; } - set { SetProperty(ref _duration, value); } - } - - public override string ToString() { - return string.Concat(date, " ", time, " ", who, " ", duration); - } - - public PhoneCallList () { - } - } -} diff --git a/SpeedportHybridControl/Model/StatusPhoneList.cs b/SpeedportHybridControl/Model/StatusPhoneList.cs new file mode 100644 index 0000000..7b97cd4 --- /dev/null +++ b/SpeedportHybridControl/Model/StatusPhoneList.cs @@ -0,0 +1,20 @@ +namespace SpeedportHybridControl.Model { + 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/Model/StatusPhoneListModel.cs b/SpeedportHybridControl/Model/StatusPhoneListModel.cs deleted file mode 100644 index c08d448..0000000 --- a/SpeedportHybridControl/Model/StatusPhoneListModel.cs +++ /dev/null @@ -1,20 +0,0 @@ -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/TR181ViewModel.cs b/SpeedportHybridControl/Model/TR181ViewModel.cs deleted file mode 100644 index 6b119b3..0000000 --- a/SpeedportHybridControl/Model/TR181ViewModel.cs +++ /dev/null @@ -1,118 +0,0 @@ -namespace SpeedportHybridControl.Model { - public class TR181 : SuperViewModel { - private string _enable1; - private string _status1; - private string _mode; - private string _servername; - private string _severip; - private string _bw; - private string _errorinfo; - private string _hellostatus; - - private string _lte_tunnel; - private string _dsl_tunnel; - private string _bonding; - private string _QueueSkbTimeOut; - - private string _datetime; - - private string _bypass_up_bw; - private string _bypass_dw_bw; - private string _bypass_up_rb; - private string _bypass_dw_rb; - private string _bypass_check; - - public string enable1 { - get { return _enable1; } - set { SetProperty(ref _enable1, value); } - } - - public string status1 { - get { return _status1; } - set { SetProperty(ref _status1, value); } - } - - public string mode { - get { return _mode; } - set { SetProperty(ref _mode, value); } - } - - public string servername { - get { return _servername; } - set { SetProperty(ref _servername, value); } - } - - public string severip { - get { return _severip; } - set { SetProperty(ref _severip, value); } - } - - public string bw { - get { return _bw; } - set { SetProperty(ref _bw, value); } - } - - public string errorinfo { - get { return _errorinfo; } - set { SetProperty(ref _errorinfo, value); } - } - - public string hellostatus { - get { return _hellostatus; } - set { SetProperty(ref _hellostatus, value); } - } - - public string lte_tunnel { - get { return _lte_tunnel; } - set { SetProperty(ref _lte_tunnel, value); } - } - - public string dsl_tunnel { - get { return _dsl_tunnel; } - set { SetProperty(ref _dsl_tunnel, value); } - } - - public string bonding { - get { return _bonding; } - set { SetProperty(ref _bonding, value); } - } - - public string QueueSkbTimeOut { - get { return _QueueSkbTimeOut; } - set { SetProperty(ref _QueueSkbTimeOut, value); } - } - - public string datetime { - get { return _datetime; } - set { SetProperty(ref _datetime, value); } - } - - public string bypass_up_bw { - get { return _bypass_up_bw; } - set { SetProperty(ref _bypass_up_bw, value); } - } - - public string bypass_dw_bw { - get { return _bypass_dw_bw; } - set { SetProperty(ref _bypass_dw_bw, value); } - } - - public string bypass_up_rb { - get { return _bypass_up_rb; } - set { SetProperty(ref _bypass_up_rb, value); } - } - - public string bypass_dw_rb { - get { return _bypass_dw_rb; } - set { SetProperty(ref _bypass_dw_rb, value); } - } - - public string bypass_check { - get { return _bypass_check; } - set { SetProperty(ref _bypass_check, value); } - } - - public TR181() { - } - } -} diff --git a/SpeedportHybridControl/PageModel/PhonePageModel.cs b/SpeedportHybridControl/PageModel/PhonePageModel.cs new file mode 100644 index 0000000..e7b5a66 --- /dev/null +++ b/SpeedportHybridControl/PageModel/PhonePageModel.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using SpeedportHybridControl.Model; +using SpeedportHybridControl.Data; +using SpeedportHybridControl.Implementations; +using System.Threading; +using System.Windows; + +namespace SpeedportHybridControl.PageModel { + class PhonePageModel : SuperViewModel { + private DelegateCommand _reloadCommand; + private DelegateCommand _copyCommand; + private DelegateCommand _clearCommand; + private PhoneCallList _selectedItem; + + private List _missedCalls; + private List _takenCalls; + private List _dialedCalls; + private string _datetime; + + public DelegateCommand ReloadCommand { + get { return _reloadCommand; } + set { SetProperty(ref _reloadCommand, value); } + } + + public DelegateCommand CopyCommand { + get { return _copyCommand; } + set { SetProperty(ref _copyCommand, value); } + } + + public DelegateCommand ClearCommand { + get { return _clearCommand; } + set { SetProperty(ref _clearCommand, value); } + } + + public PhoneCallList SelectedItem { + get { return _selectedItem; } + set { SetProperty(ref _selectedItem, value); } + } + + public List missedCalls { + get { return _missedCalls; } + set { SetProperty(ref _missedCalls, value); } + } + + public List takenCalls { + get { return _takenCalls; } + set { SetProperty(ref _takenCalls, value); } + } + + public List dialedCalls { + get { return _dialedCalls; } + set { SetProperty(ref _dialedCalls, value); } + } + + public string datetime { + get { return _datetime; } + set { SetProperty(ref _datetime, value); } + } + + private void OnReloadCommandExecute () { + new Thread(() => { SpeedportHybrid.initPhone(); }).Start(); + } + + private void OnCopyCommandExecute () { + Clipboard.SetText(SelectedItem.ToString()); + } + + private void OnClearCommandExecute () { + //TODO + } + + public PhonePageModel () { + ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute)); + CopyCommand = new DelegateCommand(new Action(OnCopyCommandExecute)); + ClearCommand = new DelegateCommand(new Action(OnClearCommandExecute)); + } + } +} diff --git a/SpeedportHybridControl/PageModel/StatusPageModel.cs b/SpeedportHybridControl/PageModel/StatusPageModel.cs index 1432a45..a370ad4 100644 --- a/SpeedportHybridControl/PageModel/StatusPageModel.cs +++ b/SpeedportHybridControl/PageModel/StatusPageModel.cs @@ -19,7 +19,7 @@ namespace SpeedportHybridControl.PageModel { private string _status; private string _dsl_downstream; private string _dsl_upstream; - private List _addphonenumber; + private List _addphonenumber; private string _use_dect; private string _dect_devices; private string _wlan_ssid; @@ -96,7 +96,7 @@ namespace SpeedportHybridControl.PageModel { set { SetProperty(ref _dsl_upstream, value); } } - public List addphonenumber { + public List addphonenumber { get { return _addphonenumber; } set { SetProperty(ref _addphonenumber, value); } } diff --git a/SpeedportHybridControl/PageModel/SyslogPageModel.cs b/SpeedportHybridControl/PageModel/SyslogPageModel.cs index c223a09..0239332 100644 --- a/SpeedportHybridControl/PageModel/SyslogPageModel.cs +++ b/SpeedportHybridControl/PageModel/SyslogPageModel.cs @@ -67,9 +67,7 @@ namespace SpeedportHybridControl.PageModel { } private void OnReloadCommandExecute () { - new Thread(() => { - SpeedportHybrid.initSyslog(); - }).Start(); + new Thread(() => { SpeedportHybrid.initSyslog(); }).Start(); } private void OnCopyCommandExecute () { @@ -86,7 +84,10 @@ namespace SpeedportHybridControl.PageModel { } private void ApplyFilter () { - if (object.ReferenceEquals(syslogList, null).Equals(false)) { + if (object.ReferenceEquals(syslogList, null)) { + filteredList = syslogList; + } + else { List tmp = syslogList; filteredList = tmp.Where(item => SyslogFilter(item)).ToList(); } @@ -94,8 +95,7 @@ namespace SpeedportHybridControl.PageModel { private bool SyslogFilter (object item) { if (SearchText.IsNullOrEmpty().Equals(false)) { - bool a = ((item as SyslogList).message.IndexOf(SearchText, StringComparison.OrdinalIgnoreCase) >= 0); - return a; + return ((item as SyslogList).message.IndexOf(SearchText, StringComparison.OrdinalIgnoreCase) >= 0); } return true; diff --git a/SpeedportHybridControl/PageModel/TR181PageModel.cs b/SpeedportHybridControl/PageModel/TR181PageModel.cs new file mode 100644 index 0000000..151203c --- /dev/null +++ b/SpeedportHybridControl/PageModel/TR181PageModel.cs @@ -0,0 +1,148 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SpeedportHybridControl.Data; +using SpeedportHybridControl.Model; +using SpeedportHybridControl.Implementations; +using System.Threading; + +namespace SpeedportHybridControl.PageModel { + class TR181PageModel : SuperViewModel { + private DelegateCommand _reloadCommand; + private DelegateCommand _saveCommand; + + private string _enable1; + private string _status1; + private string _mode; + private string _servername; + private string _severip; + private string _bw; + private string _errorinfo; + private string _hellostatus; + private string _lte_tunnel; + private string _dsl_tunnel; + private string _bonding; + private string _QueueSkbTimeOut; + private string _datetime; + private string _bypass_up_bw; + private string _bypass_dw_bw; + private string _bypass_up_rb; + private string _bypass_dw_rb; + private string _bypass_check; + + public DelegateCommand ReloadCommand { + get { return _reloadCommand; } + set { SetProperty(ref _reloadCommand, value); } + } + + public DelegateCommand SaveCommand { + get { return _saveCommand; } + set { SetProperty(ref _saveCommand, value); } + } + + public string enable1 { + get { return _enable1; } + set { SetProperty(ref _enable1, value); } + } + + public string status1 { + get { return _status1; } + set { SetProperty(ref _status1, value); } + } + + public string mode { + get { return _mode; } + set { SetProperty(ref _mode, value); } + } + + public string servername { + get { return _servername; } + set { SetProperty(ref _servername, value); } + } + + public string severip { + get { return _severip; } + set { SetProperty(ref _severip, value); } + } + + public string bw { + get { return _bw; } + set { SetProperty(ref _bw, value); } + } + + public string errorinfo { + get { return _errorinfo; } + set { SetProperty(ref _errorinfo, value); } + } + + public string hellostatus { + get { return _hellostatus; } + set { SetProperty(ref _hellostatus, value); } + } + + public string lte_tunnel { + get { return _lte_tunnel; } + set { SetProperty(ref _lte_tunnel, value); } + } + + public string dsl_tunnel { + get { return _dsl_tunnel; } + set { SetProperty(ref _dsl_tunnel, value); } + } + + public string bonding { + get { return _bonding; } + set { SetProperty(ref _bonding, value); } + } + + public string QueueSkbTimeOut { + get { return _QueueSkbTimeOut; } + set { SetProperty(ref _QueueSkbTimeOut, value); } + } + + public string datetime { + get { return _datetime; } + set { SetProperty(ref _datetime, value); } + } + + public string bypass_up_bw { + get { return _bypass_up_bw; } + set { SetProperty(ref _bypass_up_bw, value); } + } + + public string bypass_dw_bw { + get { return _bypass_dw_bw; } + set { SetProperty(ref _bypass_dw_bw, value); } + } + + public string bypass_up_rb { + get { return _bypass_up_rb; } + set { SetProperty(ref _bypass_up_rb, value); } + } + + public string bypass_dw_rb { + get { return _bypass_dw_rb; } + set { SetProperty(ref _bypass_dw_rb, value); } + } + + public string bypass_check { + get { return _bypass_check; } + set { SetProperty(ref _bypass_check, value); } + } + + private void OnReloadCommandExecute () { + new Thread(() => { SpeedportHybrid.initTR181(); }).Start(); + } + + private void OnSaveCommandExecute () { + SpeedportHybridAPI.getInstance().setQueueSkbTimeOut(QueueSkbTimeOut); + } + + public TR181PageModel () { + ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute)); + SaveCommand = new DelegateCommand(new Action(OnSaveCommandExecute)); + } + } +} diff --git a/SpeedportHybridControl/SpeedportHybridControl.csproj b/SpeedportHybridControl/SpeedportHybridControl.csproj index 40fee76..4ae83d9 100644 --- a/SpeedportHybridControl/SpeedportHybridControl.csproj +++ b/SpeedportHybridControl/SpeedportHybridControl.csproj @@ -74,13 +74,13 @@ - + + - @@ -145,10 +145,11 @@ - + + AboutPage.xaml diff --git a/SpeedportHybridControl/page/PhonePage.xaml b/SpeedportHybridControl/page/PhonePage.xaml index 2df8048..a6f6b62 100644 --- a/SpeedportHybridControl/page/PhonePage.xaml +++ b/SpeedportHybridControl/page/PhonePage.xaml @@ -1,25 +1,20 @@  - - - - + - + - + @@ -39,10 +34,10 @@ - + - + @@ -63,10 +58,10 @@ - + - + @@ -87,8 +82,8 @@ - -