Пример #1
0
        public async Task SetLocation(Location location)
        {
            if (CanChangeLocationAndZone)
            {
                LocationCode = location.Code;
                IsBusy       = true;
                try
                {
                    ZoneCode      = "";
                    ZonesIsLoaded = false;
                    List <Zone> zones = await NAV.GetZoneList(location.Code, "", false, 1, int.MaxValue, ACD.Default).ConfigureAwait(true);

                    Zones.Clear();
                    foreach (Zone zone in zones)
                    {
                        Zones.Add(zone);
                    }
                    ZonesIsLoaded = CanChangeLocationAndZone && zones.Count > 0;
                    await ReloadBinTemplates().ConfigureAwait(true);

                    MessagingCenter.Send <RackViewModel>(this, "ZonesIsLoaded");
                    await CheckNo().ConfigureAwait(true);
                }
                catch (OperationCanceledException e)
                {
                    System.Diagnostics.Debug.WriteLine(e.Message);
                    ErrorText = e.Message;
                }
                finally
                {
                    IsBusy = false;
                }
            }
        }
Пример #2
0
        public async Task LoadZones()
        {
            if (IsEditMode)
            {
                return;
            }

            ZonesIsLoaded      = false;
            ZonesIsBeingLoaded = true;
            try
            {
                List <Zone> zones = await NAV.GetZoneList(Code, "", true, 1, int.MaxValue, ACD.Default).ConfigureAwait(true);

                if (NotDisposed)
                {
                    AddSubSchemeElements(zones);
                }
            }
            catch (OperationCanceledException e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                ErrorText = e.Message;
            }
            finally
            {
                ZonesIsBeingLoaded = false;
            }
        }
Пример #3
0
        public async Task LoadAll()
        {
            if (NotNetOrConnection)
            {
                return;
            }

            try
            {
                State = ModelState.Loading;
                List <Zone> zones = await NAV.GetZoneList(Location.Code, "", false, 1, int.MaxValue, ACD.Default);

                if (zones is List <Zone> )
                {
                    FillModel(zones);
                }
            }
            catch (OperationCanceledException e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
            }
            catch
            {
                State     = ModelState.Error;
                ErrorText = AppResources.Error_LoadZoneList;
            }
        }
        public async Task Load()
        {
            if (NotNetOrConnection)
            {
                return;
            }

            try
            {
                State = ModelState.Loading;
                List <Zone> zones = await NAV.GetZoneList(Location.Code, "", true, 1, int.MaxValue, ACD.Default).ConfigureAwait(true);

                if (NotDisposed)
                {
                    CheckPlanSizes();
                    if (zones is List <Zone> )
                    {
                        FillModel(zones);
                    }
                }
            }
            catch (OperationCanceledException e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                State     = ModelState.Error;
                ErrorText = AppResources.Error_LoadZones;
            }
        }
Пример #5
0
        private async Task LoadZonesList()
        {
            List <Zone> zones = await NAV.GetZoneList(LocationCode, "", false, 1, int.MaxValue, ACD.Default).ConfigureAwait(true);

            if (!IsDisposed)
            {
                Zones.Clear();
                foreach (Zone zone in zones)
                {
                    Zones.Add(zone);
                }
                ZonesIsLoaded = CanChangeLocationAndZone && zones.Count > 0;
            }
        }
Пример #6
0
        private async Task LoadZonesList()
        {
            List <Zone> list = await NAV.GetZoneList(LocationCode, "", false, 1, int.MaxValue, ACD.Default).ConfigureAwait(true);

            if ((!IsDisposed) && (list is List <Zone>))
            {
                Zones.Clear();
                foreach (Zone zone in list)
                {
                    Zones.Add(zone);
                }
                Zone finded = Zones.Find(x => x.Code == ZoneCode);
                if (finded is Zone)
                {
                    SelectedZone = finded;
                }
            }
        }
Пример #7
0
        public async Task LoadZones()
        {
            if (IsEditMode)
            {
                return;
            }

            ZonesIsLoaded      = false;
            ZonesIsBeingLoaded = true;
            try
            {
                List <Zone> zones = await NAV.GetZoneList(Code, "", true, 1, int.MaxValue, ACD.Default);

                if (!IsDisposed)
                {
                    SubSchemeElements.Clear();
                    foreach (Zone zone in zones)
                    {
                        SubSchemeElement sse = new SubSchemeElement
                        {
                            Left     = zone.Left,
                            Top      = zone.Top,
                            Height   = zone.Height,
                            Width    = zone.Width,
                            HexColor = zone.HexColor
                        };
                        SubSchemeElements.Add(sse);
                    }
                    ZonesIsLoaded = SubSchemeElements.Count > 0;
                }
            }
            catch (OperationCanceledException e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                ErrorText = e.Message;
            }
            finally
            {
                ZonesIsBeingLoaded = false;
            }
        }
Пример #8
0
        public async Task UpdateLocation(Location location)
        {
            if (NotNetOrConnection)
            {
                return;
            }

            if (LocationCode != location.Code)
            {
                LocationCode = location.Code;
                ZoneCode     = "";
                try
                {
                    List <Zone> list = await NAV.GetZoneList(location.Code, "", false, 1, int.MaxValue, ACD.Default).ConfigureAwait(true);

                    if (!IsDisposed)
                    {
                        if (list is List <Zone> )
                        {
                            Zones.Clear();
                            foreach (Zone zone in list)
                            {
                                Zones.Add(zone);
                            }
                        }
                    }
                }
                catch (OperationCanceledException e)
                {
                    System.Diagnostics.Debug.WriteLine(e.Message);
                    ErrorText = e.Message;
                }
                catch (Exception e)
                {
                    System.Diagnostics.Debug.WriteLine(e.Message);
                    ErrorText = e.Message;
                }
            }
        }