update About page
authorStricted <info@stricted.de>
Wed, 11 Nov 2015 23:05:30 +0000 (00:05 +0100)
committerStricted <info@stricted.de>
Wed, 11 Nov 2015 23:05:30 +0000 (00:05 +0100)
SpeedportHybridControl/App.xaml
SpeedportHybridControl/PageModel/AboutPageModel.cs [new file with mode: 0644]
SpeedportHybridControl/SpeedportHybridControl.csproj
SpeedportHybridControl/page/AboutPage.xaml
SpeedportHybridControl/page/AboutPage.xaml.cs

index d510c233b2374eed82d6041bc2e9fdf4cda4fa24..34c0c8c62d6a80331808e4f6259c0127c0647c4d 100644 (file)
@@ -19,6 +19,7 @@
             <pagemodel:PhonePageModel x:Key="PhonePageModel"></pagemodel:PhonePageModel>
             <pagemodel:LanPageModel x:Key="LanPageModel"></pagemodel:LanPageModel>
             <pagemodel:ControlsPageModel x:Key="ControlsPageModel"></pagemodel:ControlsPageModel>
+            <pagemodel:AboutPageModel x:Key="AboutPageModel"></pagemodel:AboutPageModel>
         </ResourceDictionary>
     </Application.Resources>
 </Application>
