public async Task LoadBins(AsyncCancelationDispatcher acd) { BinViewModelsDispose(); try { LoadedBinsQuantity = 0; SearchBinsQuantity = 0; NAVFilter navfilter = new NAVFilter { LocationCodeFilter = LocationCode, ZoneCodeFilter = ZoneCode, RackIDFilter = RackID.ToString() }; List <Bin> bins = await NAV.GetBinList(navfilter, acd.Default).ConfigureAwait(true); if (NotDisposed) { if (bins.Count > 0) { LoadedBinsQuantity = bins.Count; foreach (Bin bin in bins) { BinViewModel bvm = new BinViewModel(Navigation, bin); bvm.IsContent = !bin.Empty; bvm.Color = (Color)Application.Current.Resources["BinViewColor"]; bvm.OnTap += Bvm_OnTap; ExistInSearch(bvm); ExistInUDS(bvm); BinViewModels.Add(bvm); } } MessagingCenter.Send <BinsViewModel>(this, "BinsIsLoaded"); } } 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 void ResetDataForNewApartment() { Debug.Log("Refreshing data for the new apartment"); // Find the mape controller for the new apartment currentMapController = FindObjectOfType <MapController>(); mapDelegateHolder = FindObjectOfType <MapDelegateHolder>(); // Need to assigne functions to the new delegates if (!controllingRack) { mapDelegateHolder.upgradedRigActions += UpdateMyRigUI; myRigID = GetComponent <RigID>(); } else { mapDelegateHolder.upgradedRackActions += UpdateMyRackUI; myRackID = GetComponent <RackID>(); } }
// Use this for initialization void Start() { currentMapController = FindObjectOfType <MapController>(); itemDatabase = FindObjectOfType <ItemDatabase>(); rigController = FindObjectOfType <RigController>(); miningController = FindObjectOfType <MiningController>(); mapDelegateHolder = FindObjectOfType <MapDelegateHolder>(); if (controllingRack) { // If this UI element controls a rack, then make the button call upgrade a rack function from the rig controller upgradeButton.onClick.AddListener(() => rigController.UpgradeARack(GetComponent <RackID>().myControlID)); myRackID = GetComponent <RackID>(); } else { upgradeButton.onClick.AddListener(() => rigController.UpgradeARig(GetComponent <RigID>().myControlID)); myRigID = GetComponent <RigID>(); myRig = FindObjectOfType <ItemDatabase>().rigTypes[0]; } // If the center activate button is ON then give it a function of buying a brand new rig if (activateButton && !controllingRack) { activateButton.onClick.AddListener(() => BuyARigFromScratch()); } else { activateButton.gameObject.SetActive(false); } if (!controllingRack) { mapDelegateHolder.upgradedRigActions += UpdateMyRigUI; } else { mapDelegateHolder.upgradedRackActions += UpdateMyRackUI; } InitizalizeTheUI(); }