<pagemodel:TR181PageModel x:Key="TR181PageModel"></pagemodel:TR181PageModel>
<pagemodel:PhonePageModel x:Key="PhonePageModel"></pagemodel:PhonePageModel>
<pagemodel:LanPageModel x:Key="LanPageModel"></pagemodel:LanPageModel>
+ <pagemodel:InterfacePageModel x:Key="InterfacePageModel"></pagemodel:InterfacePageModel>
<pagemodel:ControlsPageModel x:Key="ControlsPageModel"></pagemodel:ControlsPageModel>
<pagemodel:AboutPageModel x:Key="AboutPageModel"></pagemodel:AboutPageModel>
<pagemodel:ltepopupModel x:Key="ltepopupModel"></pagemodel:ltepopupModel>
LogManager.WriteToLog(ex.Message);
}
}
+
+ public static void initInterface () {
+ try {
+ if (SpeedportHybridAPI.getInstance().checkLogin().Equals(false))
+ return;
+
+ InterfacePageModel IPM = Application.Current.FindResource("InterfacePageModel") as InterfacePageModel;
+
+ string response = SpeedportHybridAPI.getInstance().sendEnryptedRequest("data/interfaces.json");
+ if (response.IsNullOrEmpty())
+ return;
+
+ JToken jArray = JToken.Parse(response);
+ response = null;
+
+ List<InterfaceList> interfaceList = new List<InterfaceList>();
+ foreach (JToken jToken in jArray.SelectToken("line_status")) {
+ string ifc = jToken.SelectToken("interface").ToString();
+ string mtu = jToken.SelectToken("MTU").ToString();
+ string tx_packets = jToken.SelectToken("tx_packets").ToString();
+ string tx_errors = jToken.SelectToken("tx_errors").ToString();
+ string rx_packets = jToken.SelectToken("rx_packets").ToString();
+ string rx_errors = jToken.SelectToken("rx_errors").ToString();
+ string collisions = jToken.SelectToken("collisions").ToString();
+
+ interfaceList.Add(new InterfaceList() { ifc = ifc, mtu = mtu, tx_packets = tx_packets, tx_errors = tx_errors, rx_packets = rx_packets, rx_errors = rx_errors, collisions = collisions });
+ }
+
+ IPM.interfaceList = interfaceList;
+
+ interfaceList = null;
+ jArray = null;
+
+ DateTime time = DateTime.Now;
+ string format = "dd.MM.yyyy HH:mm:ss";
+ IPM.datetime = time.ToString(format);
+ }
+ catch (Exception ex) {
+ LogManager.WriteToLog(ex.Message);
+ }
+ }
}
}
<Button Command="{Binding Path=SwitchToTR181Page}" IsEnabled="{Binding Path=ButtonTR181PageIsActive}" Background="{Binding Path=ButtonTR181PageBackground}" x:Name="btnTR181" Content="TR-181"/>
<Button Command="{Binding Path=SwitchToPhonePage}" IsEnabled="{Binding Path=ButtonPhonePageIsActive}" Background="{Binding Path=ButtonPhonePageBackground}" x:Name="btnPhone" Content="Anrufe"/>
<Button Command="{Binding Path=SwitchToLanPage}" IsEnabled="{Binding Path=ButtonLanPageIsActive}" Background="{Binding Path=ButtonLanPageBackground}" x:Name="btnLan" Content="Lan"/>
+ <Button Command="{Binding Path=SwitchToInterfacePage}" IsEnabled="{Binding Path=ButtonInterfacePageIsActive}" Background="{Binding Path=ButtonInterfacePageBackground}" x:Name="btnInterface" Content="Interface"/>
<Button Command="{Binding Path=SwitchToControlsPage}" IsEnabled="{Binding Path=ButtonControlsPageIsActive}" Background="{Binding Path=ButtonControlsPageBackground}" x:Name="btnControls" Content="Controls"/>
</StackPanel>
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SpeedportHybridControl.Model {
+ class InterfaceList : SuperViewModel {
+ private string _ifc;
+ private string _mtu;
+ private string _tx_packets;
+ private string _tx_errors;
+ private string _rx_packets;
+ private string _rx_errors;
+ private string _collisions;
+
+ public string ifc {
+ get { return _ifc; }
+ set { SetProperty(ref _ifc, value); }
+ }
+
+ public string mtu
+ {
+ get { return _mtu; }
+ set { SetProperty(ref _mtu, value); }
+ }
+
+ public string tx_packets
+ {
+ get { return _tx_packets; }
+ set { SetProperty(ref _tx_packets, value); }
+ }
+
+ public string tx_errors
+ {
+ get { return _tx_errors; }
+ set { SetProperty(ref _tx_errors, value); }
+ }
+
+ public string rx_packets
+ {
+ get { return _rx_packets; }
+ set { SetProperty(ref _rx_packets, value); }
+ }
+
+ public string rx_errors
+ {
+ get { return _rx_errors; }
+ set { SetProperty(ref _rx_errors, value); }
+ }
+
+ public string collisions
+ {
+ get { return _collisions; }
+ set { SetProperty(ref _collisions, value); }
+ }
+ }
+}
--- /dev/null
+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;
+
+namespace SpeedportHybridControl.PageModel {
+ class InterfacePageModel : SuperViewModel {
+ private DelegateCommand _reloadCommand;
+ private List<InterfaceList> _interfaceList;
+ private string _datetime;
+
+ public DelegateCommand ReloadCommand
+ {
+ get { return _reloadCommand; }
+ set { SetProperty(ref _reloadCommand, value); }
+ }
+
+ public List<InterfaceList> interfaceList
+ {
+ get { return _interfaceList; }
+ set { SetProperty(ref _interfaceList, value); }
+ }
+
+ public string datetime
+ {
+ get { return _datetime; }
+ set { SetProperty(ref _datetime, value); }
+ }
+
+ private void OnReloadCommandExecute () {
+ new Thread(() => { SpeedportHybrid.initInterface(); }).Start();
+ }
+
+ public InterfacePageModel () {
+ ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
+ }
+ }
+}
mwm.ButtonTR181PageIsActive = true;
mwm.ButtonPhonePageIsActive = true;
mwm.ButtonLanPageIsActive = true;
+ mwm.ButtonInterfacePageIsActive = true;
mwm.ButtonControlsPageIsActive = true;
LoginButtonText = "Logout";
mwm.ButtonTR181PageIsActive = false;
mwm.ButtonPhonePageIsActive = false;
mwm.ButtonLanPageIsActive = false;
+ mwm.ButtonInterfacePageIsActive = false;
mwm.ButtonControlsPageIsActive = false;
LoginButtonText = "Login";
private DelegateCommand _switchToTR181Page;
private DelegateCommand _switchToPhonePage;
private DelegateCommand _switchToLanPage;
+ private DelegateCommand _switchToInterfacePage;
private DelegateCommand _switchToControlsPage;
private DelegateCommand _sitchToAboutPage;
private bool _buttonTR181PageIsActive = false;
private bool _buttonPhonePageIsActive = false;
private bool _buttonLanPageIsActive = false;
+ private bool _buttonInterfacePageIsActive = false;
private bool _buttonControlsPageIsActive = false;
private Brush _buttonLoginPageBackground = Brushes.LightGray;
private Brush _buttonTR181PageBackground = Brushes.LightGray;
private Brush _buttonPhonePageBackground = Brushes.LightGray;
private Brush _buttonLanPageBackground = Brushes.LightGray;
+ private Brush _buttonInterfacePageBackground = Brushes.LightGray;
private Brush _buttonControlsPageBackground = Brushes.LightGray;
private Brush _buttonAboutPageBackground = Brushes.LightGray;
set { SetProperty(ref _switchToLanPage, value); }
}
+ public DelegateCommand SwitchToInterfacePage
+ {
+ get { return _switchToInterfacePage; }
+ set { SetProperty(ref _switchToInterfacePage, value); }
+ }
+
public DelegateCommand SwitchToControlsPage {
get { return _switchToControlsPage; }
set { SetProperty(ref _switchToControlsPage, value); }
set { SetProperty(ref _buttonLanPageIsActive, value); }
}
+ public bool ButtonInterfacePageIsActive
+ {
+ get { return _buttonInterfacePageIsActive; }
+ set { SetProperty(ref _buttonInterfacePageIsActive, value); }
+ }
+
public bool ButtonControlsPageIsActive {
get { return _buttonControlsPageIsActive; }
set { SetProperty(ref _buttonControlsPageIsActive, value); }
set { SetProperty(ref _buttonLanPageBackground, value); }
}
+ public Brush ButtonInterfacePageBackground
+ {
+ get { return _buttonInterfacePageBackground; }
+ set { SetProperty(ref _buttonInterfacePageBackground, value); }
+ }
+
public Brush ButtonControlsPageBackground {
get { return _buttonControlsPageBackground; }
set { SetProperty(ref _buttonControlsPageBackground, value); }
new Thread(() => { SpeedportHybrid.initLan(); }).Start();
}
+ private void OnSwitchToInterfacePageExecute () {
+ changePage("interface");
+ new Thread(() => { SpeedportHybrid.initInterface(); }).Start();
+ }
+
private void OnSwitchToControlsPageExecute () {
changePage("controls");
}
else if (page.Equals("lan")) {
FrameSource = new LanPage();
}
+ else if (page.Equals("interface")) {
+ FrameSource = new InterfacePage();
+ }
else if (page.Equals("controls")) {
FrameSource = new ControlsPage();
}
ButtonTR181PageBackground = Brushes.LightGray;
ButtonPhonePageBackground = Brushes.LightGray;
ButtonLanPageBackground = Brushes.LightGray;
+ ButtonInterfacePageBackground = Brushes.LightGray;
ButtonControlsPageBackground = Brushes.LightGray;
ButtonAboutPageBackground = Brushes.LightGray;
ButtonLanPageBackground = Brushes.LightGreen;
}
+ if (page.Equals("interface")) {
+ ButtonInterfacePageBackground = Brushes.LightGreen;
+ }
+
if (page.Equals("controls")) {
ButtonControlsPageBackground = Brushes.LightGreen;
}
SwitchToTR181Page = new DelegateCommand(new Action(OnSwitchToTR181PageExecute));
SwitchToPhonePage = new DelegateCommand(new Action(OnSwitchToPhonePageExecute));
SwitchToLanPage = new DelegateCommand(new Action(OnSwitchToLanPageExecute));
+ SwitchToInterfacePage = new DelegateCommand(new Action(OnSwitchToInterfacePageExecute));
SwitchToControlsPage = new DelegateCommand(new Action(OnSwitchToControlsPageExecute));
SwitchToAboutPage = new DelegateCommand(new Action(OnSwitchToAboutPageExecute));
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Windows" />
- <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Compile Include="Model\bonding_client.cs" />
<Compile Include="Model\Connection.cs" />
<Compile Include="Model\DeviceList.cs" />
+ <Compile Include="Model\InterfaceList.cs" />
<Compile Include="Model\Line.cs" />
<Compile Include="Model\LTECollection.cs" />
<Compile Include="Model\LTEData.cs" />
<Compile Include="PageModel\AboutPageModel.cs" />
<Compile Include="PageModel\ControlsPageModel.cs" />
<Compile Include="PageModel\DslPageModel.cs" />
+ <Compile Include="PageModel\InterfacePageModel.cs" />
<Compile Include="PageModel\LanPageModel.cs" />
<Compile Include="PageModel\LoginPageModel.cs" />
<Compile Include="PageModel\LteInfoModel.cs" />
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
+ <Page Include="page\InterfacePage.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="page\LanPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<Compile Include="page\DslPage.xaml.cs">
<DependentUpon>DslPage.xaml</DependentUpon>
</Compile>
+ <Compile Include="page\InterfacePage.xaml.cs">
+ <DependentUpon>InterfacePage.xaml</DependentUpon>
+ </Compile>
<Compile Include="page\LanPage.xaml.cs">
<DependentUpon>LanPage.xaml</DependentUpon>
</Compile>
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"
- xmlns:ig="http://schemas.infragistics.com/xaml"
- xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
+ mc:Ignorable="d"
Height="423.4"
Width="530"
Title="LteInfo"
+ Closing="Window_Closing"
DataContext="{StaticResource ltepopupModel}"
Topmost="{Binding Path=Topmost}"
Icon="t-com icon.ico">
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="Closing">
- <i:InvokeCommandAction Command="{Binding CloseWindowCommand}" />
- </i:EventTrigger>
- </i:Interaction.Triggers>
<Grid>
<ToggleButton Command="{Binding Path=PinCommand}" IsChecked="{Binding Path=PinActive, Mode=TwoWay}" Background="Transparent" BorderBrush="Transparent" x:Name="btnPin" HorizontalAlignment="Left" Margin="10,2,0,0" Height="20" VerticalAlignment="Top">
<Image Source="assets/pin.png" x:Name="image" HorizontalAlignment="Left" VerticalAlignment="Top"/>
-using System.Windows;
+using SpeedportHybridControl.PageModel;
+using System.Windows;
namespace SpeedportHybridControl {
/// <summary>
public ltepopup () {
InitializeComponent();
}
+
+ // quick & dirty
+ private void Window_Closing (object sender, System.ComponentModel.CancelEventArgs e) {
+ ltepopupModel lm = Application.Current.FindResource("ltepopupModel") as ltepopupModel;
+ lm.StopTimer();
+ }
}
}
--- /dev/null
+<Page x:Class="SpeedportHybridControl.page.InterfacePage"
+ 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:local="clr-namespace:SpeedportHybridControl"
+ mc:Ignorable="d"
+ Width="514" Height="287"
+ Title="InterfacePage">
+
+ <Grid DataContext="{StaticResource InterfacePageModel}">
+ <ListView ItemsSource="{Binding interfaceList}" x:Name="listView4" Margin="0,0,0,39">
+ <ListView.Resources>
+ <Style TargetType="{x:Type GridViewColumnHeader}">
+ <Setter Property="HorizontalContentAlignment" Value="Left" />
+ </Style>
+ </ListView.Resources>
+ <ListView.View>
+ <GridView>
+ <GridViewColumn TextBlock.TextAlignment="Left" Header="Interface" DisplayMemberBinding="{Binding Path=ifc}" Width="Auto"/>
+ <GridViewColumn TextBlock.TextAlignment="Left" Header="MTU" DisplayMemberBinding="{Binding Path=mtu}" Width="Auto"/>
+ <GridViewColumn TextBlock.TextAlignment="Left" Header="Out_Frames" DisplayMemberBinding="{Binding Path=tx_packets}" Width="Auto"/>
+ <GridViewColumn TextBlock.TextAlignment="Left" Header="Out_Errors" DisplayMemberBinding="{Binding Path=tx_errors}" Width="Auto"/>
+ <GridViewColumn TextBlock.TextAlignment="Left" Header="In_Frames" DisplayMemberBinding="{Binding Path=rx_packets}" Width="Auto"/>
+ <GridViewColumn TextBlock.TextAlignment="Left" Header="In_Errors" DisplayMemberBinding="{Binding Path=rx_errors}" Width="Auto"/>
+ <GridViewColumn TextBlock.TextAlignment="Left" Header="Collisions" DisplayMemberBinding="{Binding Path=collisions}" Width="Auto"/>
+ </GridView>
+ </ListView.View>
+ </ListView>
+
+ <TextBlock Text="{Binding datetime}" Margin="0,0,10,0" HorizontalAlignment="Right" VerticalAlignment="Bottom" />
+
+ <Button Command="{Binding Path=ReloadCommand}" x:Name="reload" Content="Aktualisieren" Margin="218,0,218,0" VerticalAlignment="Bottom"/>
+ </Grid>
+</Page>
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace SpeedportHybridControl.page {
+ /// <summary>
+ /// Interaktionslogik für InterfacePage.xaml
+ /// </summary>
+ public partial class InterfacePage : Page {
+ public InterfacePage () {
+ InitializeComponent();
+ }
+ }
+}