Beispiel #1
0
        public void SelectScene(Scene scene, Action onFinished)
        {
            SaveOld();

            TheController.SelectScene(TheZone, scene, result =>
            {
                //-- For Scenes, we need to figure out which input
                // corresponds to the scene. So we update the zone after
                // we successfully selected the scene.
                if (result.Success)
                {
                    TheController.RefreshZone(TheZone, UpdateResult =>
                    {
                        if (!UpdateResult.Success)
                        {
                            RestoreToOld();
                            return;
                        }

                        //-- If we successfully updated the zone we
                        // can refresh this VM then.
                        UI.Invoke(() =>
                        {
                            RefreshVM();
                            onFinished.NullableInvoke();
                        });
                    });
                    return;
                }

                RestoreToOld();
            });
        }
        public void PostScanHook(String ScanValue)
        {
            char[] delim = { '|' };
            // NOTE: the main thread will
            // after scanning
            // Update the barcode in the ExoNetUT object
            TheController.SaveBarCodeValue(TopIndex, ScanValue);
            //Update the UI: Necessary to do this here.
            StatusLabelCombo LabelStatus = new StatusLabelCombo();

            LabelStatus.LabelBox = "";
            LabelStatus.Status   = "";
            UpdateUI(LabelStatus);

            // update the status and commitPersist(rundone.txt) of this EN to file
            LastLabel = TheController.GetLabel(TopIndex).Trim(delim);
            // print label at the end of commiting
            LabelPrinter.PrintLabel(
                LastLabel.Split(delim, StringSplitOptions.RemoveEmptyEntries)[0],
                LastLabel.Split(delim, StringSplitOptions.RemoveEmptyEntries)[1]
                );
            LabelPrinter.PrintLabel(
                LastLabel.Split(delim, StringSplitOptions.RemoveEmptyEntries)[0],
                LastLabel.Split(delim, StringSplitOptions.RemoveEmptyEntries)[1]
                );
        }
Beispiel #3
0
 public void Refresh()
 {
     if (IsLoading)
     {
         return;
     }
     IsLoading        = InvalidDevice = IsIndeterminate = true;
     PercentageLoaded = 0D;
     LoadingMessage   = "Connecting to device . . . ";
     UI.Invoke(NotifyAll);
     TheController.TrySetDevice(Device, sr =>
     {
         if (sr.Success)
         {
             LoadReceiver();
         }
         else
         {
             InvalidDevice    = true;
             IsLoading        = IsIndeterminate = false;
             PercentageLoaded = 0D;
             LoadingMessage   = "There was an error connecting to the device";
             UI.Invoke(NotifyAll);
         }
     });
 }
Beispiel #4
0
 private void ClickedPrintAction(object _parameter)
 {
     // do the printing and then: Save the token
     TestIOToken = TheController.GetRunDate();
     LabelPrinter.PrintLabel(TestIOToken, TestIOToken);
     BCScanObject.FireEnableEvent(PostScanHook);
     // update the message
     EnableEnterEvent("UpdtMsg", new PropertyChangedEventArgs("Click  [Test Scanner] to Continue"));
 }
 private void DoneNext(object Parameter)
 {
     if (TopIndex != -1)
     {
         // order is important first clear label, then clear alive and giveup index
         TheController.ClearLabeledStatus(TopIndex);
         TheController.ReCycle(TopIndex);
         TopIndex = -1;
     }
 }
Beispiel #6
0
        public void SelectScene(string name)
        {
            var scene = SelectedZone.TheZone.Scenes.Where(s => s.Name == name).FirstOrDefault();

            if (scene != null)
            {
                TheController.SelectScene(SelectedZone.TheZone, scene);
                TheController.UpdateStatus();
            }
        }
Beispiel #7
0
 public void Refresh(Action onComplete)
 {
     TheController.RefreshZone(TheZone, result =>
     {
         if (result.Success)
         {
             UI.Invoke(RefreshVM);
         }
         onComplete.NullableInvoke();
     });
 }
Beispiel #8
0
 public void ChangeVolume(double volume)
 {
     Zone.Volume.Value = NormalizeVolume(volume);
     NotifyAll();
     TheController.ChangeVolume(Zone, sr =>
     {
         if (!sr.Success)
         {
             MainVM.RefreshVM();
         }
     });
 }
