public async Task Test_Get_Id_Action_OfType_TestModel() { var controller = new CommandController <int, TestModel>(mediator); var current_result = await controller.Get(1); Assert.AreEqual(test_Entities.FirstOrDefault(i => i.Id == 1), current_result); }
// Use this for initialization void Start() { button = GetComponentInChildren <Button>(); text = GetComponentInChildren <Text>(); controller = GetComponentInParent <CommandController>(); text.enabled = false; }
private void EvalInputString(string inputString) { inputString = inputString.Trim(); if (string.IsNullOrEmpty(inputString)) { LogMessage(ConsoleMessage.Debug(string.Empty)); return; } _history.Add(inputString); LogMessage(ConsoleMessage.Debug(inputString)); var input = new List <string>(inputString.Split(new [] { ' ' }, System.StringSplitOptions.RemoveEmptyEntries)); input = input.Select(low => low.ToLower()).ToList(); var cmd = input[0]; if (CommandController.Contains(cmd)) { CommandController[cmd].Execute(input.ToArray()) .ObserveOnMainThread() .Subscribe(r => LogMessage(ConsoleMessage.Info(r))); } else { LogMessage(ConsoleMessage.Info(string.Format("*** Unknown Command: {0} ***", cmd))); } }
public MainWindow() { InitializeComponent(); try { this.logger = Gnosis.Utilities.Log4NetLogger.GetDefaultLogger(typeof(MainWindow)); } catch (Exception loggerEx) { throw new ApplicationException("Could not initialize logger", loggerEx); } try { logger.Info("Initializing Alexandria"); mediaFactory = new MediaFactory(logger); securityContext = new SecurityContext(mediaFactory); tagTypeFactory = new TagTypeFactory(); mediaRepository = new SQLiteMediaRepository(logger, mediaFactory); mediaRepository.Initialize(); linkRepository = new SQLiteLinkRepository(logger); linkRepository.Initialize(); tagRepository = new SQLiteTagRepository(logger, tagTypeFactory); tagRepository.Initialize(); metadataRepository = new SQLiteMetadataRepository(logger, securityContext, mediaFactory); metadataRepository.Initialize(); marqueeRepository = new SQLiteMarqueeRepository(logger); audioStreamFactory = new AudioStreamFactory(); videoPlayer = new Gnosis.Video.Vlc.VideoPlayerControl(); videoPlayer.Initialize(logger, () => GetVideoHost()); catalogController = new CatalogController(logger, securityContext, mediaFactory, mediaRepository, linkRepository, tagRepository, metadataRepository, audioStreamFactory); spiderFactory = new SpiderFactory(logger, securityContext, mediaFactory, linkRepository, tagRepository, mediaRepository, metadataRepository, audioStreamFactory); metadataController = new MediaItemController(logger, securityContext, mediaFactory, linkRepository, tagRepository, metadataRepository); taskController = new TaskController(logger, mediaFactory, videoPlayer, spiderFactory, metadataController, marqueeRepository, metadataRepository); tagController = new TagController(logger, tagRepository); commandController = new CommandController(logger); taskResultView.Initialize(logger, securityContext, mediaFactory, metadataController, taskController, tagController, videoPlayer); //taskManagerView.Initialize(logger, taskController, taskResultView); searchView.Initialize(logger, taskController, taskResultView); commandView.Initialize(logger, commandController, taskController, taskResultView); ScreenSaver.Disable(); } catch (Exception ex) { logger.Error("MainWindow.ctor", ex); } }
public async Task CommandController_SetTreatment_BadRequestOnMissingSessionIdHeader() { var controller = new CommandController(null); var res = await controller.SetTreatment(new TreatmentModel()); res.ShouldBeOfType <BadRequestObjectResult>(); }
protected override void OnKeyDown(KeyEventArgs e) { base.OnKeyDown(e); if (e.Handled) { return; } bool alt = Keyboard.IsKeyDown(Key.LeftAlt) || Keyboard.IsKeyDown(Key.RightAlt); bool ctrl = Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl); bool shift = Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift); // DO - UNDO CommandController controller = viewModel.Controller; if (!alt && ctrl && !shift && e.Key == Key.Z) { controller.UndoCommand(); } if (!alt && ctrl && !shift && e.Key == Key.Y) { controller.ExecuteCommand(); } lblUndoStack.Content = controller.UndoCount; lblRedoStack.Content = controller.RedoCount; //if (!alt && !ctrl && !shift) //{ // leftTree.SelectNextName(e.Key); //} return; }
public override void Do() { base.Do(); int num1 = 0; CommandController commandController1 = this.scenario.commandController; string[] args1 = this.args; int index1 = num1; int num2 = index1 + 1; int no1 = int.Parse(args1[index1]); CharaData chara1 = commandController1.GetChara(no1); CommandController commandController2 = this.scenario.commandController; string[] args2 = this.args; int index2 = num2; int num3 = index2 + 1; int no2 = int.Parse(args2[index2]); CharaData chara2 = commandController2.GetChara(no2); string[] args3 = this.args; int index3 = num3; int num4 = index3 + 1; string str = args3[index3]; int result; if (!int.TryParse(str, out result)) { result = str.Check(true, Enum.GetNames(typeof(ChaReference.RefObjKey))); } GameObject referenceInfo = chara2.chaCtrl.GetReferenceInfo((ChaReference.RefObjKey)result); chara1.chaCtrl.ChangeLookEyesTarget(-1, referenceInfo.get_transform(), 0.5f, 0.0f, 1f, 2f); }
private void ItemCommand_Activated(object sender, EventArgs e) { string str = Game.GetUserInput(WindowTitle.EnterMessage60, "", short.MaxValue); if (!Common.IsCheatEnabled) { GameUI.DisplayHelp(Strings.NoPermission); return; } try { CommandController.Run(str); } catch (UnexceptedValueException uvex) { Notification.Show(uvex.Message); } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception ex) { Notification.Show(ex.ToString()); } #pragma warning restore CA1031 // Do not catch general exception types finally { logger.Info("User typed command: " + str); } }
public MainWindowViewModel() { // Underlying models (pointless to DI these for such a small application). var paths = new ObservableCollection <AddedPath>(); var selection = new ObservableCollection <AddedPath>(); var commandController = new CommandController(); // Wireup models to commands and views. Ignoring IDisposible cleanup due to app // size. this.Paths = paths.TwoWayDynamicMap( pathModel => pathModel.AddedPathtoAddedPathView(), pathView => pathView.AddedPath).Item1; this.Selection = selection.TwoWayDynamicMap( pathModel => pathModel.AddedPathtoAddedPathView(), pathView => pathView.AddedPath).Item1; FHelpers.PathListToButtonText(paths) .Subscribe(newButtonText => this.ButtonText = newButtonText); Paths.CollectionChanged += (s, e) => { this.ShowHelpOverlay = Paths.Count == 0 ? Visibility.Visible : Visibility.Hidden; }; // Commands Model. this.Undo = new Undo(commandController); this.Redo = new Redo(commandController); this.AddDirectory = new AddDirectory(paths, selection, commandController); this.AddFile = new AddFile(paths, selection, commandController); this.PerformMerge = new PerformMerge(paths); this.RemoveSelected = new RemoveSelected(paths, selection, commandController); }
public MainWindowViewModel(WorkspaceController workspaces, CommandController commands) { base.DisplayName = Strings.MainWindowViewModel_DisplayName; _workspaces = workspaces; _commands = commands; }
private void readCommand() { string temp = queue[currentIndex]; CommandArgs tempArgs; tempArgs.isSequential = ((queue[currentIndex]).ToCharArray()[0] == '$') ? true : false; if (tempArgs.isSequential && (queue[currentIndex]).ToCharArray()[1] == '!') { temp = temp.Remove(0, 1); setTextBoxActive(false); } temp = temp.Remove(0, 1); string[] args = temp.Split('='); foreach (string qq in args) { Debug.Log(qq + "Q"); } tempArgs.args = args[1]; tempArgs.commandCaller = this; currentIndex++; CommandController.runCommand(args[0], tempArgs); if (!tempArgs.isSequential) { NextInQueue(); } }
void treeViewEx_OnSelecting(object sender, SelectionChangedCancelEventArgs e) { TreeViewEx treeViewEx = (TreeViewEx)sender; CommandController controller = viewModel.Controller; e.Cancel = true; List <CommandBase> cmdList = new List <CommandBase>(); foreach (object itemToUnselect in e.ItemsToUnSelect) { //if (!treeViewEx.SelectedItems.Contains(itemToUnselect)) continue; cmdList.Add(new DeselectItemCmd(viewModel, (Node)itemToUnselect)); } foreach (object itemToSelect in e.ItemsToSelect) { //if (treeViewEx.SelectedItems.Contains(itemToSelect)) continue; cmdList.Add(new SelectItemCmd(viewModel, (Node)itemToSelect)); //TreeViewExItem tvei = leftTree.GetTreeViewItemFor(itemToSelect); //if (tvei != null) tvei.BringIntoView(new Rect(1, 1, 1, 1)); } if (cmdList.Count > 0) { controller.AddAndExecute(new CommandGroupCmd(viewModel, cmdList.ToArray())); } lblUndoStack.Content = controller.UndoCount; lblRedoStack.Content = controller.RedoCount; return; }
public void RegisterCommands(CommandController controller) { controller.RegisterCommand <RegisterDevice>(); // device and Client needs to know the command Device.globalCommands.OverwriteCommand <RegisterInstallation>(); controller.RegisterCommand <ReceiveConfirm>(); }
public async Task CommandController_SetTreatment_BadRequestOnNullModel() { var controller = new CommandController(null); var res = await controller.SetTreatment(null); res.ShouldBeOfType <BadRequestObjectResult>(); }
protected void cmdAddNew_Click(object sender, EventArgs e) { try { CommandInfo command = new CommandInfo(); command.CommandParams = txtParams.Text; command.CommandUrl = txtUrl.Text; command.CommandParentID = ConvertUtility.ToInt32(dropParent.SelectedValue); command.CommandKey = dropCommandKeys.SelectedValue; command.CommandOrder = ConvertUtility.ToInt32(dropIndex.SelectedValue); command.CommandEnable = chkEnable.Checked; command.CommandVisible = chkVisble.Checked; command.IsSuperUser = false; int commandId = CommandController.AddCommand(command); int i = 0; foreach (DataGridItem item in dgrNameFollowLang.Items) { CommandInfo _commandInfo = new CommandInfo(); TextBox txtName = (TextBox)item.FindControl("txtName"); _commandInfo.CommandName = txtName.Text; _commandInfo.CommandID = commandId; CommandController.AddCommandByLang(_commandInfo, item.Cells[1].Text); i++; } lblUpdateStatus.Text = MiscUtility.MSG_UPDATE_SUCCESS; } catch (Exception ex) { lblUpdateStatus.Text = ex.Message; } }
public void CommandControllerOverwrite() { var cc = new CommandController(); cc.RegisterCommand <TestCommand> (); cc.OverwriteCommand <TestCommand> (_TestCommandName); }
internal ReceiveFileCommand(SlateBotDAL dal, CommandController commandController, IAsyncResponder asyncResponder) : base(CommandHandlerType.ReceiveFile, new string[] { "" }, "This mechanism allows Slate to load commands on the fly and receive external files.", "", ModuleType.BotAdmin) { this.dal = dal; this.asyncResponder = asyncResponder; this.commandController = commandController; }
public async Task Test_Put_Invalid_Model_Returns_BadRequestResult() { var mediator = IoC.ServiceProvider.GetRequiredService <IMediator>(); var controller = new CommandController <int, TestModel>(mediator); var action_payload = new TestModel { Id = 1, Description = "updated", EmailAddress = "" }; controller.ModelState.AddModelError <TestModel>(t => t.Name, "name property is required!"); controller.ModelState.AddModelError <TestModel>(t => t.EmailAddress, "email address is in an invalid format!"); var current_result = await controller.Put(1, action_payload); var result_as_badRequestObjectResult = (BadRequestObjectResult)current_result; var objectResultType = result_as_badRequestObjectResult.Value.GetType(); var result_payload = objectResultType.GetProperty("Payload").GetValue(result_as_badRequestObjectResult.Value); var result_errors = objectResultType.GetProperty("Errors").GetValue(result_as_badRequestObjectResult.Value); // testing action return type Assert.IsInstanceOfType(current_result, typeof(BadRequestObjectResult)); // or simply Assert.IsTrue(current_result is IActionResult); // testing returned value wrapped in an BadRequestObjectResult Assert.AreEqual(action_payload, result_payload); Assert.AreEqual(controller.ModelState.Values, result_errors); // testing status code Assert.IsTrue(result_as_badRequestObjectResult.StatusCode.Value == 400); }
public CustomerController(WorkspaceController workspaces, CommandController commands, ICustomerRepository customerRepository) { _workspaces = workspaces; _commands = commands; _customerRepository = customerRepository; }
/// <summary> /// Initialize a new instance of a help controller /// </summary> /// <param name="controller">The command controller</param> /// <param name="start">The index where the help lines starts. Starting index at 1</param> /// <param name="end">The index where the help lines end</param> public HelpPointer(CommandController controller, String option, int start, int end) { this.Command = controller.HelpCommand; this.Option = option; this.StartLine = start - 1; this.EndLine = end - 1; }
private void AddHis() { if (LastSelect == null) { CommandController.AddHis(this.txtCommand.Text); } else { var cmd = new Command() { Name = "", Content = LastSelect.type == "json" ? this.txtCommand.Text.FormatJSON() : this.txtCommand.Text, type = LastSelect.type }; if (LastSelect.Name.IndexOf("_") > 0) { var index = LastSelect.Name.LastIndexOf("_"); var name = DateTime.Now.ToString("yyMMddHHmmss") + LastSelect.Name.Substring(index); cmd.Name = name; } else { cmd.Name = DateTime.Now.ToString("yyMMddHHmmss"); cmd.Name += LastSelect.Name == "空" ? "" : "_" + LastSelect.Name; } CommandController.AddHis(cmd); //lstHis.DataSource = CommandController.His; //lstHis.DisplayMember = "Name"; BindHis(); } }
private void LoadCommandData() { if (txtID.Text != string.Empty) { CommandInfo curCommand = CommandController.GetCommandByLang(ConvertUtility.ToInt32(txtID.Text)); if (curCommand != null) { txtID.Text = curCommand.CommandID.ToString(); txtParams.Text = curCommand.CommandParams; //txtName.Text = curCommand.CommandName; txtUrl.Text = curCommand.CommandUrl; MiscUtility.SelectItemFromList(dropParent, curCommand.CommandParentID.ToString()); MiscUtility.SelectItemFromList(dropCommandKeys, curCommand.CommandKey); MiscUtility.SelectItemFromList(dropIndex, curCommand.CommandOrder.ToString()); chkEnable.Checked = curCommand.CommandEnable; chkVisble.Checked = curCommand.CommandVisible; chkIsSuperUser.Checked = curCommand.IsSuperUser; DataTable dtCommandByLang = CommandController.GetCommandByCmdId(ConvertUtility.ToInt32(txtID.Text)); dgrNameFollowLang.DataSource = builddata(dtCommandByLang); dgrNameFollowLang.DataBind(); } } }
private void LoadSidebar() { radmMenu.Text = ""; //GetPath(); cmd = ConvertUtility.ToString(Request.QueryString["cmd"]); portalid = ConvertUtility.ToInt32(Request.QueryString["portalid"]); DataTable dtCommands = null; if (!CurrentUser.IsSuperAdmin) { dtCommands = CommandController.GetCommandsForUserByPortalID(CurrentUser.UserID, portalid); } else { dtCommands = CommandController.GetCommands(); } DataRow[] drRoots = dtCommands.Select("CommandParentID = 0"); sb.Append("<ul class=\"nav navbar-nav\">"); foreach (DataRow row in drRoots) { string name = ""; string url = ""; name = row["CommandName"].ToString(); //_item.Value = row["CommandID"].ToString(); int curItem = ConvertUtility.ToInt32(row["CommandID"].ToString()); DataRow[] _lstCommands = dtCommands.Select("CommandParentID = " + curItem + " AND CommandVisible = 1"); if (!string.IsNullOrEmpty(row["CommandUrl"].ToString().Trim())) { url = row["CommandUrl"].ToString(); } else if (!string.IsNullOrEmpty(row["CommandKey"].ToString().Trim())) { url = AppEnv.AdminUrlParams(row["CommandKey"].ToString()) + row["CommandParams"].ToString(); } if (ConvertUtility.ToBoolean(row["CommandVisible"]) == false || ConvertUtility.ToBoolean(row["CommandEnable"]) == false) { continue; } if (_lstCommands.Length > 0) { sb.Append("<li>"); sb.Append(string.Format(fmAd, url, name)); sb.Append("<ul class=\"dropdown-menu\">"); LoadSidebarItems(ConvertUtility.ToInt32(row["CommandID"].ToString()), dtCommands); sb.Append("</ul>"); sb.Append("</li>"); } else { sb.Append(string.Format(fmUi, url, name)); } } sb.Append("</ul>"); radmMenu.Text = sb.ToString(); }
static public CommandController Ins() { if (GetCommand == null) { GetCommand = new CommandController(); } return(GetCommand); }
void SendHit(int signature, Vector3 position) { visualise.AddShortData("Sending", "Hit Data"); DataLink target = dataLink.GetNearestOf <CommandController>(); CommandController cc = target.GetComponent <CommandController>(); cc.Report(signature, position); }
public void Start() { m_textController = GetComponent <TextController>(); m_commandController = GetComponent <CommandController>(); renderComponent = soul.GetComponent <Renderer>(); UpdateLines(LoadFileName); RequestNextLine(); }
public void RegisterCommands(CommandController controller) { controller.RegisterCommand <CreateLobbyCommand>(); controller.RegisterCommand <GetLobbies>(); controller.RegisterCommand <JoinLobbyCommand>(); // part of the core //controller.RegisterCommand<RegisterDevice>(); }
public void DependencyTest() { var cc = new CommandController(); var md = new CommandData(); Assert.IsNotNull(cc); Assert.IsNotNull(md); }
private void Awake() { commandController = FindObjectOfType <CommandController>(); if (commandController.isOrangeGetted(index)) { Destroy(gameObject); } }
public ClientCore(CommandController commandController, ClientSocket socket, EntityManager manager) { this.commandController = commandController; this.socket = socket; socket.AddCallback(OnMessage); this.EntityManager = manager; this.EntityManager.coreInstance = this; }
public Game(IRenderer renderer, IInputHandler inputHandler, IBoardSetup boardSetupRules) { this.renderer = renderer; this.inputHandler = inputHandler; this.boardSetupRules = boardSetupRules; this.player = new Player(); this.commandController = new CommandController(this.player); }
// Use this for initialization void Start() { m_textController = GetComponent <TextController>(); m_commandController = GetComponent <CommandController>(); UpdateLines(LoadFileName); RequestNextLine(); }
// Use this for initialization private void Start() { selectionController = GameManager.singleton.SelectionController; commandController = GameManager.singleton.CommandController; selectionController.onSelectionChanged += OnSelectionChanged; DeactivateAllButtons(); }
private void Setup() { commandController = new CommandController(this); HelpText = "Enter a Command to perform an action: @'help' to produce menu @'goto' 'place' to go somewhere (shop, vault, arena, world) @'save' to save progress @'load' to load game state from last save and return to World @'delete' to delete save @'y' or 'n' to confirm or cancel any action @Different commands also exist within zones"; GreetingText = "Welcome to Top Deck. Enter a command to get started!"; Shop = new Shop(commandController); Vault = new Vault(commandController); Arena = new Arena(commandController); Game = new Game(commandController); CharacterCreator = new CharacterCreator(Shop.CardLibrary); CardLibrary = Shop.CardLibrary; Front.ChangeLocation(this); }
void Start() { m_textController = GetComponent<TextController>(); m_commandController = GetComponent<CommandController>(); UpdateLines(LoadFileName); RequestNextLine(); }
private void RestartGame() { this.player = new Player(); this.mazeHasSolution = false; this.commandController = new CommandController(this.player); this.Start(); }
public Game(CommandController commandControllerInput) { commandController = commandControllerInput; GreetingText = "Game Started!"; HelpText = "Enter a Command to perform an action: @'help' to produce menu @'goto' 'place' to go somewhere(shop, vault, arena, world) @'save' to save progress @'load' to load game state from last save and return to World @'delete' to delete save @'y' or 'n' to confirm or cancel any action @Different commands also exist within zones"; }
public BuildStarterController(WorkspaceController workspaces, CommandController commands) { _workspaces = workspaces; _commands = commands; }
public Vault(CommandController commandControllerInput) { commandController = commandControllerInput; GreetingText = "Welcome to the Vault"; HelpText = "Enter a Command to perform an action: @'show' to show a collection type ('all'/'deck')"; }
// Use this for initialization void Start () { if(cam==null) cam = Camera.allCameras[0]; GobjRenderer = model.GetComponent<Renderer>(); Spawner = new CommandController<Command>(); }
public DescribeFindBest() { dbMock = new Mock<IDatabase>(); fsMock = new Mock<IFileStoreProvider>(); controller = new CommandController(dbMock.Object, fsMock.Object); }
private MainWindowViewModel GetTarget() { var commands = new CommandController(); //todo: fake this with rhino mocks... var repo = new CustomerRepository(new CustomerModule { CustomerDataFile = Constants.CUSTOMER_DATA_FILE }); new CustomerController(_workspaces, commands, repo).Run(); return new MainWindowViewModel(_workspaces, commands); }