public TheViewModel() { CurrentModel = new Model.Model(); TheFall = CurrentModel.CurFall; TheReportFall = CurrentModel.CurRepFall; TheUser = CurrentModel.CurUser; AddRepCom = new AddReportCommand(this); AddFallCom = new AddFallCommand(this); RepBtnCom = new ReportBtnCommand(this); FallBtnCom = new FallBtnCommand(this); loadCom = new loadImageCommand(this); AnalysisBtnCom = new GraphsCommand(this); MapsBtnCom = new MapsCommand(this); }
/// <summary> /// Handle a command from the CLI. /// Commands for the server manager are prefixed with the command-character. /// </summary> /// <param name="serverMessage">The command to parse.</param> public bool ParseCommand(EMMServerMessage serverMessage) { Command command; bool executed = true; string[] args; if (serverMessage.Data.ContainsKey("command")) { args = serverMessage.Data["command"].Split(' '); } else { args = serverMessage.Message.Split(' '); } switch (args[0]) { case ("start"): mMinecraft.StartServer(); break; case ("restart"): mMinecraft.RestartServer(true); break; case ("restart now"): mMinecraft.StopServer(false); mMinecraft.StartServer(); break; case ("stop"): mMinecraft.StopServer(true); break; case ("stop now"): mMinecraft.StopServer(false); break; case ("abort"): mMinecraft.AbortPendingOperations(); break; case ("maps"): command = new MapsCommand(); command.Execute(serverMessage); break; case ("backup"): command = new BackupCommand(); command.Execute(serverMessage); break; case ("get"): command = new GetCommand(); command.Execute(serverMessage); break; default: executed = false; break; } return(executed); }