Example #1
0
        public AddDevicePage()
        {
            this.InitializeComponent();
            tbIP.Focus(Windows.UI.Xaml.FocusState.Keyboard);

            SessionManager.GetVMStart(vm => UI.Invoke(() => DataContext = StartVM = vm));
        }
Example #2
0
        public static void SaveState(VMStart model, Action OnSaveFinished)
        {
            if (null == model)
            {
                return;
            }
            //-- Do not save any invalid devices (i.e. any that are invalid or are currently loading)
            var devices = model._Devices.Select(d => d.Device).Where(d => !d.InvalidDevice).ToArray();

            WriteFile(devices, VMStartKey, OnSaveFinished);
        }
Example #3
0
 /// <summary>
 /// Invoked when this page is about to be displayed in a Frame.
 /// </summary>
 /// <param name="e">Event data that describes how this page was reached.  The Parameter
 /// property is typically used to configure the page.</param>
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     if (SessionManager.AddedDevice == null)
     {
         return;
     }
     else
     {
         SessionManager.GetVMStart(vm => UI.Invoke(() =>
         {
             DataContext = StartVM = vm;
             StartVM.TryAdd(SessionManager.AddedDevice);
             SessionManager.AddedDevice = null;                     //-- Reset added device
         }));
     }
 }
Example #4
0
        public StartPage()
        {
            InitializeComponent();

            SessionManager.GetVMStart(vm =>
            {
                UI.Invoke(() =>
                {
                    DataContext     = StartVM = vm;
                    statusIndicator = new ProgressIndicator();
                    statusIndicator.IsIndeterminate = true;
                    statusIndicator.Text            = StartVM.AddingDeviceStatus;
                    statusIndicator.IsVisible       = false;
                    SystemTray.SetProgressIndicator(this, statusIndicator);

                    //-- If we have no devices when this page loads, try to find some.
                    if (StartVM._Devices.Count == 0)
                    {
                        Search_Click(this, EventArgs.Empty);
                    }
                });
            });
        }
Example #5
0
        private void RunnerImp(string ipOrHostname, string deviceName, Action <bool> OnFinished)
        {
            if (!IsStarted)
            {
                Startup();
            }

            IsNotRunning = false;

            var d = new Device(ipOrHostname, deviceName);
            var c = new Controller(d);


            Message = "Trying to connect to the device . . . ";
            //-- Ensure the IP is accurate
            c.TrySetDevice(d, result =>
            {
                if (!result.Success)
                {
                    Message = @"There was a problem connecting to the device. Please ensure the IP or Hostname is accurate, you're connected to the same network as the device and Network Standby on the device is set to On.";
                    UI.Invoke(OnFinished, false);
                    IsNotRunning = true;
                    return;
                }

                //-- Attempt To Load
                var start = new VMStart(new Device[] { d });
                var dvm   = start.Devices[0];

                Message = "Attempting to load device . . .";

                start.Refresh();

                IsIndeterminite = false;

                Message = "Loading . . . ";
                while (dvm.IsLoading)
                {
                    PercentageComplete = dvm.PercentageLoaded;
                    Message            = dvm.LoadingMessage;
                    Thread.Sleep(100);
                }

                Message         = "Device loaded. Refreshing zone.";
                IsIndeterminite = true;

                //- Attempt to Refresh Selected Zone
                var mainVM = new VMMain(c);
                mainVM.SelectedZone.Refresh(() =>
                {
                    Message = "Device refresh success. Saving results . . .";

                    var data = SaveSessions(deviceName);

                    Message = "Save results success. Sending results . . .";

                    SimpleMailer.SendMail("*****@*****.**", "Diagnostics", "Diagnostics for " + deviceName, data);

                    File.Delete(data); //-- If we successfully sent the e-mail, no reason to hold on to this file on the desktop.

                    Shutdown();

                    PercentageComplete = 1;
                    IsIndeterminite    = false;

                    Message = "Finished.";
                    UI.Invoke(OnFinished, true);
                    IsNotRunning = true;
                });
            });
        }
Example #6
0
        public StartPage()
        {
            this.InitializeComponent();

            SessionManager.GetVMStart(vm => UI.Invoke(() => DataContext = StartVM = vm));
        }