Beispiel #1
0
 private void SpinnerCulture_ItemSelected(object sender, Android.Widget.AdapterView.ItemSelectedEventArgs e)
 {
     if (e.Id == 0)
     {
         this.culture = string.Empty;
     }
     else if (e.Id == 1)
     {
         this.culture = "es";
     }
     else if (e.Id == 2)
     {
         this.culture = "en";
     }
     else if (e.Id == 3)
     {
         this.culture = "ca-ES";
     }
     else if (e.Id == 4)
     {
         this.culture = "fr";
     }
     else if (e.Id == 5)
     {
         this.culture = "de";
     }
     else if (e.Id == 6)
     {
         this.culture = "it";
     }
     else if (e.Id == 7)
     {
         this.culture = "pt";
     }
 }
        private void Scriptes_ItemSelected(object sender, Android.Widget.AdapterView.ItemSelectedEventArgs e)
        {
            int script_id = ScriptsList.Keys.ElementAt(e.Position);

            if (Command != null)
            {
                CommandModel command = null;
                lock (DatabaseContext.DbLocker)
                {
                    using (DatabaseContext db = new DatabaseContext(gs.DatabasePathBase))
                    {
                        command = db.Commands.FirstOrDefault(x => x.Id == Command.Execution);
                    }
                }

                if (command != null && command.ScriptId != script_id)
                {
                    Scriptes.SetSelection(ScriptsList.Keys.ToList().IndexOf(command.ScriptId));
                    return;
                }
            }

            StepsList = new Dictionary <int, string>();

            if (script_id == 0)
            {
                ParentActivity.command_executer_id = 0;
                ArrayAdapter adapterSteps = new ArrayAdapter <string>(ParentActivity, Android.Resource.Layout.SimpleSpinnerItem, Array.Empty <string>());
                adapterSteps.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                Steps.Adapter = adapterSteps;
                Steps.Enabled = false;
                Command       = null;
            }
            else
            {
                Steps.Enabled = true;
                ScriptModel scriptHardware = null;
                lock (DatabaseContext.DbLocker)
                {
                    using (DatabaseContext db = new DatabaseContext(gs.DatabasePathBase))
                    {
                        scriptHardware = db.Scripts.Include(x => x.Commands).FirstOrDefault(x => x.Id == script_id);
                    }
                }
                if (scriptHardware != null)
                {
                    Log.Debug(TAG, $"ScriptCommand_SpinnerItemSelected(id:{script_id}) - {scriptHardware}");
                    scriptHardware.Commands.ForEach(x => { StepsList.Add(x.Id, x.ToString()); });
                }

                ArrayAdapter <string> adapterSteps = new ArrayAdapter <string>(ParentActivity, Android.Resource.Layout.SimpleSpinnerItem, StepsList.Values.ToList());
                adapterSteps.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                Steps.Adapter = adapterSteps;
            }
        }
        private void Steps_ItemSelected(object sender, Android.Widget.AdapterView.ItemSelectedEventArgs e)
        {
            int step_id = StepsList.Keys.ElementAt(e.Position);

            if (Command != null && Command?.Execution != step_id)
            {
                Steps.SetSelection(StepsList.Keys.ToList().IndexOf(Command.Execution));
                return;
            }
            Command = null;

            ParentActivity.command_executer_id = step_id;
        }
Beispiel #4
0
        private void SpinnerProxies_ItemSelected(object sender, Android.Widget.AdapterView.ItemSelectedEventArgs e)
        {
            var    selected = ((List <string>)((MvxSpinner)sender).ItemsSource)[e.Position];
            string text     = selected.ToString();

            if (text.ToLower().Contains("proxy"))
            {
                this.proxy = null;
            }
            else
            {
                this.proxy = text;
            }
        }
 private void spinner_ItemSelected(object sender, Android.Widget.AdapterView.ItemSelectedEventArgs e)
 {
     picker.SelectedIndex = (e.Position);
 }