1
0
Fork 0
A UWP dashboard which provides live updates for the 'Personal Flash in Real-Time (Andy)' and 'Personal Flash in Real-Time (Tony)' artworks -- part of the 'Return to Ritherdon' project by Nicola Ellis. Documentation can be found at https://git.abbether.net/return-to-ritherdon/rtr-docs/src/branch/master/eyes-and-ears
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

58 lines
2.1 KiB

using EyesAndEars.UWP.Services;
using EyesAndEars.UWP.ViewModels;
using System;
using System.Diagnostics;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace EyesAndEars.UWP {
public sealed partial class MainPage : Page {
MainPageVM _vm = new MainPageVM();
DispatcherTimer _dispatcherTimer = new DispatcherTimer();
public MainPage() {
InitializeComponent();
IntialiseDataContext();
IntialiseRefreshTime();
}
void IntialiseDataContext() {
var url = WebAddressBox.Text;
_vm.Device1 = DataServices.CreateFallBackDevice(1);
_vm.Device2 = DataServices.CreateFallBackDevice(2);
_vm.Device3 = DataServices.CreateFallBackDevice(3);
_vm.Device4 = DataServices.CreateFallBackDevice(4);
_vm.Device5 = DataServices.CreateFallBackDevice(5);
_vm.Device6 = DataServices.CreateFallBackDevice(6);
DataContext = _vm;
}
void IntialiseRefreshTime() {
// TimeSpan Intervals: Days, Hours, Minutes, Seconds, Milliseconds.
_dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 1, 0);
_dispatcherTimer.Tick += UpdateViewModel;
_dispatcherTimer.Start();
}
async void UpdateViewModel(object sender, object e) {
var url = WebAddressBox.Text;
_vm.Device1 = await DataServices.UpdateDevice(url, 1);
_vm.Device2 = await DataServices.UpdateDevice(url, 2);
_vm.Device3 = await DataServices.UpdateDevice(url, 3);
_vm.Device4 = await DataServices.UpdateDevice(url, 4);
_vm.Device5 = await DataServices.UpdateDevice(url, 5);
_vm.Device6 = await DataServices.UpdateDevice(url, 6);
}
async void RefreshButton_Click(object sender, RoutedEventArgs e) {
// GET THE INITIALISATION WORKING FIRST AND THE DEFAULT CYCLE...
}
void SaveURLButton_Click(object sender, RoutedEventArgs e) {
// WORK ON THIS WENT YOU HAVE A LIVE SYSTEM WORKING WITH KNOWABLE DEFAULTS.
}
}
}