/// <summary> /// FindSelectedItems If the View is GridView, required {CurrentRelativePosition}. /// </summary> public static IScriptCommand FindSelectedItemsUsingGridView(IScriptCommand nextCommand = null) { return(new FindSelectedItemsUsingGridView() { NextCommand = (ScriptCommandBase)nextCommand }); }
public static IScriptCommand ObtainPointerPosition(IScriptCommand nextCommand = null) { return(new ObtainPointerPosition() { NextCommand = (ScriptCommandBase)nextCommand }); }
/// <summary> /// FindSelectedItems If the ItemsPanel that support IChildInfo, required {SelectionBoundAdjusted}. /// </summary> public static IScriptCommand FindSelectedItemsUsingIChildInfo(IScriptCommand nextCommand = null) { return(new FindSelectedItemsUsingIChildInfo() { NextCommand = (ScriptCommandBase)nextCommand }); }
public static IScriptCommand HighlightItems(IScriptCommand nextCommand = null) { return(new HighlightItems(false) { NextCommand = (ScriptCommandBase)nextCommand }); }
public static IScriptCommand IfEndsWith(string stringVariable = "{string}", string startWithText = "_EndsWith_", bool ignoreCase = true, IScriptCommand trueCommand = null, IScriptCommand otherwiseCommand = null) { return(IfValue <string>(ignoreCase ? ComparsionOperator.EndsWithIgnoreCase : ComparsionOperator.EndsWith, stringVariable, startWithText, trueCommand, otherwiseCommand)); }
public static IScriptCommand IfDependencyPropertyEqualDefaultValue <T>(string elementVariable = "{Sender}", DependencyProperty property = null, IScriptCommand trueCommand = null, IScriptCommand otherwiseCommand = null) { return(IfDependencyPropertyEquals <T>(elementVariable, property, (T)property.DefaultMetadata.DefaultValue, trueCommand, otherwiseCommand)); }
public static IScriptCommand CancelCanvasDrag(IScriptCommand nextCommand = null) { return(new DragDropLiteCommand() { State = DragDropLiteState.CancelCanvas, NextCommand = (ScriptCommandBase)nextCommand, }); }
public static IScriptCommand FindLogicalParent(string elementVariable = "{Sender}", FindMethodType method = FindMethodType.Name, string findParameterVariable = "{Parameter}", string destinationVariable = "{Destination}", IScriptCommand nextCommand = null) { return(FindUIElement(elementVariable, FindDirectionType.Parent, FindTreeType.Logical, method, findParameterVariable, destinationVariable, nextCommand)); }
public static IScriptCommand NotifyRootDeleted(IEntryModel[] directories, IScriptCommand nextCommand = null) { string directoryVariable = "{Notify-RootDirs}"; return(ScriptCommands.Assign(directoryVariable, directories, false, NotifyRootDeleted(directoryVariable, nextCommand))); }
public void AddCommandMethod(IScriptCommand command) { IScriptCommand scriptCommand = command.Create(); EditCommandMethod(scriptCommand); DefaultScript.Commands.Add(scriptCommand); lst_commands.SelectedItem = scriptCommand; }
/// <summary> /// Execute command from commandManager.CommandDictionary.CommandVariable, /// or if not found, from ParameterDic[CommandVariable]. /// </summary> /// <param name="commandManager"></param> /// <param name="commandVariable"></param> /// <param name="parameterDic"></param> /// <param name="scriptRunner"></param> /// <returns></returns> public static async Task ExecuteAsync(this ICommandManager commandManager, string commandVariable = "{Command2Run}", ParameterDic parameterDic = null, IScriptRunner scriptRunner = null) { IScriptCommand cmd = commandManager.GetCommandFromDictionary(commandVariable, null); cmd = cmd ?? ScriptCommands.Run(commandVariable); await commandManager.ExecuteAsync(cmd, parameterDic, scriptRunner); }
public static IScriptCommand Delay(int delayTimeInMs = 1000, IScriptCommand nextCommand = null) { return(new Delay() { DelayTime = delayTimeInMs, NextCommand = (ScriptCommandBase)nextCommand }); }
/// <summary> /// Not Serializable, transfer source entry to destentry. /// For transfer to ISzsItemModel only, if unsure destination use DiskTransfer with allowCustom on. /// </summary> /// <param name="srcModel"></param> /// <param name="destDirModel"></param> /// <param name="removeOriginal"></param> /// <param name="allowCustomImplementation"></param> /// <param name="nextCommand"></param> /// <returns></returns> public static IScriptCommand SzsDiskTransfer(IEntryModel[] srcModels, ISzsItemModel destDirModel, bool removeOriginal = false, IScriptCommand nextCommand = null) { return(ScriptCommands.Assign("{SourceDiskTransferEntry}", srcModels, false, ScriptCommands.Assign("{DestinationDiskTransferEntry}", destDirModel, false, SzsDiskTransfer("{SourceDiskTransferEntry}", "{DestinationDiskTransferEntry}", removeOriginal, nextCommand)))); }
public NotifyChangedCommand(IProfile destProfile, string destParseName, IProfile srcProfile, string srcParseName, ChangeType changeType, IScriptCommand nextCommand = null) : this(destProfile, destParseName, changeType, nextCommand) { _srcProfile = srcProfile; _srcParseName = srcParseName; }
public ScriptCommandBinding(RoutedUICommand uICommandKey, IScriptCommand scriptCommand, IParameterDicConverter parameterDicConverter = null, ScriptBindingScope scope = ScriptBindingScope.Application) { Scope = scope; ScriptCommand = scriptCommand; UICommandKey = uICommandKey == null ? ApplicationCommands.NotACommand : uICommandKey; ParameterDicConverter = parameterDicConverter == null ? ParameterDicConverters.ConvertParameterOnly : parameterDicConverter; }
public static IScriptCommand ClearCommand(string rootKey = "{RootVM}", IScriptCommand nextCommand = null) { return(new ClearCommand() { RootKey = rootKey, NextCommand = (ScriptCommandBase)nextCommand }); }
public static IScriptCommand IfArrayLength(ComparsionOperator op = ComparsionOperator.GreaterThanOrEqual, string arrayVariable = "{array}", int value = 1, IScriptCommand trueCommand = null, IScriptCommand otherwiseCommand = null) { return (ScriptCommands.Assign("{ArrayLengthValue}", value, IfArrayLength(op, arrayVariable, "{ArrayLengthValue}", trueCommand, otherwiseCommand))); }
/// <summary> /// Serializable, Invoke an entry in shell. /// </summary> /// <param name="entryVariable"></param> /// <param name="nextCommand"></param> /// <returns></returns> public static IScriptCommand DiskRun(string entryVariable = "{Entry}", IScriptCommand nextCommand = null) { return(new DiskRun() { EntryKey = entryVariable, NextCommand = (ScriptCommandBase)nextCommand }); }
/// <summary> /// Serializable, Set cursor during UIElement.GiveFeedback/QueryCursor event. /// </summary> /// <example>HubScriptCommands.SetCustomCursor(Cursors.No)</example> /// <param name="cursor"></param> /// <param name="nextCommand"></param> /// <returns></returns> public static IScriptCommand SetCustomCursor(Cursor cursor, IScriptCommand nextCommand = null) { return(new SetCustomCursor() { CursorType = cursor, NextCommand = (ScriptCommandBase)nextCommand }); }
/// <summary> /// Set Control.Commands(CommandManager).Commands(DynamicDictionary[IScriptCommand]) /// </summary> /// <param name="?"></param> /// <returns></returns> public static IScriptCommand SetScriptCommand(string controlVariable = "{FileList}", string target = "Open", IScriptCommand valueCommand = null, IScriptCommand nextCommand = null) { string valueVarable = ParameterDic.CombineVariable(controlVariable, "Value"); return(ScriptCommands.Assign(valueVarable, valueCommand, false, SetScriptCommand(controlVariable, target, valueVarable, nextCommand))); }
public static IScriptCommand IfEquals <T>(string variable = "{variable}", T value = default(T), IScriptCommand trueCommand = null, IScriptCommand otherwiseCommand = null) { string ifEqualValueProperty = "{IfEquals-Value}"; return (ScriptCommands.Assign(ifEqualValueProperty, value, IfValue(ComparsionOperator.Equals, variable, ifEqualValueProperty, trueCommand, otherwiseCommand))); }
public static IScriptCommand IfMouseGesture(MouseGesture gesture, IScriptCommand nextCommand = null, IScriptCommand otherwiseCommand = null) { string MouseGestureVariable = "{IfMouseGesture-Gesture}"; return (ScriptCommands.Assign(MouseGestureVariable, gesture, false, HubScriptCommands.IfMouseGesture(MouseGestureVariable, nextCommand, otherwiseCommand))); }
public static IScriptCommand DetermineFindSelectionMode(string findSelectionModeVariable = "{FindSelectionMode}", IScriptCommand nextCommand = null) { return(new DetermineFindSelectionMode() { FindSelectionModeKey = findSelectionModeVariable, NextCommand = (ScriptCommandBase)nextCommand }); }
public RunInSequenceScriptCommand(IScriptCommand[] scriptCommands, IScriptCommand nextCommand) { if (scriptCommands.Length == 0) { throw new ArgumentException(); } _scriptCommands = scriptCommands; _nextCommand = nextCommand; }
public static IScriptCommand PrintConsole(string variable, IScriptCommand nextCommand = null) { return(new Print() { DestinationType = Print.PrintDestinationType.Console, VariableKey = variable, NextCommand = (ScriptCommandBase)nextCommand }); }
public static IScriptCommand Transfer(IEntryModel srcModel, IEntryModel destDirModel, bool removeOriginal = false, bool allowCustomImplementation = true, IScriptCommand nextCommand = null) { IScriptCommand retCommand = allowCustomImplementation ? (destDirModel.Profile as IDiskProfile).DiskIO.GetTransferCommand(srcModel, destDirModel, removeOriginal) : new FileTransferScriptCommand(srcModel, destDirModel, removeOriginal); return(nextCommand == null ? retCommand : ScriptCommands.RunInSequence(retCommand, nextCommand)); }
private static IScriptCommand serializeAndDeserializeCommand(IScriptCommand command) { var stream = serializer.SerializeScriptCommand(command); Console.WriteLine(new StreamReader(stream).ReadToEnd()); stream.Seek(0, SeekOrigin.Begin); return(serializer.DeserializeScriptCommand(stream)); }
public static IScriptCommand UpdateSelectionAdorner(string selectionAdornerVariable = "{SelectionAdorner}", IScriptCommand nextCommand = null) { return(new SelectionAdornerCommand() { AdornerMode = UIEventHub.AdornerMode.Update, NextCommand = (ScriptCommandBase)nextCommand }); }
/// <summary> /// Set property of an object in ParameterDic to a value. /// </summary> /// <example> /// ScriptCommands.SetPropertyValue("{PSI}", (ProcessStartInfo p) => p.FileName, "GHI.txt") /// </example> /// <typeparam name="C"></typeparam> /// <typeparam name="T"></typeparam> /// <param name="sourceObjectVariable"></param> /// <param name="expression"></param> /// <param name="value"></param> /// <param name="nextCommand"></param> /// <returns></returns> public static IScriptCommand SetPropertyValue <C, T>(string sourceObjectVariable = "{Source}", Expression <Func <C, T> > expression = null, T value = default(T), IScriptCommand nextCommand = null) { MemberExpression memberExpression = (MemberExpression)expression.Body; string property = memberExpression.Member.Name; return(SetPropertyValue <T>(sourceObjectVariable, property, value, nextCommand)); }
/// <summary> /// Iterate an IEnumeration and return true if anyone's property equals to the value. /// <example> /// IScriptCommand iterateCommand2 = /// ScriptCommands.ForEachIfAnyValue<DateTime>("{Items}", null, ComparsionOperator.Equals, DateTime.Today, /// ScriptCommands.PrintDebug("True"), ScriptCommands.PrintDebug("False")); /// </example> /// </summary> /// <typeparam name="T"></typeparam> /// <param name="itemsVariable"></param> /// <param name="property"></param> /// <param name="op"></param> /// <param name="value"></param> /// <param name="nextCommand"></param> /// <param name="otherwiseCommand"></param> /// <returns></returns> public static IScriptCommand ForEachIfAnyValue <T>(string itemsVariable = "{Items}", string property = null, ComparsionOperator op = ComparsionOperator.Equals, T value = default(T), IScriptCommand nextCommand = null, IScriptCommand otherwiseCommand = null) { string compareVariable = ParameterDic.CombineVariable(itemsVariable.Replace(".", ""), "Compare"); return(Assign(compareVariable, value, false, ForEachIfAnyValue(itemsVariable, property, op, compareVariable, nextCommand, otherwiseCommand))); }
public void AddCommand(IScriptCommand command) { _interpreter.CommandQueue.Add(command); _workQueue.Add(new WorkQueueItem(() => _interpreter.ProcessQueue())); }
internal RoomieCommandContext(RoomieCommandInterpreter interpreter, HierarchicalVariableScope scope, IScriptCommand originalCommand) { Interpreter = interpreter; Scope = scope; OriginalCommand = originalCommand; }
private bool ExecuteCommand(IScriptCommand languageCommand) { //TODO: move this check's logic into IScriptCommand if (languageCommand.FullName.Equals("RoomieScript")) { //TODO: just make a "RoomieScript" command? CommandQueue.AddBeginning(languageCommand.InnerCommands); return true; } RoomieCommand command; try { command = ChooseCommand(languageCommand.FullName); } catch (CommandNotFoundException e) { WriteEvent(e.Message); CommandQueue.Clear(); return false; } // create a lower scope and populate it with the command arguments var commandScope = Scope.CreateLowerScope(); foreach (var parameter in languageCommand.Parameters) commandScope.Local.DeclareVariable(parameter.Name, parameter.Value); try { var context = new RoomieCommandContext ( interpreter: this, scope: commandScope, originalCommand: languageCommand ); command.Execute(context); } catch (RoomieRuntimeException e) { WriteEvent(e.Message); CommandQueue.Clear(); return false; } catch (NotImplementedException) { WriteEvent("Command \"" + command.FullName + "\" not implemented."); CommandQueue.Clear(); return false; } catch(ThreadAbortException e4) { WriteEvent("Thread shut down."); CommandQueue.Clear(); return false; } catch (Exception e2) { WriteEvent("REALLY unexpected error!"); WriteEvent(e2.ToString()); CommandQueue.Clear(); return false; } return true; }
internal void AddCommand(IScriptCommand command) { threadPool.AddCommands(command); }
public CommandEventArgs(IScriptCommand command) { Command = command; }
public void AddCommand(IScriptCommand plugin) { plugins.Add(plugin); }
public void ExecuteCommand(IScriptCommand command) { command.Execute(); }
public void EditCommandMethod(IScriptCommand command) { if (command == null) return; if (!command.HaveEditControl) { MessageBox.Show("Use script editor to edit this script"); return; } var dlg = new ScriptCommandEdit(command.GetConfig()); dlg.ShowDialog(); }
public void DelCommandMethod(IScriptCommand command) { if (command == null) return; int ind = DefaultScript.Commands.IndexOf(command); DefaultScript.Commands.Remove(command); if (ind >= DefaultScript.Commands.Count) ind = DefaultScript.Commands.Count - 1; if (ind > 0) lst_commands.SelectedItem = DefaultScript.Commands[ind]; }
protected virtual void OnCommandCreated(IScriptCommand command) { if( CommandCreated != null) { CommandCreated (this, new CommandEventArgs (command)); } }