update Lan Page
authorStricted <info@stricted.de>
Wed, 11 Nov 2015 22:07:05 +0000 (23:07 +0100)
committerStricted <info@stricted.de>
Wed, 11 Nov 2015 22:07:05 +0000 (23:07 +0100)
SpeedportHybridControl/App.xaml
SpeedportHybridControl/Model/DeviceList.cs [new file with mode: 0644]
SpeedportHybridControl/Model/DeviceViewModel.cs [deleted file]
SpeedportHybridControl/PageModel/LanPageModel.cs [new file with mode: 0644]
SpeedportHybridControl/PageModel/TR181PageModel.cs
SpeedportHybridControl/SpeedportHybridControl.csproj
SpeedportHybridControl/page/LanPage.xaml

index b4a76290fbaac7fed726e9b27cafd8042275b288..5c0bcffc36d4676a994228b66e1dcef260ae98ac 100644 (file)
@@ -17,8 +17,7 @@
             <pagemodel:SyslogPageModel x:Key="SyslogPageModel"></pagemodel:SyslogPageModel>
             <pagemodel:TR181PageModel x:Key="TR181PageModel"></pagemodel:TR181PageModel>
             <pagemodel:PhonePageModel x:Key="PhonePageModel"></pagemodel:PhonePageModel>
-            
-            <model:DeviceData x:Key="DeviceData"></model:DeviceData>
+            <pagemodel:LanPageModel x:Key="LanPageModel"></pagemodel:LanPageModel>
         </ResourceDictionary>
     </Application.Resources>
 </Application>
diff --git a/SpeedportHybridControl/Model/DeviceList.cs b/SpeedportHybridControl/Model/DeviceList.cs
new file mode 100644 (file)
index 0000000..eae8e6b
--- /dev/null
@@ -0,0 +1,55 @@
+namespace SpeedportHybridControl.Model {
+       public class DeviceList : SuperViewModel {
+               private int _id;
+               private string _name;
+               private string _mac;
+               private int _type;
+               private int _connected;
+               private string _ipv4;
+               private string _ipv6;
+               private int _static;
+
+               public int id {
+                       get { return _id; }
+                       set { SetProperty(ref _id, value); }
+               }
+
+               public string name {
+                       get { return _name; }
+                       set { SetProperty(ref _name, value); }
+               }
+
+               public string mac {
+                       get { return _mac; }
+                       set { SetProperty(ref _mac, value); }
+               }
+
+               public int type {
+                       get { return _type; }
+                       set { SetProperty(ref _type, value); }
+               }
+
+               public int connected {
+                       get { return _connected; }
+                       set { SetProperty(ref _connected, value); }
+               }
+
+               public string ipv4 {
+                       get { return _ipv4; }
+                       set { SetProperty(ref _ipv4, value); }
+               }
+
+               public string ipv6 {
+                       get { return _ipv6; }
+                       set { SetProperty(ref _ipv6, value); }
+               }
+
+               public int mstatic {
+                       get { return _static; }
+                       set { SetProperty(ref _static, value); }
+               }
+
+               public DeviceList() {
+               }
+       }
+}
diff --git a/SpeedportHybridControl/Model/DeviceViewModel.cs b/SpeedportHybridControl/Model/DeviceViewModel.cs
deleted file mode 100644 (file)
index ee69b48..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-using System.Collections.Generic;
-
-namespace SpeedportHybridControl.Model {
-       public class DeviceData : SuperViewModel {
-               private List<DeviceList> _deviceList;
-               private string _datetime;
-
-               public List<DeviceList> deviceList {
-                       get { return _deviceList; }
-                       set { SetProperty(ref _deviceList, value); }
-               }
-
-               public string datetime {
-                       get { return _datetime; }
-                       set { SetProperty(ref _datetime, value); }
-               }
-
-               public DeviceData() {
-               }
-       }
-
-       public class DeviceList : SuperViewModel {
-               private int _id;
-               private string _name;
-               private string _mac;
-               private int _type;
-               private int _connected;
-               private string _ipv4;
-               private string _ipv6;
-               private int _static;
-
-               public int id {
-                       get { return _id; }
-                       set { SetProperty(ref _id, value); }
-               }
-
-               public string name {
-                       get { return _name; }
-                       set { SetProperty(ref _name, value); }
-               }
-
-               public string mac {
-                       get { return _mac; }
-                       set { SetProperty(ref _mac, value); }
-               }
-
-               public int type {
-                       get { return _type; }
-                       set { SetProperty(ref _type, value); }
-               }
-
-               public int connected {
-                       get { return _connected; }
-                       set { SetProperty(ref _connected, value); }
-               }
-
-               public string ipv4 {
-                       get { return _ipv4; }
-                       set { SetProperty(ref _ipv4, value); }
-               }
-
-               public string ipv6 {
-                       get { return _ipv6; }
-                       set { SetProperty(ref _ipv6, value); }
-               }
-
-               public int mstatic {
-                       get { return _static; }
-                       set { SetProperty(ref _static, value); }
-               }
-
-               public DeviceList() {
-               }
-       }
-}
diff --git a/SpeedportHybridControl/PageModel/LanPageModel.cs b/SpeedportHybridControl/PageModel/LanPageModel.cs
new file mode 100644 (file)
index 0000000..9f7f8e4
--- /dev/null
@@ -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> _deviceList;
+               private string _datetime;
+
+               public DelegateCommand ReloadCommand {
+                       get { return _reloadCommand; }
+                       set { SetProperty(ref _reloadCommand, value); }
+               }
+
+               public List<DeviceList> 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));
+               }
+       }
+}
index 151203c59336d055f6aa13203e1988e619f5d53d..c25cb707d96382ce1aa1633377977eb282ec0840 100644 (file)
@@ -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;
index 4ae83d9027d09e88b8d51f596f949e07bafe4797..488db6e0a72eaa20f4910c0aa7b3a31ab14a3114 100644 (file)
     </Compile>
     <Compile Include="Model\bonding_client.cs" />
     <Compile Include="Model\Connection.cs" />
