summaryrefslogtreecommitdiff
path: root/windows
diff options
context:
space:
mode:
Diffstat (limited to 'windows')
-rw-r--r--windows/WinUI/MainWindow.xaml.cs40
1 files changed, 36 insertions, 4 deletions
diff --git a/windows/WinUI/MainWindow.xaml.cs b/windows/WinUI/MainWindow.xaml.cs
index afe6947c..4e7638b6 100644
--- a/windows/WinUI/MainWindow.xaml.cs
+++ b/windows/WinUI/MainWindow.xaml.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
+using System.Timers;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
@@ -13,6 +14,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
+using System.Windows.Threading;
namespace WinUI
{
@@ -25,6 +27,8 @@ namespace WinUI
Regex charRegex = new Regex("[0-9a-fxA-FX]");
Regex wholeStringRegex = new Regex("^[0-9a-fxA-FX]+$");
+ Timer timer = new Timer();
+
public MainWindow()
{
InitializeComponent();
@@ -33,22 +37,50 @@ namespace WinUI
updateNetworks();
DataObject.AddPastingHandler(joinNetworkID, OnPaste);
+
+ timer.Elapsed += new ElapsedEventHandler(OnUpdateTimer);
+ timer.Interval = 2000;
+ timer.Enabled = true;
}
private void updateStatus()
{
var status = handler.GetStatus();
- this.networkId.Content = status.Address;
- this.versionString.Content = status.Version;
- this.onlineStatus.Content = (status.Online ? "ONLINE" : "OFFLINE");
+ networkId.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
+ {
+ this.networkId.Content = status.Address;
+ }));
+ versionString.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
+ {
+ this.versionString.Content = status.Version;
+ }));
+ onlineStatus.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
+ {
+ this.onlineStatus.Content = (status.Online ? "ONLINE" : "OFFLINE");
+ }));
}
private void updateNetworks()
{
var networks = handler.GetNetworks();
- networksPage.setNetworks(networks);
+ networksPage.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
+ {
+ networksPage.setNetworks(networks);
+ }));
+ }
+
+ private void updatePeers()
+ {
+
+ }
+
+ private void OnUpdateTimer(object source, ElapsedEventArgs e)
+ {
+ updateStatus();
+ updateNetworks();
+ updatePeers();
}
private void joinButton_Click(object sender, RoutedEventArgs e)