Beispiel #9
0
        public void SelectInput(string name)
        {
            var input = SelectedZone.TheZone.Inputs.Where(i => i.Param == name).FirstOrDefault();

            if (input != null)
            {
                TheController.SelectInput(SelectedZone.TheZone, input);
                TheController.UpdateStatus();
            }

            SelectionMode = SelectionMode.None;
        }
Beispiel #10
0
        public void SelectZone(string name)
        {
            foreach (var z in TheController.Zones)
            {
                if (z.Name == name)
                {
                    TheController.UpdateStatus();
                    SetSelectedZone(z);
                }
            }

            SelectionMode = SelectionMode.None;
        }
Beispiel #11
0
        public void SelectDSP(string name)
        {
            if (TheZone.Surround == null)
            {
                return;                                       //-- Can't select DSP if we don't have a surround
            }
            //-- Select the DSP locally to update the view immediatly.
            TheZone.Surround = new Surround(name == Surround.DSP_Strait, TheZone.Surround.EnhancerOn, name);

            //-- Refresh Locally
            RefreshVM();

            //-- Make the network call
            TheController.SelectDSP(TheZone);
        }
Beispiel #12
0
 public void RefreshVM()
 {
     UI.Invoke(NotifyStart);
     TheController.UpdateStatus(sr =>
     {
         UI.Invoke(() =>
         {
             if (sr.Success)
             {
                 NotifyAll();
             }
             NotifyFinish();
         });
     });
 }
Beispiel #13
0
 public void SetPartyMode(bool partyModeOn)
 {
     IsPartyModeOn = partyModeOn;
     UI.Invoke(NotifyStart);
     TheController.SetPartyMode(partyModeOn, result =>
     {
         if (result.Success)
         {
             UI.Invoke(() =>
             {
                 NotifyAll();
                 NotifyFinish();
             });
         }
     });
 }
Beispiel #14
0
        public void StartPageFuncDele()
        {
            var response = TheController.DoStartupChecks();

            if (response.Status)
            {
                if (EnableEnterEvent != null)
                {
                    EnableEnterEvent("TestPrinter", new PropertyChangedEventArgs("Click  [Test Printer] to continue"));
                }
            }
            else
            {
                if (EnableEnterEvent != null)
                {
                    EnableEnterEvent("EnableExit", new PropertyChangedEventArgs(response.Message));
                }
            }
        }
Beispiel #15
0
        public void Back()
        {
            var newLayer = MenuLayer - 1;

            TheController.ListMenuUp(Input, result =>
            {
                if (result.Success)
                {
                    ThreadPool.QueueUserWorkItem(state => EnsureMenuLayer(newLayer, 0));
                }
                else
                {
                    UI.Invoke(() =>
                    {
                        Factory.MessageBox.Show("There was an error going back.");
                    });
                }
            });
        }
Beispiel #16
0
        public void Back()
        {
            var newLayer = MenuLayer - 1;

            IsRefreshing = true;
            TheController.ListMenuUp(Input, result =>
            {
                if (result.Success)
                {
                    EnsureMenuLayer(newLayer, 0, GetPreviousLine());
                }
                else
                {
                    IsRefreshing = false;
                    UI.Invoke(() =>
                    {
                        Factory.MessageBox.Show("There was an error going back.");
                    });
                }
            });
        }
Beispiel #17
0
        public void SelectInput(Input input, Action OnSuccess)
        {
            SaveOld();

            //-- Update our local VM with the newly selected Input
            var selString = GetSelectString(input);

            foreach (var i in Inputs)
            {
                if (i.SelectString == selString)
                {
                    i.IsSelected = true;
                    ImageUri     = i.ImageUri;
                    InputTitle   = i.DisplayName;
                }
                else
                {
                    i.IsSelected = false;
                }
            }

            //-- Make the call to select the input
            TheController.SelectInput(TheZone, input, result =>
            {
                if (result.Success)
                {
                    UI.Invoke(() =>
                    {
                        SelectedInput = input;
                        List          = new VMList(MainVM, input, TheZone);
                        Playback.Refresh();
                        OnSuccess.NullableInvoke();
                    });
                    return;
                }
                ;
                RestoreToOld();
            });
        }
