From cd5bc2bef7c2c4887ccc216049d78ecc98c8efee Mon Sep 17 00:00:00 2001 From: Stricted Date: Wed, 11 Nov 2015 23:07:05 +0100 Subject: [PATCH] update Lan Page --- SpeedportHybridControl/App.xaml | 3 +- .../{DeviceViewModel.cs => DeviceList.cs} | 22 +---------- .../PageModel/LanPageModel.cs | 38 +++++++++++++++++++ .../PageModel/TR181PageModel.cs | 4 -- .../SpeedportHybridControl.csproj | 3 +- SpeedportHybridControl/page/LanPage.xaml | 10 ++--- 6 files changed, 47 insertions(+), 33 deletions(-) rename SpeedportHybridControl/Model/{DeviceViewModel.cs => DeviceList.cs} (69%) create mode 100644 SpeedportHybridControl/PageModel/LanPageModel.cs diff --git a/SpeedportHybridControl/App.xaml b/SpeedportHybridControl/App.xaml index b4a7629..5c0bcff 100644 --- a/SpeedportHybridControl/App.xaml +++ b/SpeedportHybridControl/App.xaml @@ -17,8 +17,7 @@ - - + diff --git a/SpeedportHybridControl/Model/DeviceViewModel.cs b/SpeedportHybridControl/Model/DeviceList.cs similarity index 69% rename from SpeedportHybridControl/Model/DeviceViewModel.cs rename to SpeedportHybridControl/Model/DeviceList.cs index ee69b48..eae8e6b 100644 --- a/SpeedportHybridControl/Model/DeviceViewModel.cs +++ b/SpeedportHybridControl/Model/DeviceList.cs @@ -1,24 +1,4 @@ -using System.Collections.Generic; - -namespace SpeedportHybridControl.Model { - public class DeviceData : SuperViewModel { - private List _deviceList; - private string _datetime; - - public List deviceList { - get { return _deviceList; } - set { SetProperty(ref _deviceList, value); } - } - - public string datetime { - get { return _datetime; } - set { SetProperty(ref _datetime, value); } - } - - public DeviceData() { - } - } - +namespace SpeedportHybridControl.Model { public class DeviceList : SuperViewModel { private int _id; private string _name; diff --git a/SpeedportHybridControl/PageModel/LanPageModel.cs b/SpeedportHybridControl/PageModel/LanPageModel.cs new file mode 100644 index 0000000..9f7f8e4 --- /dev/null +++ b/SpeedportHybridControl/PageModel/LanPageModel.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using SpeedportHybridControl.Data; +using SpeedportHybridControl.Model; +using SpeedportHybridControl.Implementations; +using System.Threading; + +namespace SpeedportHybridControl.PageModel { + class LanPageModel : SuperViewModel { + private DelegateCommand _reloadCommand; + + private List _deviceList; + private string _datetime; + + public DelegateCommand ReloadCommand { + get { return _reloadCommand; } + set { SetProperty(ref _reloadCommand, value); } + } + + public List deviceList { + get { return _deviceList; } + set { SetProperty(ref _deviceList, value); } + } + + public string datetime { + get { return _datetime; } + set { SetProperty(ref _datetime, value); } + } + + private void OnReloadCommandExecute () { + new Thread(() => { SpeedportHybrid.initLan(); }).Start(); + } + + public LanPageModel () { + ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute)); + } + } +} diff --git a/SpeedportHybridControl/PageModel/TR181PageModel.cs b/SpeedportHybridControl/PageModel/TR181PageModel.cs index 151203c..c25cb70 100644 --- a/SpeedportHybridControl/PageModel/TR181PageModel.cs +++ b/SpeedportHybridControl/PageModel/TR181PageModel.cs @@ -1,8 +1,4 @@ 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; diff --git a/SpeedportHybridControl/SpeedportHybridControl.csproj b/SpeedportHybridControl/SpeedportHybridControl.csproj index 4ae83d9..488db6e 100644 --- a/SpeedportHybridControl/SpeedportHybridControl.csproj +++ b/SpeedportHybridControl/SpeedportHybridControl.csproj @@ -72,12 +72,13 @@ - + + diff --git a/SpeedportHybridControl/page/LanPage.xaml b/SpeedportHybridControl/page/LanPage.xaml index afb1f31..e0935fb 100644 --- a/SpeedportHybridControl/page/LanPage.xaml +++ b/SpeedportHybridControl/page/LanPage.xaml @@ -1,14 +1,14 @@  - +