public SettingsManageTransfer(CommandAddActivity commandAddActivity, AppCompatSpinner scriptes, AppCompatSpinner steps) { Log.Debug(TAG, "~ constructor"); ParentActivity = commandAddActivity; Scriptes = scriptes; Steps = steps; ScriptsList = new Dictionary <int, string>() { { 0, ParentActivity.GetString(Resource.String.completing_the_script_title) } }; lock (DatabaseContext.DbLocker) { using (DatabaseContext db = new DatabaseContext(gs.DatabasePathBase)) { db.Scripts.ToList().ForEach(x => { ScriptsList.Add(x.Id, $"{(x.Id == Command?.Script.Id ? "→ " : "")}{x}"); }); } } ArrayAdapter <string> adapterScriptes = new ArrayAdapter <string>(ParentActivity, Android.Resource.Layout.SimpleSpinnerItem, ScriptsList.Values.ToList()); adapterScriptes.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); Scriptes.Adapter = adapterScriptes; OnResume(); }
public SettingsManagePort(CommandAddActivity command_add_activity, AppCompatSpinner controllers, AppCompatSpinner ports, AppCompatSpinner states) { Log.Debug(TAG, "~ constructor"); command_add_activity.HardwaresListSpinnerLoad(ref controllers); ParentActivity = command_add_activity; Controllers = controllers; Ports = ports; States = states; string[] script_trigger_port_states_array = ParentActivity.Resources.GetStringArray(Resource.Array.script_trigger_port_states_array); ArrayAdapter adapterPortStatuses = new ArrayAdapter <string>(ParentActivity, Android.Resource.Layout.SimpleSpinnerItem, script_trigger_port_states_array); adapterPortStatuses.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); States.Adapter = adapterPortStatuses; if (Command != null) { if (Command.ExecutionParametr == "true") { States.SetSelection(Array.IndexOf(script_trigger_port_states_array, ParentActivity.GetString(Resource.String.abc_capital_on))); } else if (Command.ExecutionParametr == "false") { States.SetSelection(Array.IndexOf(script_trigger_port_states_array, ParentActivity.GetString(Resource.String.abc_capital_off))); } else { States.SetSelection(Array.IndexOf(script_trigger_port_states_array, ParentActivity.GetString(Resource.String.abc_capital_switch))); } } OnResume(); }