Beispiel #18
0
        public void SelectItem(ListItem i)
        {
            var newLayer = MenuLayer + 1;

            ThreadPool.QueueUserWorkItem(state =>
            {
                EnsureJump(i.LineNumber, 0, () =>
                {
                    TheController.SelectCurrentListItem(Input, result =>
                    {
                        if (result.Success && i.ItemType == ListItemType.Container)
                        {
                            EnsureMenuLayer(newLayer, 0);                             //-- Calls Get info to refresh the list afterwards
                        }
                        else if (result.Success)
                        {
                            OnSelectedItem(this, EventArgs.Empty);
                        }
                    });
                });
            });
        }
Beispiel #19
0
        public void SelectItem(ListItem i)
        {
            var newLayer     = MenuLayer + 1;
            var previousLine = CurrentLine;

            IsRefreshing = true;
            Jump(i.LineNumber, 0, () =>
            {
                TheController.SelectCurrentListItem(Input, result =>
                {
                    if (result.Success && i.ItemType == ListItemType.Container)
                    {
                        PreviousLines.Push(previousLine);
                        EnsureMenuLayer(newLayer, 0, 1); //-- Calls Get info to refresh the list afterwards
                    }
                    else if (result.Success)
                    {
                        UI.Invoke(() => OnSelectedItem(this, EventArgs.Empty));
                    }
                });
            });
        }
Beispiel #20
0
        public void ToggelPower()
        {
            if (MainVM.IsRefreshing)
            {
                return;
            }

            IsOn = !IsOn;
            TheController.TogglePower(TheZone, result =>
            {
                UI.Invoke(() =>
                {
                    if (result.Success)
                    {
                        MainVM.RefreshVM();
                    }
                    else
                    {
                        IsOn = !IsOn;
                    }
                });
            });
        }
Beispiel #21
0
 public void Reconnect()
 {
     if (string.IsNullOrEmpty(TheController.HostNameorAddress))
     {
         Factory.MessageBox.Show("Invalid device address.");
         return;
     }
     UI.Invoke(NotifyStart);
     TheController.TrySetDevice(TheController.Device, sr =>
     {
         UI.Invoke(() =>
         {
             IsConnected = sr.Success;
             if (IsConnected)
             {
                 SetZones();
                 RefreshVM();
                 return;                         //-- Note that RefreshVM will call NotifyFinish.
             }
             NotifyFinish();
         });
     });
 }
        private String NextOReset()
        {
            String LabelBx;

            // call the object.functionns to walk the list, pick the next ready EN and
            TopIndex = TheController.PickNextUT();
            if (TopIndex == -1)
            {
                return("");
            }

            LabelBx  = Environment.NewLine;
            LabelBx += Environment.NewLine;
            LabelBx += "====== Preparing New Available XoNet DUT ======";
            LabelBx += Environment.NewLine;
            LabelBx += "------> Please wait several seconds... <------";
            LabelBx += Environment.NewLine;
            LabelBx += Environment.NewLine;

            // send shine_flasher by just setting ShinePending=true
            TheController.SetShinePending(TopIndex);
            ScanEnabled = false;
            return(LabelBx);
        }
Beispiel #23
0
 public void UpdateHostNameOrAddresss(string hostOrAddress)
 {
     IsConnected = TheController.TrySetAddress(hostOrAddress);
 }