-    <Compile Include="Model\DeviceViewModel.cs" />
+    <Compile Include="Model\DeviceList.cs" />
     <Compile Include="Model\Line.cs" />
     <Compile Include="Model\PhoneCallList.cs" />
     <Compile Include="Model\StatusPhoneList.cs" />
     <Compile Include="Model\SyslogList.cs" />
     <Compile Include="PageModel\DslPageModel.cs" />
+    <Compile Include="PageModel\LanPageModel.cs" />
     <Compile Include="PageModel\LoginPageModel.cs" />
     <Compile Include="PageModel\LteInfoModel.cs" />
     <Compile Include="PageModel\MainWindowModel.cs" />
index afb1f3172b9fa2ad399109ce089db98b6bf3aa2b..e0935fb2fa352e3c8ac3ec5434f75af5ebdcf76e 100644 (file)
@@ -1,14 +1,14 @@
 <Page x:Class="SpeedportHybridControl.page.LanPage"
       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="LanPage">
 
-    <Grid DataContext="{StaticResource DeviceData}">
+    <Grid DataContext="{StaticResource LanPageModel}">
         <ListView ItemsSource="{Binding deviceList}" x:Name="listView4" Margin="0,0,0,39">
             <ListView.Resources>
                 <Style TargetType="{x:Type GridViewColumnHeader}">
@@ -30,6 +30,6 @@
 
         <TextBlock Text="{Binding datetime}" Margin="0,0,10,0" HorizontalAlignment="Right" VerticalAlignment="Bottom" />
 
-        <Button x:Name="reload" Content="Aktualisieren" Margin="218,0,218,0" Click="button_click" VerticalAlignment="Bottom"/>
+        <Button Command="{Binding Path=ReloadCommand}" x:Name="reload" Content="Aktualisieren" Margin="218,0,218,0" VerticalAlignment="Bottom"/>
     </Grid>
 </Page>