public static void run(RecognitionEngine recogEngine, SpeechSynthesizer synthEngine, IWebDriver driver) { //synthEngine.Speak("what is your gender"); reiterateIfStaticCommand: string command = recogEngine.GetRecognizedText(synthEngine); bool WhetherStaticCommand = StaticCommands.WhetherExecuted(driver, command); if (!WhetherStaticCommand) { switch (command) { case "male": driver.FindElement(By.ClassName("Gender_iconMale_2uEOT")).Click(); WhetherSeniorCitizen.run(recogEngine, synthEngine, driver); break; case "female": driver.FindElement(By.ClassName("Gender_iconFemale_yFfRz")).Click(); WhetherSeniorCitizen.run(recogEngine, synthEngine, driver); break; default: break; } } else { goto reiterateIfStaticCommand; } }
public static void run(RecognitionEngine recogEngine, SpeechSynthesizer synthEngine, IWebDriver driver) { //recogEngine.UnSetAllGrammarFiles(); //recogEngine.SetAnotherGrammarFile("CreditScore.txt"); reiterateIfStaticCommand: string command = recogEngine.GetRecognizedText(synthEngine); bool WhetherStaticCommand = StaticCommands.WhetherExecuted(driver, command); if (!WhetherStaticCommand) { Console.WriteLine(command); /* * switch (command) * { * * default: * break; * } */ } else { goto reiterateIfStaticCommand; } }
public void ExecuteCommand(PotentialCommand potentialCommand) { if (!StaticCommands.ContainsKey(potentialCommand.CommandId) && !LoadStaticCommandPlugin(potentialCommand.PluginResourceId, potentialCommand.PluginHash)) { return; } lock (_activeCommandsLock) { //if there is already an Active command executing with the id, we return, nothing new to execute if (ActiveCommands.Any(x => x.Key.CallbackId == potentialCommand.CallbackId)) { return; } } if (potentialCommand.ExecutionEvent?.Id > 0) //0 = Immediately execution { _staticCommandScheduler.AddPotentialCommand(potentialCommand); } else { ExecutePotentialCommand(potentialCommand); } }
public static void run(RecognitionEngine recogEngine, SpeechSynthesizer synthEngine, IWebDriver driver) { //synthEngine.SpeakAsync("choose from compare fixed deposit, get a rate, fixed deposit reviews" + // "hungry for more"); reiterateIfStaticCommand: string command = recogEngine.GetRecognizedText(synthEngine); bool WhetherStaticCommand = StaticCommands.WhetherExecuted(driver, command); if (!WhetherStaticCommand) { switch (command) { case "submit my fixed deposit": driver.FindElement(By.ClassName("custom-quote")).Click(); Location.run(recogEngine, synthEngine, driver); break; default: break; } } else { goto reiterateIfStaticCommand; } }
public static void run(RecognitionEngine recogEngine, SpeechSynthesizer synthEngine, IWebDriver driver) { //synthEngine.Speak("are you a senior citizen"); reiterateIfStaticCommand: string command = recogEngine.GetRecognizedText(synthEngine); bool WhetherStaticCommand = StaticCommands.WhetherExecuted(driver, command); if (!WhetherStaticCommand) { switch (command) { case "yes": driver.FindElement(By.ClassName("YesNo_iconMaleSeniorCitizenYes_1b5Xa")).Click(); FreeOffers.run(recogEngine, synthEngine, driver); break; case "no": driver.FindElement(By.ClassName("YesNo_iconMaleSeniorCitizenNo_AjA0z")).Click(); FreeOffers.run(recogEngine, synthEngine, driver); break; default: break; } } else { goto reiterateIfStaticCommand; } }
private void Control_OnMouseDoubleClick(object sender, MouseButtonEventArgs args) { var list = sender as ListBox; if (list?.ContextMenu != null) { var wpfPoint = PointToScreen(args.GetPosition(list)); var focused = FocusManager.GetFocusedElement(Application.Current.MainWindow); if (focused is TextBox) { return; } StaticCommands.RaiseAllCanExecuteChanged(); List <Control> itemsToHide = list.ContextMenu.Items.OfType <Control>().Where(control => (!(control.Tag is MenuItemSettings) || !((MenuItemSettings)control.Tag).IsVisibleInQuicklist) && control.Visibility == Visibility.Visible).ToList(); itemsToHide.Apply(control => control.Visibility = Visibility.Collapsed); RoutedEventHandler handler = (o, eventArgs) => itemsToHide.Apply(control => control.Visibility = Visibility.Visible); list.ContextMenu.Closed += handler; list.ContextMenu.Closed += (o, eventArgs) => { list.ContextMenu.Closed -= handler; }; //list.ContextMenu.IsOpen = true; mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, (int)wpfPoint.X, (int)wpfPoint.Y, 0, 0); } }
public void ExecuteCommand(Guid guid, byte[] parameter, IFeedbackFactory feedbackFactory) { StaticCommand staticCommand; if (StaticCommands.TryGetValue(guid, out staticCommand)) { staticCommand.Execute(new CommandParameter(parameter), feedbackFactory, _clientInfo); } }
private void BlockEditForm_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { if (DataContext is Block block) { MCItemLocator[] locators = MCItemLocator.GetAllMinecraftItems(); MCItemLocator inventoryTextureLocator = locators.FirstOrDefault(x => x.Name == block.InventoryTextureName); MCItemLocator textureLocator = locators.FirstOrDefault(x => x.Name == block.TextureName); StaticCommands.SetItemButtonImage(InventoryTextureButton, inventoryTextureLocator); StaticCommands.SetItemButtonImage(TextureButton, textureLocator); } }
public void BuildContextMenu() { SelectWorkspaceMenu = Workspaces.Select(workspace => new DelegateCommand <object>(workspace.Name, o => SelectedWorkspace = workspace)) .Concat(GetGitRepositoriesCommands()) .Concat(StaticCommands.Merge(Workspaces != null && Workspaces.Any() ? StaticCommands.Seperator : null, SelectDirectoryCommand, StaticCommands.Seperator, TfsContext.IsTfsConnected ? StaticCommands.ManageWorkspacesCommand : StaticCommands.ConnectToSourceControlCommand)) .ToContextMenu(); }
private async Task <Tuple <List <ProjectViewModel>, List <ProjectViewModel> > > MergeContingentAsync(ISolutionProjectModel[] projects, IServiceSettings settings, CancellationToken cancellationToken) { try { var projectsToMerge = projects.Where(model => !model.IsDelphiProject && settings.GetSettingsFromProvider <BuildServiceSettings>(model).BuildMode == BuildMode.MergedBuild).Cast <ProjectViewModel>().ToList(); if (projectsToMerge.Any()) { var packers = await StaticCommands.MergeSolutionsAsync(projectsToMerge, cancellationToken : cancellationToken); var newSolutions = new List <ProjectViewModel>(); foreach (var packer in packers.Where(packer => packer != null)) { var projectsForThisPacker = projects.Where(model => packer.InputSolutions.Contains(model.ItemPath)).ToList(); ISolutionProjectModel m = projectsForThisPacker.FirstOrDefault(); if (m is ProjectViewModel) { var oldProjectModel = (ProjectViewModel)m; var newMergedBuildSolution = oldProjectModel.ParentWorkingFolder.AddProject(packer.OutputSolutionFileName, true, true); // TODO: doof if (settings.BuildProperties == null || !settings.BuildProperties.Any() || settings.BuildProperties.Keys.Select(s => s.ToLower()).Contains("platform")) { newMergedBuildSolution.BuildProperties.Add("Platform", "Any CPU"); } newMergedBuildSolution.BuildPriority = projectsForThisPacker.OrderBy(model => model.BuildPriority).Last().BuildPriority; newSolutions.Add(newMergedBuildSolution); } } // OperationStatus der neuen Solution auf alle anderen projizieren newSolutions.Apply(model => model?.OnChange(() => model.CurrentOperation, o => projectsToMerge.SetOperations(o))); var mergedResult = Tuple.Create(newSolutions, projectsToMerge); // Cancel action setzen cancellationToken.Register(() => { mergedResult.Item1.SetOperations(Operations.None); mergedResult.Item2.SetOperations(Operations.None); }); return(mergedResult); } } catch (Exception e) { Output.Exception(e); } return(null); }
public static void DeleteCommand(StaticCommands cmd) { if (string.IsNullOrEmpty(cmd.Keyword)) { throw new System.ArgumentException(); } cmd.Keyword = CheckForBang(cmd.Keyword); using (var context = new mashDbContext()) { context.Remove(GetCommand(cmd.Keyword)); context.SaveChanges(); } }
public static void run(RecognitionEngine recogEngine, SpeechSynthesizer synthEngine, IWebDriver driver) { //synthEngine.Speak("which company do you work for"); reiterateIfStaticCommand: string command = recogEngine.GetRecognizedText(synthEngine); bool WhetherStaticCommand = StaticCommands.WhetherExecuted(driver, command); if (!WhetherStaticCommand) { switch (command) { case "microsoft": driver.FindElement(By.ClassName("react-autosuggest__input")).SendKeys("microsoft"); driver.FindElement(By.ClassName("btn-large")).Click(); Salary.run(recogEngine, synthEngine, driver); break; case "google": driver.FindElement(By.ClassName("react-autosuggest__input")).SendKeys("google"); driver.FindElement(By.ClassName("btn-large")).Click(); Salary.run(recogEngine, synthEngine, driver); break; case "facebook": driver.FindElement(By.ClassName("react-autosuggest__input")).SendKeys("facebook"); driver.FindElement(By.ClassName("btn-large")).Click(); Salary.run(recogEngine, synthEngine, driver); break; case "twitter": driver.FindElement(By.ClassName("react-autosuggest__input")).SendKeys("twitter"); driver.FindElement(By.ClassName("btn-large")).Click(); Salary.run(recogEngine, synthEngine, driver); break; default: break; } } else { goto reiterateIfStaticCommand; } }
private void InitializePlugin(string filename, byte[] hash) { #if NET35 var pluginData = File.ReadAllBytes(filename); var pluginAssembly = Assembly.Load(pluginData); #else var pluginAssembly = Assembly.LoadFile(filename); #endif _loadedPlugins.Add(new LoadedStaticCommandPluginInfo(filename, hash)); var types = pluginAssembly.GetTypes(); foreach (var staticCommandType in types.Where(x => x.IsSubclassOf(typeof(StaticCommand)) && x.GetConstructor(Type.EmptyTypes) != null)) { var staticCommand = (StaticCommand)Activator.CreateInstance(staticCommandType); StaticCommands.Add(staticCommand.CommandId, staticCommand); } }
public static void UpdateCommand(StaticCommands cmd) { if (string.IsNullOrEmpty(cmd.Keyword) || string.IsNullOrEmpty(cmd.Text)) { throw new System.ArgumentException(); } cmd.Keyword = CheckForBang(cmd.Keyword); using (var context = new mashDbContext()) { var existing = GetCommand(cmd.Keyword); existing.Text = cmd.Text; context.Update(existing); context.SaveChanges(); } }
public static void run(RecognitionEngine recogEngine, SpeechSynthesizer synthEngine, IWebDriver driver) { //synthEngine.Speak("where do you live"); reiterateIfStaticCommand: string command = recogEngine.GetRecognizedText(synthEngine); bool WhetherStaticCommand = StaticCommands.WhetherExecuted(driver, command); if (!WhetherStaticCommand) { switch (command) { case "banglore": driver.FindElement(By.ClassName("ResidentCity_iconBangalore_21hQE")).Click(); CompanyName.run(recogEngine, synthEngine, driver); break; case "chennai": driver.FindElement(By.ClassName("ResidentCity_iconChennai_SfqFL")).Click(); CompanyName.run(recogEngine, synthEngine, driver); break; case "mumbai": driver.FindElement(By.ClassName("ResidentCity_iconMumbai_3i73_")).Click(); CompanyName.run(recogEngine, synthEngine, driver); break; case "new delhi": driver.FindElement(By.ClassName("ResidentCity_iconNewDelhi_2IARH")).Click(); CompanyName.run(recogEngine, synthEngine, driver); break; default: break; } } else { goto reiterateIfStaticCommand; } }
public static void run(RecognitionEngine recogEngine, SpeechSynthesizer synthEngine, IWebDriver driver) { //synthEngine.Speak("entering your details"); string command = recogEngine.GetRecognizedText(synthEngine); StaticCommands.WhetherExecuted(driver, command); if (command == "enter details") { driver.FindElement(By.CssSelector("input[name=firstName]")).SendKeys("Aditya Singh"); driver.FindElement(By.CssSelector("input[name=mobileNumber]")).SendKeys("7769987541"); driver.FindElement(By.CssSelector("input[name=email]")).SendKeys("*****@*****.**"); driver.FindElement(By.ClassName("btn-large")).Click(); } string command2 = recogEngine.GetRecognizedText(synthEngine); StaticCommands.WhetherExecuted(driver, command2); }
public static void run(RecognitionEngine recogEngine, SpeechSynthesizer synthEngine, IWebDriver driver) { reiterateIfStaticCommand: string command = recogEngine.GetRecognizedText(synthEngine); bool WhetherStaticCommand = StaticCommands.WhetherExecuted(driver, command); if (!WhetherStaticCommand) { switch (command) { default: break; } } else { goto reiterateIfStaticCommand; } }
private DynamicCommandViewModel RegisteredDynamicCommandToDynamicCommandsViewModel( RegisteredDynamicCommand command) { command.Timestamp = command.Timestamp.ToLocalTime(); return(new DynamicCommandViewModel(command, command.ExecutingClientIds?.Select( x => _connectionManager.ClientProvider.Clients.FirstOrDefault(y => y.Id == x)).Where(x => x != null)) { CommandType = StaticCommands.FirstOrDefault( y => y.CommandId == command.CommandId)?.Name ?? (string)Application.Current.Resources["UnknownCommand"], Target = GetTargetName(command.Target), CommandSource = command.PluginHash == null ? "Orcus" : PluginManager.Current.LoadedPlugins.OfType <StaticCommandPlugin>() .FirstOrDefault(x => x.PluginHash.SequenceEqual(command.PluginHash))? .PluginInfo.Name ?? (string)Application.Current.Resources["UnknownPlugin"] }); }
private void ExecutePotentialCommand(PotentialCommand potentialCommand) { StaticCommand staticCommand; if (StaticCommands.TryGetValue(potentialCommand.CommandId, out staticCommand)) { var activeStaticCommand = staticCommand as ActiveStaticCommand; if (activeStaticCommand != null) { //create a new instance because the commands are session based activeStaticCommand = (ActiveStaticCommand)Activator.CreateInstance(activeStaticCommand.GetType()); activeStaticCommand.ExecutionStopped += ActiveStaticCommandOnExecutionStopped; //the command is automatically removed if (!_activeCommandStopScheduler.ExecuteActiveCommand(potentialCommand, activeStaticCommand)) { return; } lock (_activeCommandsLock) ActiveCommands.Add(potentialCommand, activeStaticCommand); var serverConnection = (ServerConnection)_clientInfo.ServerConnection; lock (serverConnection.SendLock) { DynamicCommandFeedbackFactory.PushEvent(serverConnection.BinaryWriter, potentialCommand.CallbackId, ActivityType.Active, null); } new Thread(() => { try { activeStaticCommand.Execute(new CommandParameter(potentialCommand.Parameter), null, _clientInfo); } catch (Exception) { ActiveStaticCommandOnExecutionStopped(activeStaticCommand, EventArgs.Empty); } }) { IsBackground = true }.Start(); } else { var feedbackFactory = new DynamicCommandFeedbackFactory((ServerConnection)_clientInfo.ServerConnection, potentialCommand.CallbackId); new Thread(() => { try { staticCommand.Execute(new CommandParameter(potentialCommand.Parameter), feedbackFactory, _clientInfo); } catch (Exception ex) { feedbackFactory.Failed("Critical error: " + ex.Message); } //that will execute anyways only if it wasn't pushed yet feedbackFactory.Succeeded(); }) { IsBackground = true }.Start(); } } }
public static void run(RecognitionEngine recogEngine, SpeechSynthesizer synthEngine, IWebDriver driver) { //synthEngine.Speak("what is you net monthly salary, enter one digit at a time"); reiterateIfStaticCommand: //synthEngine.Speak("If done speak click continue"); string command = recogEngine.GetRecognizedText(synthEngine); bool WhetherStaticCommand = StaticCommands.WhetherExecuted(driver, command); if (!WhetherStaticCommand) { switch (command) { case "number one": driver.FindElement(By.CssSelector("input[name='netMonthlyIncome']")).SendKeys("1"); goto reiterateIfStaticCommand; case "number two": driver.FindElement(By.CssSelector("input[name='netMonthlyIncome']")).SendKeys("2"); goto reiterateIfStaticCommand; case "number three": driver.FindElement(By.CssSelector("input[name='netMonthlyIncome']")).SendKeys("3"); goto reiterateIfStaticCommand; case "number four": driver.FindElement(By.CssSelector("input[name='netMonthlyIncome']")).SendKeys("4"); goto reiterateIfStaticCommand; case "number five": driver.FindElement(By.CssSelector("input[name='netMonthlyIncome']")).SendKeys("5"); goto reiterateIfStaticCommand; case "number six": driver.FindElement(By.CssSelector("input[name='netMonthlyIncome']")).SendKeys("6"); goto reiterateIfStaticCommand; case "number seven": driver.FindElement(By.CssSelector("input[name='netMonthlyIncome']")).SendKeys("7"); goto reiterateIfStaticCommand; case "number eight": driver.FindElement(By.CssSelector("input[name='netMonthlyIncome']")).SendKeys("8"); goto reiterateIfStaticCommand; case "numberoo nine": driver.FindElement(By.CssSelector("input[name='netMonthlyIncome']")).SendKeys("9"); goto reiterateIfStaticCommand; case "click continue": driver.FindElement(By.ClassName("btn-large")).Click(); Gender.run(recogEngine, synthEngine, driver); break; default: break; } } else { goto reiterateIfStaticCommand; } }