Beispiel #24
0
 public void ToggleMute()
 {
     TheController.ToggleMute(Zone);
 }
        public override void UpdateUI(StatusLabelCombo LabelStatus)
        {
            String LabelBx = "";

            if (TopIndex == -1)
            {
                LabelBx = NextOReset();
            }

            // transcode_copy all the changes from ExonetUIstack to Reflectuistack
            // also status String
            if (UpdateUIEvent != null)
            {
                for (int i = 0; i < 16; i++)
                {
                    if (TheController.ReturnLabeledStatus(i))
                    {
                        continue;
                    }
                    if (TheController.IsAlive(i))
                    {
                        ReflectUIStack[i].Light1  = Brushes.Red;
                        ReflectUIStack[i].Light2  = Brushes.Gray;
                        ReflectUIStack[i].Light3  = Brushes.Gray;
                        ReflectUIStack[i].Status  = "Connected: ";
                        ReflectUIStack[i].Status += TheController.ReturnLinkLocalIP(i);
                    }
                    else
                    {
                        ReflectUIStack[i].Status     = "Not Connected";
                        ReflectUIStack[i].Light1     = Brushes.Gray;
                        ReflectUIStack[i].Light2     = Brushes.Gray;
                        ReflectUIStack[i].Light3     = Brushes.Gray;
                        ReflectUIStack[i].Visibility = 0.5;
                        continue;
                    }
                    if (TheController.ReturnSvcdStatus(i))
                    {
                        ReflectUIStack[i].Light2 = Brushes.Red;
                        ReflectUIStack[i].Status = "Firmware Serviced";
                    }
                    if (TheController.ReturnReadyPending(i))
                    {
                        ReflectUIStack[i].Light3 = Brushes.Red;
                        ReflectUIStack[i].Status = "Alloted and Testing";
                    }
                    if (TheController.ReturnReadyPending(i) && TheController.ReturnPingStatus(i))
                    {
                        ReflectUIStack[i].Status = "Ready for Scanning";
                    }
                    if (i == TopIndex)
                    {
                        ReflectUIStack[i].Light1     = Brushes.Green;
                        ReflectUIStack[i].Light2     = Brushes.Green;
                        ReflectUIStack[i].Light3     = Brushes.Green;
                        ReflectUIStack[i].Visibility = 1;

                        if (TheController.ReturnBlinkingStatus(TopIndex) && !ScanEnabled)
                        {
                            LabelBx += "====== New XoNet DUT *BLINKING* *BLINKING* ======";
                            UIScanEnable();
                            // enable the scan button.
                            LabelBx += Environment.NewLine;
                            //LabelBx += "====== *BLINKING* *BLINKING* ======";
                            //LabelBx += Environment.NewLine;
                            LabelBx += Environment.NewLine;
                            LabelBx += Environment.NewLine;

                            LabelBx += "------> IDENTIFY THE CONTINUOUSLY BLINKING BOARD <------";
                            LabelBx += Environment.NewLine;
                            LabelBx += "------> CLICK [START SCAN] TO CONTINUE <------";
                            LabelBx += Environment.NewLine;
                            LabelBx += "then use scanner to scan the pcb barcode of the blinking board";
                            LabelBx += Environment.NewLine;
                            LabelBx += Environment.NewLine;
                            //LabelBx += Environment.NewLine;
                        }

                        if (TheController.ReturnBarCode(i) != "")
                        {
                            ReflectUIStack[i].Status = "Scanned";
                            LabelBx += "PCB Scanned : " + TheController.ReturnBarCode(i);
                            LabelBx += Environment.NewLine;
                            LabelBx += "MAC : " + TheController.ReturnEtherMac(i);
                            LabelBx += Environment.NewLine;
                            LabelBx += "Label Printed";
                            LabelBx += Environment.NewLine;
                            LabelBx += Environment.NewLine;
                            LabelBx += Environment.NewLine;
                            LabelBx += "------> DISCONNECT PCB & APPLY LABEL <------";
                            LabelBx += Environment.NewLine;
                            LabelBx += "------> WHEN DONE CLICK [NEXT] TO CONTINUE <------";
                            LabelBx += Environment.NewLine;
                            LabelBx += "Caution:  DO NOT click NEXT before disconnecting the PCB";
                        }

                        if (TheController.ReturnBlinkingStatus(i))
                        {
                            ReflectUIStack[i].Status = "BLINKING";
                        }
                    }
                    else
                    {
                        ReflectUIStack[i].Visibility = 0.5;
                    }
                }
                LabelStatus.LabelBox += LabelBx;

                UpdateUIEvent(ReflectUIStack, new PropertyChangedEventArgs(LabelStatus.ToString()));
            }
        }
Beispiel #26
0
 public void ToggleMute()
 {
     TheController.ToggleMute(Zone, null);
     NotifyAll();
 }
Beispiel #27
0
 public void VolumeDown()
 {
     TheController.VolumeDown(Zone, null);
     NotifyAll();
 }
Beispiel #28
0
 public void VolumeDown()
 {
     TheController.VolumeDown(Zone);
 }
Beispiel #29
0
 public void VolumeUp()
 {
     TheController.VolumeUp(Zone);
 }
Beispiel #30
0
 public void ChangeVolume(double volume)
 {
     Zone.Volume.Value = NormalizeVolume(volume);
     TheController.ChangeVolume(Zone);
 }