update LteInfoPage
authorStricted <info@stricted.de>
Wed, 11 Nov 2015 17:07:01 +0000 (18:07 +0100)
committerStricted <info@stricted.de>
Wed, 11 Nov 2015 17:07:01 +0000 (18:07 +0100)
14 files changed:
SpeedportHybridControl/App.xaml
SpeedportHybridControl/Data/SpeedportHybrid.cs
SpeedportHybridControl/Data/SpeedportHybridAPI.cs
SpeedportHybridControl/MainWindow.xaml
SpeedportHybridControl/Model/LTEViewModel.cs [deleted file]
SpeedportHybridControl/PageModel/DslPageModel.cs
SpeedportHybridControl/PageModel/LteInfoModel.cs [new file with mode: 0644]
SpeedportHybridControl/PageModel/MainWindowModel.cs
SpeedportHybridControl/SpeedportHybridControl.csproj
SpeedportHybridControl/ltepopup.xaml [new file with mode: 0644]
SpeedportHybridControl/ltepopup.xaml.cs [new file with mode: 0644]
SpeedportHybridControl/packages.config
SpeedportHybridControl/page/LteInfoPage.xaml
SpeedportHybridControl/page/LteInfoPage.xaml.cs

index 38ec605bc6da3b6c29e87e69c918b6c610cc6986..26d6c36e04418ac874fc1fa74c9b84182b91ed95 100644 (file)
@@ -4,6 +4,7 @@
              xmlns:local="clr-namespace:SpeedportHybridControl"
              xmlns:model="clr-namespace:SpeedportHybridControl.Model"
              xmlns:pagemodel="clr-namespace:SpeedportHybridControl.PageModel"
+             ShutdownMode="OnMainWindowClose"
              StartupUri="MainWindow.xaml">
     <Application.Resources>
         <ResourceDictionary>
@@ -12,9 +13,8 @@
             <pagemodel:StatusPageModel x:Key="StatusPageModel"></pagemodel:StatusPageModel>
             <pagemodel:OverviewPageModel x:Key="OverviewPageModel"></pagemodel:OverviewPageModel>
             <pagemodel:DslPageModel x:Key="DslPageModel"></pagemodel:DslPageModel>
+            <pagemodel:LteInfoModel x:Key="LteInfoModel"></pagemodel:LteInfoModel>
             
-            <model:LTE x:Key="LTE"></model:LTE>
-            <model:LTE x:Key="LTE2"></model:LTE>
             <model:SyslogData x:Key="SyslogData"></model:SyslogData>
             <model:TR181 x:Key="TR181"></model:TR181>
             <model:PhoneCallData x:Key="PhoneCallData"></model:PhoneCallData>
index 079ec1837fb048f3cb67d481f4e2003e7552e092..3f6bb25345bfdaea2cf5b66e6b9d09c97277647b 100644 (file)
@@ -307,19 +307,19 @@ namespace SpeedportHybridControl.Data {
                                if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false))
                                        return;
 
-                               LTE lte = null;
+                               LteInfoModel lte = null;
                                if (popup.Equals(true)) {
-                                       lte = Application.Current.FindResource("LTE2") as LTE;
+                                       //lte = Application.Current.FindResource("LTE2") as LTE;
                                }
                                else {
-                                       lte = Application.Current.FindResource("LTE") as LTE;
+                                       lte = Application.Current.FindResource("LteInfoModel") as LteInfoModel;
                                }
 
                                string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/lteinfo.json");
                                if (response.IsNullOrEmpty())
                                        return;
 
-                               LTE obj = JsonConvert.DeserializeObject<LTE>(response);
+                               LteInfoModel obj = JsonConvert.DeserializeObject<LteInfoModel>(response);
                                response = null;
 
                                lte.imei = obj.imei;
