Exemplo n.º 1
0
        public async void SettingDetailCommand(SettingsViewModel SettingDetail)
        {
            string action;
            var    api = new MediaFarmerApi();

            if (SettingDetail.DataType == 1)
            {
                action = await CoreMethods.DisplayActionSheet(string.Concat("Change value for ", SettingDetail.SettingName), "Cancel", null, "10", "30", "50", "70", "100");

                if (action == "Cancel")
                {
                    return;
                }
                SettingDetail.SettingValue = int.Parse(action);
            }
            else if (SettingDetail.DataType == 2)
            {
                action = await CoreMethods.DisplayActionSheet(string.Concat("Change value for ", SettingDetail.SettingName), "Cancel", null, "true", "false");

                if (action == "Cancel")
                {
                    return;
                }
                SettingDetail.Active = bool.Parse(action);
            }
            else
            {
                return;
            }
            await api.UpdateSettings(SettingDetail);

            PopulateSettingsList();
        }
Exemplo n.º 2
0
        private async void OnSelectLocation(IReadOnlyList <LocationModel> locations)
        {
            try
            {
                var buttons = new string[locations.Count];
                for (int n = 0; n < locations.Count; ++n)
                {
                    buttons[n] = locations[n].Id + " - " + locations[n].Name;
                }

                string res = await CoreMethods.DisplayActionSheet("Pick Location", "Cancel", string.Empty, buttons);

                if (res == "Cancel")
                {
                    return;
                }

                string locationName = string.Empty;
                int    id           = Convert.ToInt32(res.Substring(0, 2));
                int    pos          = res.IndexOf('-');
                if (pos > 0)
                {
                    locationName = res.Substring(pos + 1);
                }

                locationName = locationName.Trim();

                if (id <= 0)
                {
                    return;
                }
                foreach (LocationModel loc in locations)
                {
                    if (loc.Id != id)
                    {
                        continue;
                    }
                    App.Client.SetCurrentLocation(loc);
                    UpdateUi();
                    break;
                }
            }
            catch (Exception)
            {
                int x = 0;
                x++;
            }
        }
Exemplo n.º 3
0
        private async void ActivateCopyNodeAsync(string nodeUuid)
        {
            if (UserObjects == null | UserObjects.Count <= 0)
            {
                UserObjects = await GetUserObjectsAsync();
            }

            string[] ObjectNamesArray   = UserObjects.Select(obj => obj.Name).ToArray();
            string   selectedObjectName = await CoreMethods.DisplayActionSheet("Выберите объект", "Cancel", null, ObjectNamesArray.ToArray());

            if (selectedObjectName == "Cancel" | selectedObjectName == null)
            {
                return;
            }

            Models.Object selectedObject = UserObjects.Where(obj => obj.Name == selectedObjectName).First();

            _objectStorage.SendCopyNodeRequestAsync(nodeUuid, selectedObject.uuid);

            await CoreMethods.DisplayAlert("Выполнено", "Узел успешно скопирован", "Ok");
        }
 protected async Task <string> DisplayActionSheet(string title, string cancel, string destruction, params string[] buttons)
 {
     return(await CoreMethods.DisplayActionSheet(title, cancel, destruction, buttons));
 }