Esempio n. 1
0
        public async void RunUDS(UserDefinedSelectionViewModel udsvm)
        {
            if (NotNetOrConnection)
            {
                return;
            }

            try
            {
                udsvm.State = ModelState.Loading;
                List <UserDefinedSelectionResult> list = await NAV.RunUDS(Zone.LocationCode, Zone.Code, udsvm.ID, ACD.Default).ConfigureAwait(true);

                if (list is List <UserDefinedSelectionResult> )
                {
                    foreach (RackViewModel rvm in RackViewModels)
                    {
                        rvm.UDSSelects.RemoveAll(x => x.FunctionID == udsvm.ID);
                    }

                    foreach (UserDefinedSelectionResult udsr in list)
                    {
                        RackViewModel rvm = RackViewModels.ToList().Find(x => x.No == udsr.RackNo);

                        if (rvm is RackViewModel)
                        {
                            SubSchemeSelect sss = new SubSchemeSelect()
                            {
                                FunctionID = udsr.FunctionID,
                                Section    = udsr.Section,
                                Level      = udsr.Level,
                                Depth      = udsr.Depth,
                                Value      = udsr.Value,
                                HexColor   = udsr.HexColor
                            };
                            rvm.UDSSelects.Add(sss);
                        }
                    }
                }
                MessagingCenter.Send(this, "UDSRunIsDone");
            }
            catch (OperationCanceledException e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                ErrorText     = e.Message;
                LoadAnimation = false;
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
            }
            udsvm.State = ModelState.Normal;
        }
Esempio n. 2
0
 private void FillUDSList(List <UserDefinedSelection> list)
 {
     foreach (UserDefinedSelection uds in list)
     {
         UserDefinedSelectionViewModel udsvm = new UserDefinedSelectionViewModel(Navigation, uds)
         {
             UDSWidth = UDSPanelHeight,
         };
         udsvm.OnTap += RunUDS;
         UserDefinedSelectionViewModels.Add(udsvm);
     }
     MessagingCenter.Send(this, "UDSListIsLoaded");
 }
Esempio n. 3
0
        public async void RunUDS(UserDefinedSelectionViewModel udsvm)
        {
            if (NotNetOrConnection)
            {
                return;
            }

            try
            {
                if (udsvm.UDSIsRan)
                {
                    UDSLastResults.RemoveAll(x => x.FunctionID == udsvm.ID);
                    foreach (RackViewModel rvm in RackViewModels)
                    {
                        rvm.UDSSelects.RemoveAll(x => x.FunctionID == udsvm.ID);
                    }
                    MessagingCenter.Send(this, "UDSRunIsDone");
                    udsvm.UDSIsRan = false;
                }
                else
                {
                    udsvm.State = ModelState.Loading;
                    List <UserDefinedSelectionResult> list = await NAV.RunUDS(Zone.LocationCode, Zone.Code, udsvm.ID, ACD.Default).ConfigureAwait(true);

                    if ((NotDisposed) && (list is List <UserDefinedSelectionResult>))
                    {
                        UDSLastResults.RemoveAll(x => x.FunctionID == udsvm.ID);
                        foreach (UserDefinedSelectionResult udsr in list)
                        {
                            UDSLastResults.Add(udsr);
                        }
                        FillRackUDSR(udsvm.ID);
                        MessagingCenter.Send(this, "UDSRunIsDone");
                    }
                    udsvm.UDSIsRan = true;
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                udsvm.UDSIsRan = false;
            }
            finally
            {
                LoadAnimation = false;
            }
            udsvm.State = ModelState.Normal;
        }
Esempio n. 4
0
        public async Task LoadUDS()
        {
            if (NotNetOrConnection)
            {
                return;
            }

            try
            {
                UserDefinedSelectionViewModels.Clear();
                List <UserDefinedSelection> list = await NAV.LoadUDS(Zone.LocationCode, Zone.Code, ACD.Default).ConfigureAwait(true);

                if (list is List <UserDefinedSelection> )
                {
                    foreach (UserDefinedSelection uds in list)
                    {
                        UserDefinedSelectionViewModel udsvm = new UserDefinedSelectionViewModel(Navigation, uds)
                        {
                            UDSWidth = UDSPanelHeight,
                        };
                        udsvm.OnTap += RunUDS;

                        UserDefinedSelectionViewModels.Add(udsvm);
                    }
                }
                MessagingCenter.Send(this, "UDSListIsLoaded");
            }
            catch (OperationCanceledException e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                State     = ModelState.Error;
                ErrorText = e.ToString();
            }
        }