@@ -599,7 +599,7 @@ namespace SpeedportHybridControl.Data {
 
                                                // Funkzellen Info
                                                if (msg.ToString().Contains("(LT004)") && isLTE.Equals(true)) {
-                                                       LTE lte = Application.Current.FindResource("LTE") as LTE;
+                                                       LteInfoModel lte = Application.Current.FindResource("LteInfoModel") as LteInfoModel;
                                                        //LTE lte2 = Application.Current.FindResource("LTE2") as LTE;
 
                                                        string[] parts = msg.ToString().Split(',');
index 868316326a3d9b553d7766f63b8f9e8326d516f1..23bacc87bedeb43690553e0c274b2b971fd39245 100644 (file)
@@ -600,7 +600,7 @@ namespace SpeedportHybridControl.Data {
                        if (response.IsNullOrEmpty())
                                return;
                        try {
-                               LTE obj = JsonConvert.DeserializeObject<LTE>(response);
+                               LteInfoModel obj = JsonConvert.DeserializeObject<LteInfoModel>(response);
 
                                string antenna_mode;
                                if (obj.antenna_mode.Equals("Antennal set to internal")) {
index c8f747a053b668a39018ab1f2444ca68cd9f3966..24a8ff98f842ee39347f4fe7fb04b2c4a1fb122d 100644 (file)
@@ -9,9 +9,10 @@
         Width="530"
         MinHeight="350"
         MinWidth="530"
-        Title="Speedport Hybrid Konfigurationsprogramm"
+        DataContext="{StaticResource MainWindowModel}"
+        Title="{Binding Path=Title}"
         Icon="t-com icon.ico">
-    <Grid DataContext="{StaticResource MainWindowModel}" >
+    <Grid>
         <StackPanel Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left">
             <StackPanel.Resources>
                 <Style TargetType="{x:Type Button}">
diff --git a/SpeedportHybridControl/Model/LTEViewModel.cs b/SpeedportHybridControl/Model/LTEViewModel.cs
deleted file mode 100644 (file)
index a97d188..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-using System.Windows.Media;
-
-namespace SpeedportHybridControl.Model {
-       public class LTE : SuperViewModel {
-               private string _imei;
-               private string _imsi;
-               private string _device_status;
-               private string _card_status;
-               private string _antenna_mode;
-               private string _antenna_mode2;
-               private string _phycellid;
-               private string _cellid;
-               private string _rsrp;
-               private Brush _rsrp_bg = Brushes.Transparent;
-               private string _rsrq;
-               private Brush _rsrq_bg = Brushes.Transparent;
-               private string _service_status;
-               private string _tac;
-               private string _datetime;
-               private string _frequenz;
-
-               public string imei {
-                       get { return _imei; }
-                       set { SetProperty(ref _imei, value); }
-               }
-
-               public string imsi {
-                       get { return _imsi; }
-                       set { SetProperty(ref _imsi, value); }
-               }
-
-               public string device_status {
-                       get { return _device_status; }
-                       set { SetProperty(ref _device_status, value); }
-               }
-
-               public string card_status {
-                       get { return _card_status; }
-                       set { SetProperty(ref _card_status, value); }
-               }
-
-               public string antenna_mode {
-                       get { return _antenna_mode; }
-                       set { SetProperty(ref _antenna_mode, value); }
-               }
-
-               public string antenna_mode2 {
-                       get { return _antenna_mode2; }
-                       set { SetProperty(ref _antenna_mode2, value); }
-               }
-
-               public string phycellid {
-                       get { return _phycellid; }
-                       set { SetProperty(ref _phycellid, value); }
-               }
-
-               public string cellid {
-                       get { return _cellid; }
-                       set { SetProperty(ref _cellid, value); }
-               }
-
-               public string rsrp {
-                       get { return _rsrp; }
-                       set { SetProperty(ref _rsrp, value); }
-               }
-
-               public Brush rsrp_bg {
-                       get { return _rsrp_bg; }
-                       set { SetProperty(ref _rsrp_bg, value); }
-               }
-
-               public string rsrq {
-                       get { return _rsrq; }
-                       set { SetProperty(ref _rsrq, value); }
-               }
-
-               public Brush rsrq_bg {
-                       get { return _rsrq_bg; }
-                       set { SetProperty(ref _rsrq_bg, value); }
-               }
-
-               public string service_status {
-                       get { return _service_status; }
-                       set { SetProperty(ref _service_status, value); }
-               }
-
-               public string tac {
-                       get { return _tac; }
-                       set { SetProperty(ref _tac, value); }
-               }
-
-               public string datetime {
-                       get { return _datetime; }
-                       set { SetProperty(ref _datetime, value); }
-               }
-
-               public string frequenz {
-                       get { return _frequenz; }
-                       set { SetProperty(ref _frequenz, value); }
-               }
-
-               public LTE() {
-               }
-       }
-}
index edac2502bf281cb0e4a73f2fd933a7dd04e4dea9..e68c75d0a89ecbffba9eb3581d79814dae67eb23 100644 (file)
@@ -65,6 +65,7 @@ namespace SpeedportHybridControl.PageModel {
                        get { return _autoReloadCommand; }
                        set { SetProperty(ref _autoReloadCommand, value); }
                }
+
                public bool AutoReload {
                        get { return _autoReload; }
                        set { SetProperty(ref _autoReload, value); }
diff --git a/SpeedportHybridControl/PageModel/LteInfoModel.cs b/SpeedportHybridControl/PageModel/LteInfoModel.cs
new file mode 100644 (file)
index 0000000..c9e3b3d
--- /dev/null
@@ -0,0 +1,217 @@
+using SpeedportHybridControl.Data;
+using SpeedportHybridControl.Implementations;
+using SpeedportHybridControl.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Timers;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+
+namespace SpeedportHybridControl.PageModel {
+       class LteInfoModel : SuperViewModel {
+               private DelegateCommand _reloadCommand;
+               private DelegateCommand _autoReloadCommand;
+               private DelegateCommand _saveCommand;
+               private DelegateCommand _popupCommand;
+               private System.Timers.Timer _timer;
+               private bool _autoReload;
+               private ltepopup _ltepopup;
+               private ComboBoxItem _selectedItem;
+
+
+               private string _imei;
+               private string _imsi;
+               private string _device_status;
+               private string _card_status;
+               private string _antenna_mode;
+               private string _antenna_mode2;
+               private string _phycellid;
+               private string _cellid;
+               private string _rsrp;
+               private Brush _rsrp_bg = Brushes.Transparent;
+               private string _rsrq;
+               private Brush _rsrq_bg = Brushes.Transparent;
+               private string _service_status;
+               private string _tac;
+               private string _datetime;
+               private string _frequenz;
+
+               public DelegateCommand ReloadCommand {
+                       get { return _reloadCommand; }
+                       set { SetProperty(ref _reloadCommand, value); }
+               }
+
+               public DelegateCommand AutoReloadCommand {
+                       get { return _autoReloadCommand; }
+                       set { SetProperty(ref _autoReloadCommand, value); }
+               }
+
+               public DelegateCommand SaveCommand {
+                       get { return _saveCommand; }
+                       set { SetProperty(ref _saveCommand, value); }
+               }
+
+               public DelegateCommand PopupCommand {
+                       get { return _popupCommand; }
+                       set { SetProperty(ref _popupCommand, value); }
+               }
+
+               public ComboBoxItem SelectedItem {
+                       get { return _selectedItem; }
+                       set { SetProperty(ref _selectedItem, value); }
+               }
+
+               private void OnReloadCommandExecute () {
+                       new Thread(() => { SpeedportHybrid.initLTE(); }).Start();
+               }
+
+               private void OnAutoReloadCommandExecute () {
+                       if (AutoReload.Equals(true)) {
+                               StartTimer();
+                       }
+                       else {
+                               StopTimer();
+                       }
+               }
+
+               private void OnSaveCommandExecute () {
+                       SpeedportHybridAPI.getInstance().setAntennaMode(SelectedItem.Name);
+                       OnReloadCommandExecute();
+        }
+
+               private void OnPopupCommandExecute () {
+                       if (Object.Equals(_ltepopup, null)) {
+                               _ltepopup = new ltepopup();
+                       }
+                       else if (Object.Equals(_ltepopup, null).Equals(false) && _ltepopup.IsLoaded.Equals(false)) {
+                               _ltepopup = null;
+                               _ltepopup = new ltepopup();
+                       }
+
+                       if (_ltepopup.Visibility.Equals(Visibility.Visible).Equals(false)) {
+                               _ltepopup.Show();
+                               StopTimer();
+                       }
+               }
+
+               public bool AutoReload {
+                       get { return _autoReload; }
+                       set { SetProperty(ref _autoReload, value); }
+               }
+
+               public void StopTimer () {
+                       if (Object.Equals(_timer, null).Equals(false)) {
+                               _timer.Stop();
+                       }
+
+                       if (AutoReload.Equals(true)) {
+                               AutoReload = 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) {
+                       OnReloadCommandExecute();
+               }
+
+               public string imei {
+                       get { return _imei; }
+                       set { SetProperty(ref _imei, value); }
+               }
+
+               public string imsi {
+                       get { return _imsi; }
+                       set { SetProperty(ref _imsi, value); }
+               }
+
+               public string device_status {
+                       get { return _device_status; }
+                       set { SetProperty(ref _device_status, value); }
+               }
+
+               public string card_status {
+                       get { return _card_status; }
+                       set { SetProperty(ref _card_status, value); }
+               }
+
+               public string antenna_mode {
+                       get { return _antenna_mode; }
+                       set { SetProperty(ref _antenna_mode, value); }
+               }
+
+               public string antenna_mode2 {
+                       get { return _antenna_mode2; }
+                       set { SetProperty(ref _antenna_mode2, value); }
+               }
+
+               public string phycellid {
+                       get { return _phycellid; }
+                       set { SetProperty(ref _phycellid, value); }
+               }
+
+               public string cellid {
+                       get { return _cellid; }
+                       set { SetProperty(ref _cellid, value); }
+               }
+
+               public string rsrp {
+                       get { return _rsrp; }
+                       set { SetProperty(ref _rsrp, value); }
+               }
+
+               public Brush rsrp_bg {
+                       get { return _rsrp_bg; }
+                       set { SetProperty(ref _rsrp_bg, value); }
+               }
+
+               public string rsrq {
+                       get { return _rsrq; }
+                       set { SetProperty(ref _rsrq, value); }
+               }
+
+               public Brush rsrq_bg {
+                       get { return _rsrq_bg; }
+                       set { SetProperty(ref _rsrq_bg, value); }
+               }
+
+               public string service_status {
+                       get { return _service_status; }
+                       set { SetProperty(ref _service_status, value); }
+               }
+
+               public string tac {
+                       get { return _tac; }
+                       set { SetProperty(ref _tac, value); }
+               }
+
+               public string datetime {
+                       get { return _datetime; }
+                       set { SetProperty(ref _datetime, value); }
+               }
+
+               public string frequenz {
+                       get { return _frequenz; }
+                       set { SetProperty(ref _frequenz, value); }
+               }
+
+               public LteInfoModel () {
+                       ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
+                       AutoReloadCommand = new DelegateCommand(new Action(OnAutoReloadCommandExecute));
+                       SaveCommand = new DelegateCommand(new Action(OnSaveCommandExecute));
+                       PopupCommand = new DelegateCommand(new Action(OnPopupCommandExecute));
+               }
+       }
+}
index 7b02efdae1f917d64b3ba2974c870356713ef612..d3a4af9450fbd3aafeaab6edbf471e5a51cd7976 100644 (file)
@@ -49,6 +49,8 @@ namespace SpeedportHybridControl.PageModel {
 
                private Page _FrameSource;
 
+               private string _title;
+
                public string LoginButtonContent {
                        get { return _loginButtonContent; }
                        set { SetProperty(ref _loginButtonContent, value); }
@@ -209,6 +211,11 @@ namespace SpeedportHybridControl.PageModel {
                        set { SetProperty(ref _FrameSource, value); }
                }
 
+               public string Title {
+                       get { return _title; }
+                       set { SetProperty(ref _title, value); }
+               }
+
                private void OnSwitchToLoginPageExecute () {
                        changePage("login");
                }
@@ -263,9 +270,9 @@ namespace SpeedportHybridControl.PageModel {
 
                private void changePage (string page) {
                        if (object.Equals(FrameSource, null).Equals(false)) {
-                               Console.WriteLine("HERE!!!");
                                if (FrameSource.GetType().Equals(typeof(LteInfoPage))) {
-                                       // TODO: lteInfoPage.StopTimer();
+                                       LteInfoModel lte = Application.Current.FindResource("LteInfoModel") as LteInfoModel;
+                                       lte.StopTimer();
                                }
 
                 if (FrameSource.GetType().Equals(typeof(DslPage))) {
@@ -370,6 +377,8 @@ namespace SpeedportHybridControl.PageModel {
                }
 
                public MainWindowModel () {
+                       Title = string.Concat("Speedport Hybrid Konfigurationsprogramm", " (version ", VERSION, ")");
+
                        if (util.checkInstalled("Microsoft Visual C++ 2010  x86 Redistributable - 10.0.40219").Equals(false)) {
                                new Thread(() => { MessageBox.Show("Bitte installiere das 'Microsoft Visual C++ 2010 Redistributable Package' aus den ordner 'vcredis' um das programm vollständig benutzen zu können.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Warning); }).Start();
                        }
@@ -378,7 +387,6 @@ namespace SpeedportHybridControl.PageModel {
                                new Thread(() => { MessageBox.Show("Ein Update ist verfügbar.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Warning); }).Start();
                        }
 
-
                        changePage("login");
 
                        SwitchToLoginPage = new DelegateCommand(new Action(OnSwitchToLoginPageExecute));
index 0f77678d4ae5e8d68fbda028224814639923a06a..7ed6d6234925e94d38f17fa959ba4ed2aa31b292 100644 (file)
     <ApplicationIcon>t-com icon.ico</ApplicationIcon>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="DynamicDataDisplay, Version=0.3.0.1, Culture=neutral, PublicKeyToken=5b7d744a7263923f, processorArchitecture=MSIL">
+      <HintPath>..\packages\DynamicDataDisplay.0.3.0.1\lib\net45\DynamicDataDisplay.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
     <Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
       <HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
       <Private>True</Private>
@@ -63,6 +67,9 @@
       <SubType>Designer</SubType>
     </ApplicationDefinition>
     <Compile Include="Data\SpeedportHybrid.cs" />
+    <Compile Include="ltepopup.xaml.cs">
+      <DependentUpon>ltepopup.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Model\bonding_client.cs" />
     <Compile Include="Model\Connection.cs" />
     <Compile Include="Model\DeviceViewModel.cs" />
     <Compile Include="Model\StatusPhoneListModel.cs" />
     <Compile Include="PageModel\DslPageModel.cs" />
     <Compile Include="PageModel\LoginPageModel.cs" />
-    <Compile Include="Model\LTEViewModel.cs" />
+    <Compile Include="PageModel\LteInfoModel.cs" />
     <Compile Include="PageModel\MainWindowModel.cs" />
     <Compile Include="Model\PhoneCallViewModel.cs" />
     <Compile Include="Model\SuperViewModel.cs" />
     <Compile Include="Data\SpeedportHybridAPI.cs" />
+    <Page Include="ltepopup.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="MainWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
diff --git a/SpeedportHybridControl/ltepopup.xaml b/SpeedportHybridControl/ltepopup.xaml
new file mode 100644 (file)
index 0000000..cf17635
--- /dev/null
@@ -0,0 +1,52 @@
+<Window x:Class="SpeedportHybridControl.ltepopup"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:local="clr-namespace:SpeedportHybridControl"
+        mc:Ignorable="d"
+        xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0"
+        Height="423.4"
+        Width="530"
+        Closing="Window_Closing"
+        Title="LteInfo"
+        Icon="t-com icon.ico">
+    <!--
+    <Grid DataContext="{StaticResource LTE2}">
+        <ToggleButton Background="Transparent" BorderBrush="Transparent" x:Name="btnPin" HorizontalAlignment="Left" Margin="10,2,0,0" Height="20" VerticalAlignment="Top" Click="button_click">
+            <Image Source="assets/pin.png" x:Name="image" HorizontalAlignment="Left"  VerticalAlignment="Top"/>
+        </ToggleButton>
+        <ToggleButton x:Name="btnLog" Content="Log" HorizontalAlignment="Right" Margin="0,2,10,0" Height="20" VerticalAlignment="Top"/>
+        <TextBlock TextAlignment="Center" HorizontalAlignment="Left" Margin="54,2,0,0" TextWrapping="Wrap" Text="Cell ID" VerticalAlignment="Top" Width="85"/>
+        <TextBlock FontSize="20" TextAlignment="Center" HorizontalAlignment="Left" Margin="39,15,0,0" TextWrapping="Wrap" Text="{Binding cellid}" VerticalAlignment="Top" Width="122" Height="27"/>
+
+        <TextBlock TextAlignment="Center" HorizontalAlignment="Left" Margin="285,2,0,0" TextWrapping="Wrap" Text="Physical Cell ID" VerticalAlignment="Top" Width="85"/>
+        <TextBlock FontSize="20" TextAlignment="Center" HorizontalAlignment="Left" Margin="264,15,0,0" TextWrapping="Wrap" Text="{Binding phycellid}" VerticalAlignment="Top" Width="122" Height="27"/>
+
+
+        <TextBlock TextAlignment="Center" HorizontalAlignment="Left" Margin="76,57,0,0" TextWrapping="Wrap" Text="RSRQ" VerticalAlignment="Top" Width="85"/>
+        <TextBlock TextAlignment="Center" Background="{Binding rsrq_bg}" FontSize="100" HorizontalAlignment="Left" Margin="0,73,0,0" TextWrapping="Wrap" Text="{Binding rsrq}" VerticalAlignment="Top" Width="236" Height="127" />
+        <TextBlock TextAlignment="Center" HorizontalAlignment="Left" Margin="76,209,0,0" TextWrapping="Wrap" Text="RSRP" VerticalAlignment="Top" Width="85"/>
+        <TextBlock TextAlignment="Center" Background="{Binding rsrp_bg}" FontSize="100" HorizontalAlignment="Left" Margin="0,225,0,0" TextWrapping="Wrap" Text="{Binding rsrp}" VerticalAlignment="Top" Width="236" Height="138" />
+
+        <TextBlock Text="{Binding datetime}" HorizontalAlignment="Left" VerticalAlignment="Bottom" />
+
+        <d3:ChartPlotter x:Name="plotter" Margin="241,73,0,0" HorizontalAlignment="Left" Width="271" Height="147" VerticalAlignment="Top" HorizontalContentAlignment="Center"  VerticalContentAlignment="Center">
+            <d3:ChartPlotter.HorizontalAxis>
+                <d3:HorizontalDateTimeAxis Name="dateAxis"/>
+            </d3:ChartPlotter.HorizontalAxis>
+            <d3:VerticalAxisTitle FontFamily="Georgia" Content="RSRQ" />
+            <d3:HorizontalAxisTitle FontFamily="Georgia" Content="Date"/>
+        </d3:ChartPlotter>
+
+        <d3:ChartPlotter x:Name="plotter2" Margin="241,225,0,0" HorizontalAlignment="Left" Width="271" Height="159" VerticalAlignment="Top" HorizontalContentAlignment="Center"  VerticalContentAlignment="Center">
+            <d3:ChartPlotter.HorizontalAxis>
+                <d3:HorizontalDateTimeAxis Name="dateAxis2"/>
+            </d3:ChartPlotter.HorizontalAxis>
+            <d3:VerticalAxisTitle FontFamily="Georgia" Content="RSRP" />
+            <d3:HorizontalAxisTitle FontFamily="Georgia" Content="Date"/>
+        </d3:ChartPlotter>
+
+    </Grid>
+    -->
+</Window>
diff --git a/SpeedportHybridControl/ltepopup.xaml.cs b/SpeedportHybridControl/ltepopup.xaml.cs
new file mode 100644 (file)
index 0000000..d7d9117
--- /dev/null
@@ -0,0 +1,121 @@
+using System;
+using System.Windows;
+using System.Windows.Media;
+using System.Timers;
+using Microsoft.Research.DynamicDataDisplay.DataSources;
+using Microsoft.Research.DynamicDataDisplay;
+using Microsoft.Research.DynamicDataDisplay.Common;
+using System.ComponentModel;
+using System.IO;
+using SpeedportHybridControl.Data;
+using SpeedportHybridControl.Model;
+
+namespace SpeedportHybridControl {
+       public class LTECollection : RingArray<LTEData> {
+               private const int TOTAL_POINTS = 200;
+
+               public LTECollection () : base(TOTAL_POINTS) {
+               }
+       }
+
+       public class LTEData {
+               public DateTime Date { get; set; }
+
+               public int Data { get; set; }
+       }
+
+       /// <summary>
+       /// Interaction logic for Window1.xaml
+       /// </summary>
+       public partial class ltepopup : Window {
+               public Timer _timer;
+               public LTECollection lteCollection;
+               public LTECollection lteCollection2;
+
+               public ltepopup () {
+                       InitializeComponent();
+                       /*
+                       util.init("LTE2");
+
+                       lteCollection = new LTECollection();
+                       lteCollection2 = new LTECollection();
+
+                       var ds = new EnumerableDataSource<LTEData>(lteCollection);
+                       ds.SetXMapping(x => dateAxis.ConvertToDouble(x.Date));
+                       ds.SetYMapping(y => y.Data);
+                       plotter.AddLineGraph(ds, Colors.Green, 1, "rsrq");
+
+                       var ds2 = new EnumerableDataSource<LTEData>(lteCollection2);
+                       ds2.SetXMapping(x => dateAxis.ConvertToDouble(x.Date));
+                       ds2.SetYMapping(y => y.Data);
+                       plotter2.AddLineGraph(ds2, Colors.Green, 1, "rsrp");
+
+                       StartTimer();
+                       */
+               }
+
+               void Window_Closing (object sender, CancelEventArgs e) {
+                       //StopTimer();
+               }
+               /*
+               public void StopTimer () {
+                       if (Object.Equals(_timer, null).Equals(false)) {
+                               _timer.Stop();
+                       }
+               }
+
+               private void StartTimer () {
+                       _timer = new Timer {
+                               Interval = 1000, // every second
+                       };
+
+                       _timer.Elapsed += timer_Elapsed;
+                       _timer.Start();
+               }
+
+               private void log (string value) {
+                       DateTime time = DateTime.Now;
+
+                       if (Directory.Exists("log/").Equals(false))
+                               Directory.CreateDirectory("log/");
+
+                       if (Directory.Exists("log/lte/").Equals(false))
+                               Directory.CreateDirectory("log/lte/");
+
+                       StreamWriter file = new StreamWriter(string.Concat("log/lte/", time.ToString("dd.MM.yyyy"), ".txt"), true);
+                       file.WriteLine(string.Concat("[", time.ToString("dd.MM.yyyy HH:mm:ss"), "]: ", value));
+                       file.Close();
+               }
+
+               void timer_Elapsed (object sender, ElapsedEventArgs e) {
+                       new System.Threading.Thread(() => {
+                               util.init("LTE2");
+
+                               LTE lte = Application.Current.FindResource("LTE2") as LTE;
+                               int rsrq = lte.rsrq.ToInt();
+                               int rsrp = lte.rsrp.ToInt();
+                               Application.Current.Dispatcher.BeginInvoke(new Action(() => {
+                                       lteCollection.Add(new LTEData() { Date = DateTime.Now, Data = rsrq });
+                                       lteCollection2.Add(new LTEData() { Date = DateTime.Now, Data = rsrp });
+
+                                       if (btnLog.IsChecked.Equals(true)) {
+                                               // log
+                                               log(string.Concat("Pysical Cell ID: ", lte.phycellid, ", Cell ID: ", lte.cellid, ", RSRP: ", lte.rsrp, ", RSRQ: ", lte.rsrq));
+                                       }
+                               }));
+                       }).Start();
+               }
+
+               private void button_click (object sender, RoutedEventArgs e) {
+                       if (sender.Equals(btnPin)) {
+                               if (btnPin.IsChecked.Equals(true)) {
+                                       Topmost = true;
+                               }
+                               else {
+                                       Topmost = false;
+                               }
+                       }
+               }
+               */
+       }
+}
index 64b5d8efe5f41dbbde2d54b0095c19e3187d9546..6ef3f8f7578d572a2223b50112b3af7cdba26ee4 100644 (file)
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
+  <package id="DynamicDataDisplay" version="0.3.0.1" targetFramework="net452" />
   <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" />
 </packages>
\ No newline at end of file
index e91154ccf565115cf36fd700f12e696a986d49a3..2607d1790b2ebf96197a1e2643008a08bb5e93c6 100644 (file)
@@ -8,7 +8,7 @@
       Width="Auto" Height="Auto"
       Title="LteInfoPage">
 
-    <Grid DataContext="{StaticResource LTE}">
+    <Grid DataContext="{StaticResource LteInfoModel}">
         <GroupBox Header="LTE-parameter" HorizontalAlignment="Left" VerticalAlignment="Top">
             <Grid>
                 <StackPanel HorizontalAlignment="Left" Width="86">
                 </StackPanel>
             </Grid>
         </GroupBox>
-        <ToggleButton x:Name="autoreload" Content="Automatisch aktualisieren" HorizontalAlignment="Left" Margin="0,214,0,0" VerticalAlignment="Top" Click="button_click"/>
-        <Button x:Name="btnPopup" Content="Popup" HorizontalAlignment="Left" Margin="145,214,0,0" VerticalAlignment="Top" Click="button_click"/>
+        <ToggleButton Command="{Binding Path=AutoReloadCommand}" IsChecked="{Binding Path=AutoReload}" x:Name="autoreload" Content="Automatisch aktualisieren" HorizontalAlignment="Left" Margin="0,214,0,0" VerticalAlignment="Top"/>
+        <Button Command="{Binding Path=PopupCommand}" x:Name="btnPopup" Content="Popup" HorizontalAlignment="Left" Margin="145,214,0,0" VerticalAlignment="Top"/>
 
         <GroupBox Header="Einstelungen" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="188,209,0,0" Height="45" Width="284">
             <Grid>
                 <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Antennen Modus:" VerticalAlignment="Top"/>
-                <ComboBox x:Name="cbAntenna" SelectedValue="{Binding antenna_mode2}" SelectedValuePath="Name" HorizontalAlignment="Left" Width="91" Margin="101,1,0,0">
+                <ComboBox x:Name="cbAntenna" SelectedValue="{Binding antenna_mode2}" SelectedItem="{Binding Path=SelectedItem, Mode=TwoWay}" SelectedValuePath="Name" HorizontalAlignment="Left" Width="91" Margin="101,1,0,0">
                     <ComboBoxItem Content="Automatisch" Name="Auto" HorizontalAlignment="Left" Width="92"/>
                     <ComboBoxItem Content="Intern" Name="Inner" HorizontalAlignment="Left" Width="92"/>
                     <ComboBoxItem Content="Extern" Name="Outer" HorizontalAlignment="Left" Width="92"/>
                 </ComboBox>
-                <Button x:Name="btnSave" Content="Speichern" HorizontalAlignment="Left" Margin="197,1,0,2" Width="75" Click="button_click" />
+                <Button Command="{Binding Path=SaveCommand}" x:Name="btnSave" Content="Speichern" HorizontalAlignment="Left" Margin="197,1,0,2" Width="75"/>
             </Grid>
         </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 8284f62adfbf76e2aea5d319068ca4f033670c4b..dd407698f03e94ed154cf7a306ec0001362d4d98 100644 (file)
@@ -1,77 +1,12 @@
-using System.Windows;
-using System.Windows.Controls;
-using System.Timers;
-using System;
+using System.Windows.Controls;
 
 namespace SpeedportHybridControl.page {
-
-
        /// <summary>
        /// Interaction logic for LteInfoPage.xaml
        /// </summary>
        public partial class LteInfoPage : Page {
-               public Timer _timer;
-               //public ltepopup _ltepopup;
                public LteInfoPage() {
                        InitializeComponent();
                }
-
-               public void StopTimer () {
-                       if (Object.Equals(_timer, null).Equals(false)) {
-                               _timer.Stop();
-                       }
-
-                       if (autoreload.IsChecked.Equals(true)) {
-                               autoreload.IsChecked = false;
-                       }
-               }
-
-               private void StartTimer () {
-                       _timer = new Timer {
-                               Interval = 1000, // every second
-                       };
-
-                       _timer.Elapsed += timer_Elapsed;
-                       _timer.Start();
-               }
-
-               void timer_Elapsed (object sender, ElapsedEventArgs e) {
-                       //util.init("LTE");
-               }
-
-               private void button_click(object sender, RoutedEventArgs e) {
-                       /*
-                       if (sender.Equals(reload)) {
-                               util.init("LTE");
-                       }
-                       else if (sender.Equals(autoreload)) {
-                               if (autoreload.IsChecked.Equals(true)) {
-                                       StartTimer();
-                               }
-                               else {
-                                       StopTimer();
-                               }
-                       }
-                       else if (sender.Equals(btnSave)) {
-                               ComboBoxItem item = cbAntenna.SelectedItem as ComboBoxItem;
-                               SpeedportHybridAPI.getInstance().setAntennaMode(item.Name);
-                               util.init("LTE");
-                       }
-                       else if (sender.Equals(btnPopup)) {
-                               if (Object.Equals(_ltepopup, null)) {
-                                       _ltepopup = new ltepopup();
-                               }
-                               else if (Object.Equals(_ltepopup, null).Equals(false) && _ltepopup.IsLoaded.Equals(false)) {
-                                       _ltepopup = null;
-                                       _ltepopup = new ltepopup();
-                               }
-
-                               if (_ltepopup.Visibility.Equals(Visibility.Visible).Equals(false)) {
-                                       _ltepopup.Show();
-                                       StopTimer();
-                               }
-                       }
-                       */
-               }
        }
 }