diff --git a/SpeedportHybridControl/PageModel/AboutPageModel.cs b/SpeedportHybridControl/PageModel/AboutPageModel.cs
new file mode 100644 (file)
index 0000000..05e42d5
--- /dev/null
@@ -0,0 +1,52 @@
+using System;
+using SpeedportHybridControl.Model;
+using SpeedportHybridControl.Implementations;
+using System.Diagnostics;
+using System.Threading;
+using System.Windows;
+
+namespace SpeedportHybridControl.PageModel {
+       class AboutPageModel : SuperViewModel {
+               private DelegateCommand _donateCommand;
+               private DelegateCommand _bugtrackerCommand;
+               private DelegateCommand _updateCommand;
+
+               public DelegateCommand DonateCommand {
+                       get { return _donateCommand; }
+                       set { SetProperty(ref _donateCommand, value); }
+               }
+
+               public DelegateCommand BugtrackerCommand {
+                       get { return _bugtrackerCommand; }
+                       set { SetProperty(ref _bugtrackerCommand, value); }
+               }
+
+               public DelegateCommand UpdateCommand {
+                       get { return _updateCommand; }
+                       set { SetProperty(ref _updateCommand, value); }
+               }
+
+               private void OnDonateCommandExecute () {
+                       Process.Start("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=E7EBAC5NP928J");
+               }
+
+               private void OnBugtrackerCommandExecute () {
+                       Process.Start("https://stricted.net/bugtracker/index.php/ProductList/");
+               }
+
+               private void OnUpdateCommandExecute () {
+                       if (util.checkUpdate(MainWindowModel.VERSION).Equals(true)) {
+                               new Thread(() => { MessageBox.Show("Ein Update ist verfügbar.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Warning); }).Start();
+                       }
+                       else {
+                               new Thread(() => { MessageBox.Show("SpeedportHybridControl ist auf dem neuesten Stand.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
+                       }
+               }
+
+               public AboutPageModel () {
+                       DonateCommand = new DelegateCommand(new Action(OnDonateCommandExecute));
+                       BugtrackerCommand = new DelegateCommand(new Action(OnBugtrackerCommandExecute));
+                       UpdateCommand = new DelegateCommand(new Action(OnUpdateCommandExecute));
+               }
+       }
+}
index c1957de423de6ea0f58a05d0e351a4e6039c47be..8b325186ee127b203ed7a9a941848e71aa4bdaa0 100644 (file)
@@ -77,6 +77,7 @@
     <Compile Include="Model\PhoneCallList.cs" />
     <Compile Include="Model\StatusPhoneList.cs" />
     <Compile Include="Model\SyslogList.cs" />
+    <Compile Include="PageModel\AboutPageModel.cs" />
     <Compile Include="PageModel\ControlsPageModel.cs" />
     <Compile Include="PageModel\DslPageModel.cs" />
     <Compile Include="PageModel\LanPageModel.cs" />
index 89249645fe7191bf0c4b2c9b7643095bed2f5a4e..405c994f3ad66bf308f33bbdab9333d106e5af68 100644 (file)
@@ -8,18 +8,18 @@
       Width="Auto" Height="Auto"
       Title="AboutPage">
 
-    <Grid>
+    <Grid DataContext="{StaticResource AboutPageModel}">
         <TextBlock HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="SpeedportHybridControl" VerticalAlignment="Top"/>
         <TextBlock HorizontalAlignment="Left" Margin="10,31,0,0" TextWrapping="Wrap" Text="Copyright © 2015 stricted.net" VerticalAlignment="Top"/>
 
         <TextBlock HorizontalAlignment="Left" Margin="10,52,0,0" TextWrapping="Wrap" Text="Version:" VerticalAlignment="Top"/>
         <TextBlock x:Name="tbVersion" HorizontalAlignment="Left" Margin="57,52,0,0" TextWrapping="Wrap" VerticalAlignment="Top"/>
 
-        <Button x:Name="btnBugtracker" Content="Bugtracker" HorizontalAlignment="Left" Margin="10,0,0,10" VerticalAlignment="Bottom" Click="button_click"/>
-        <Button x:Name="btnUpdate" Content="Auf Update prüfen" HorizontalAlignment="Left" Margin="10,73,0,0" VerticalAlignment="Top" Click="button_click"/>
+        <Button Command="{Binding Path=BugtrackerCommand}" x:Name="btnBugtracker" Content="Bugtracker" HorizontalAlignment="Left" Margin="10,0,0,10" VerticalAlignment="Bottom"/>
+        <Button Command="{Binding Path=UpdateCommand}" x:Name="btnUpdate" Content="Auf Update prüfen" HorizontalAlignment="Left" Margin="10,73,0,0" VerticalAlignment="Top" />
 
 
-        <Button x:Name="btnDonate" BorderBrush="Transparent" Background="Transparent" HorizontalAlignment="Right" Width="106" Height="48" VerticalAlignment="Bottom" Click="button_click" Margin="0,0,10,10">
+        <Button Command="{Binding Path=DonateCommand}" x:Name="btnDonate" BorderBrush="Transparent" Background="Transparent" HorizontalAlignment="Right" Width="106" Height="48" VerticalAlignment="Bottom" Margin="0,0,10,10">
             <Image Source="../assets/btn_donateCC_LG.gif" x:Name="image" HorizontalAlignment="Left"  VerticalAlignment="Top"/>
         </Button>
     </Grid>
index f81bdef0fbf50e8934ef01bac27a723f1b686bb5..dbc6581856b9b53b38c0e3704c82916d6ff4f313 100644 (file)
@@ -1,7 +1,4 @@
-using System.Diagnostics;
-using System.Windows;
-using System.Windows.Controls;
-using System.Threading;
+using System.Windows.Controls;
 
 namespace SpeedportHybridControl.page {
        /// <summary>
@@ -10,26 +7,6 @@ namespace SpeedportHybridControl.page {
        public partial class AboutPage : Page {
                public AboutPage () {
                        InitializeComponent();
-                       //tbVersion.Text = MainWindow.VERSION;
         }
-
-               private void button_click (object sender, RoutedEventArgs e) {
-                       /*
-                       if (sender.Equals(btnDonate)) {
-                               Process.Start("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=E7EBAC5NP928J");
-                       }
-                       else if (sender.Equals(btnBugtracker)) {
-                               Process.Start("https://stricted.net/bugtracker/index.php/ProductList/");
-                       }
-                       else if (sender.Equals(btnUpdate)) {
-                               if (util.checkUpdate().Equals(true)) {
-                                       new Thread(() => { MessageBox.Show("Ein Update ist verfügbar.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Warning); }).Start();
-                               }
-                               else {
-                                       new Thread(() => { MessageBox.Show("SpeedportHybridControl ist auf dem neuesten Stand.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); }).Start();
-                               }
-            }
-                       */
-               }
        }
 }