예제 #1
0
        public async Task Load()
        {
            if (NotNetOrConnection)
            {
                return;
            }

            try
            {
                State = ModelState.Loading;
                List <BinTemplate> bintemplates = await NAV.GetBinTemplateList(1, int.MaxValue, ACD.Default);

                if ((!IsDisposed) && (bintemplates is List <BinTemplate>))
                {
                    BinTemplates.Clear();
                    foreach (BinTemplate bt in bintemplates)
                    {
                        BinTemplateViewModel btvm = new BinTemplateViewModel(Navigation, bt);
                        BinTemplates.Add(btvm);
                    }
                    State = ModelState.Normal;
                }
            }
            catch (OperationCanceledException e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                ErrorText = e.Message;
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                State     = ModelState.Error;
                ErrorText = AppResources.Error_LoadBinTemplates;
            }
        }
예제 #2
0
        private async Task LoadBinTemplates()
        {
            BinTemplatesIsLoaded = false;
            try
            {
                List <BinTemplate> bintemplates = await NAV.GetBinTemplateList(1, int.MaxValue, ACD.Default).ConfigureAwait(true);

                if (NotDisposed)
                {
                    BinTemplates.Clear();
                    foreach (BinTemplate bt in bintemplates)
                    {
                        bool selected = true;
                        if (!string.IsNullOrEmpty(NewModel.LocationCode))
                        {
                            if (bt.LocationCode != NewModel.LocationCode)
                            {
                                selected = false;
                            }
                        }

                        if (!string.IsNullOrEmpty(NewModel.ZoneCode))
                        {
                            if (bt.ZoneCode != NewModel.ZoneCode)
                            {
                                selected = false;
                            }
                        }

                        if (selected)
                        {
                            BinTemplates.Add(bt);
                        }
                    }
                    BinTemplatesIsLoaded = bintemplates.Count > 0;
                    if (BinTemplatesIsLoaded)
                    {
                        MessagingCenter.Send <MasterRackNewViewModel>(this, "BinTemplatesIsLoaded");
                    }
                }
            }
            catch (OperationCanceledException e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                ErrorText = e.Message;
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                ErrorText = e.Message;
            }
        }
예제 #3
0
        public async Task ReloadBinTemplates()
        {
            BinTemplatesIsLoaded = false;
            try
            {
                List <BinTemplate> bintemplates = await NAV.GetBinTemplateList(1, int.MaxValue, ACD.Default).ConfigureAwait(true);

                if (!IsDisposed)
                {
                    BinTemplates.Clear();
                    foreach (BinTemplate bt in bintemplates)
                    {
                        bool selected = true;
                        if (!string.IsNullOrEmpty(LocationCode))
                        {
                            if (bt.LocationCode != LocationCode)
                            {
                                selected = false;
                            }
                        }

                        if (!string.IsNullOrEmpty(ZoneCode))
                        {
                            if (bt.ZoneCode != ZoneCode)
                            {
                                selected = false;
                            }
                        }

                        if (selected)
                        {
                            BinTemplates.Add(bt);
                        }
                    }
                    BinTemplatesIsLoaded = bintemplates.Count > 0;
                }
            }
            catch (OperationCanceledException e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                ErrorText = e.Message;
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                ErrorText = e.Message;
            }
        }
예제 #4
0
        public override void DisposeModel()
        {
            Locations.Clear();
            Zones.Clear();
            BinTemplates.Clear();

            if (OnTap is Action <RackViewModel> )
            {
                Delegate[] clientList = OnTap.GetInvocationList();
                foreach (var d in clientList)
                {
                    OnTap -= (d as Action <RackViewModel>);
                }
            }
            BinsViewModel.DisposeModel();
            base.DisposeModel();
        }
예제 #5
0
 public override void DisposeModel()
 {
     NewModel.DisposeModel();
     BinTemplates.Clear();
     base.DisposeModel();
 }