static Startup() { CommandModel commandModel = new CommandModel("sc").AddArgument("port", new CommandArgument("type", "number")) .AddArgument("path", new CommandArgument("type", "string")) .AddArgument("logs", new CommandArgument("type", "boolean")); ApplicationOptions options; try { options = (ApplicationOptions)CommandLine.Parse(commandModel); options.Port = Script.Or(options.Port, Number.ParseInt(Node.Process.Environment["PORT"]), 1337); options.Path = Script.Or(options.Path, Node.Process.GetCurrentDirectory()); Runtime.EnableTrace = options.Logs; } catch (Exception e) { Console.Log(e.Message); Console.Log(commandModel.ToString()); return; } Application app = new Application(options); app.Run(); }
protected override void OnCreate(Bundle savedInstanceState) { Log.Debug(TAG, "OnCreate"); base.OnCreate(savedInstanceState); int CommandId = Intent.Extras.GetInt(nameof(CommandModel.Id), 0); if (CommandId > 0) { lock (DatabaseContext.DbLocker) { using (DatabaseContext db = new DatabaseContext(gs.DatabasePathBase)) { command = db.Commands.Include(x => x.Script).Include(x => x.PortExecutionCondition).ThenInclude(x => x.Hardware).FirstOrDefault(x => x.Id == CommandId); } } } AbstractSettingsManage.Command = command; List <string> commands_types_array = new List <string>(Resources.GetStringArray(Resource.Array.commands_types_array)); switch (command.TypeCommand) { case TypesCommands.Port: TypesCommand.SetSelection(commands_types_array.IndexOf(GetString(Resource.String.command_type_array_item_port))); break; case TypesCommands.Controller: TypesCommand.SetSelection(commands_types_array.IndexOf(GetString(Resource.String.command_type_array_item_controller))); break; case TypesCommands.Exit: TypesCommand.SetSelection(commands_types_array.IndexOf(GetString(Resource.String.command_type_array_item_transit))); break; } ScriptId = command.ScriptId; DeleteCommand = new AppCompatButton(this) { Text = GetText(Resource.String.delete_title) }; DeleteCommand.SetTextColor(Color.DarkRed); DeleteCommand.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); FooterLayout.AddView(DeleteCommand); HiddenCommandCheckBox.Checked = command.Hidden; CardTitle.Text = command.Script.ToString(); CardSubtitle.Text = command.ToString(); PauseSecondsBeforeStarting.Text = command.PauseBeforeExecution.ToString(); if (command.PortExecutionCondition != null) { RequiredCondition.Checked = true; HardwareCondition.Enabled = true; HardwareCondition.SetSelection(Hardwares.Keys.ToList().IndexOf(command.PortExecutionCondition.HardwareId)); PortCondition.Enabled = true; PortsList_UpdateSpinner(command.PortExecutionCondition.HardwareId, ref PortCondition, command.PortExecutionCondition.Id); //PortCondition.SetSelection(Ports.Keys.ToList().IndexOf(command.PortExecutionCondition.Id)); StateCondition.Enabled = true; StateCondition.SetSelection(GetIndexPortState(command.PortExecutionConditionAllowingState, new List <string>(Resources.GetStringArray(Resource.Array.required_condition_port_states_array)))); } }