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; } }
public async Task DeleteTemplate(object sender) { if (NotNetOrConnection) { return; } try { BinTemplateViewModel btvm = (BinTemplateViewModel)sender; State = ModelState.Loading; await NAV.DeleteBinTemplate(btvm.BinTemplate, ACD.Default).ConfigureAwait(true); if (!IsDisposed) { BinTemplates.Remove(btvm); SelectedTemplate = null; State = ModelState.Normal; } } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); State = ModelState.Error; ErrorText = e.Message; } }
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; } }
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; } }
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(); }
public override void DisposeModel() { NewModel.DisposeModel(); BinTemplates.Clear(); base.DisposeModel(); }