public Program() { invoker = new Invoker(); AsiaServer asiaServer = new AsiaServer(); EuroServer euroServer = new EuroServer(); USServer usServer = new USServer(); ShutdownCommand asiaShutdown = new ShutdownCommand( asiaServer ); RunDiagnosticsCommand asiaDiagnostics = new RunDiagnosticsCommand( asiaServer ); RebootCommand asiaReboot = new RebootCommand( asiaServer ); ShutdownCommand euroShutdown = new ShutdownCommand( euroServer ); RunDiagnosticsCommand euroDiagnostics = new RunDiagnosticsCommand( euroServer ); RebootCommand euroReboot = new RebootCommand( euroServer ); ShutdownCommand usShutdown = new ShutdownCommand( usServer ); RunDiagnosticsCommand usDiagnostics = new RunDiagnosticsCommand( usServer ); RebootCommand usReboot = new RebootCommand( usServer ); RunCommand( asiaShutdown ); RunCommand( asiaDiagnostics ); RunCommand( asiaReboot ); RunCommand( euroShutdown ); RunCommand( euroDiagnostics ); RunCommand( euroReboot ); RunCommand( usShutdown ); RunCommand( usDiagnostics ); RunCommand( usReboot ); }
/// <summary> /// Initializes a new instance of the <see cref="ControllerRoute"/> class. /// </summary> /// <param name="route"> /// The route. /// </param> /// <param name="controllerType"> /// The controller type. /// </param> /// <param name="invoker"> /// The invoker. /// </param> /// <param name="observableParameters"> /// The observable parameters. /// </param> public ControllerRoute(string route, Type controllerType, Invoker invoker, HashSet<string> observableParameters) { this.Route = route; this.ControllerType = controllerType; this.Invoke = invoker; this.ObservableParameters = observableParameters; }
public void Remove(Invoker targetInvoker, EventHandler handlerFunction) { if (Map.ContainsKey (targetInvoker) && Map [targetInvoker].Contains (handlerFunction)) { Map [targetInvoker].Remove (handlerFunction); targetInvoker.Invoked -= handlerFunction; } }
public int GetInvokerHandlerCount(Invoker targetInvoker) { if (Map.ContainsKey (targetInvoker)) { return Map [targetInvoker].Count; } return 0; }
/// <summary> /// Creates a task that will execute code within a new locally running thread. /// When the task terminates successfully, its result will contain the value /// returned by <paramref name="func"/>. /// </summary> /// <param name="name">The name of the task.</param> /// <param name="func">The function to perform within the thread.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="name"/> /// or <paramref name="func"/> is null.</exception> public ThreadTask(string name, Func<object> func) : base(name) { if (func == null) throw new ArgumentNullException("func"); invoker = new Invoker(func); }
/// <summary> /// Creates a task that will execute code within a new locally running thread. /// When the task terminates successfully, its result will contain the value <c>null</c>. /// </summary> /// <param name="name">The name of the task.</param> /// <param name="action">The action to perform within the thread.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="name"/> /// or <paramref name="action"/> is null.</exception> public ThreadTask(string name, Action action) : base(name) { if (action == null) throw new ArgumentNullException("action"); invoker = new Invoker(action); }
public FileLogEntryController(Invoker dispatcher = null, Func<string, LogEntryParser, ILogFileWatcher<LogEntry>> createLogFileWatcher = null, IPersist persist = null) { Entries = new ObservableCollection<LogEntryViewModel>(); this.watcherFactory = createLogFileWatcher??CreateLogFileWatcher; wrappedDispatcher = dispatcher ?? new WrappedDispatcher().Invoke; Counter = new LogEntryCounter(Entries); this.recentFileList = new RecentFileList(persist?? new XmlPersister(ApplicationAttributes.Get(),9)); }
static Invoker VoiceCall, VideoCall, Chat; //Add more commands here #endregion Fields #region Constructors public Command(IReceiver receiver, CommandType type) { VoiceCall = receiver.MakeAVoiceCall; VideoCall = receiver.MakeAVideoCall; Chat = receiver.StartChat; SendFile = receiver.SendFile; Type = type; }
static void Main(string[] args) { var receiver = new Receiver (); var command = new ConcreteCommand (receiver); var invoker = new Invoker (); invoker.Command = command; invoker.ExecuteCommand (); }
public static void Main() { IReceiver receiver = new Receiver(); Command command = new ConcreteCommand(receiver); Invoker invoker = new Invoker(); invoker.SetCommand(command); invoker.ExecuteCommand(); }
static void Main(string[] args) { Application app = new Application(); Invoker invoker = new Invoker(app); // here comes the magic // the Invoker executes one of the action methods in app object or displays help invoker.Invoke(args); }
static void Main(string[] args) { Receiver receiver = new Receiver(); Command command = new ConcreteCommand(receiver); Invoker invoker = new Invoker(); invoker.SetCommand(command); invoker.ExecuteCommand(); Console.Read(); }
public static void Main( string[] args ) { // Create receiver, command, and invoker Receiver r = new Receiver(); Command c = new ConcreteCommand( r ); Invoker i = new Invoker(); // Set and execute command i.SetCommand(c); i.ExecuteCommand(); }
public static void Test() { var invoker = new Invoker(); invoker.Compute("request 1"); invoker.Compute("request 1"); invoker.Compute("request 1"); invoker.Compute("request 1"); invoker.Undo(1); invoker.Redo(2); }
public override bool TryGetMember(GetMemberBinder binder, out object result) { if (!base.TryGetMember(binder, out result)) { var tInterface = CallTarget.GetType().GetInterface(_extendedType.Name, false); result = new Invoker(binder.Name, tInterface.IsGenericType ? tInterface.GetGenericArguments() : new Type[] {},null, this); } return true; }
/// <summary> /// This method enables a Task to be started from asp.net 4.5 without requiring an async method to await it. /// </summary> public void QueueBackgroundWorkItem(Func<CancellationToken, Task> action) { var invoker = new Invoker(this, action); if (HostingEnvironment.IsHosted) { QueueuHostedTask(invoker.Invoke); } else { Task.Run(() => invoker.Invoke(ShutdownToken)); } }
/// <summary> /// Entry point into console application. /// </summary> static void Demo() { // Create receiver, command, and invoker Receiver receiver = new Receiver(); Command command = new ConcreteCommand(receiver); Invoker invoker = new Invoker(); // Set and execute command invoker.SetCommand(command); invoker.ExecuteCommand(); // Wait for user Console.ReadKey(); }
// void UnitTest () { Invoker theInvoker = new Invoker(); Command theCommand = null; // 獎命令與執行結合 theCommand = new ConcreteCommand1( new Receiver1(),"你好"); theInvoker.AddCommand( theCommand ); theCommand = new ConcreteCommand2( new Receiver2(),999); theInvoker.AddCommand( theCommand ); // 執行 theInvoker.ExecuteCommand(); }
public void CanTestCommand() { /* The invoker doesn't know anything about the receiver. * That's the point of the Command pattern. */ var invoker = new Invoker(); /* Invoking a ConcreteCommand will only set the property Result * to 42. The property Result of the Invoker is an array of each * result added into the Invoker through the method AddCommand */ invoker.AddCommand(new Command(new Receiver())); invoker.AddCommand(new Command(new Receiver())); invoker.AddCommand(new Command(new Receiver())); invoker.Invoke(); foreach (var result in invoker.Result) { Assert.AreEqual(42, result); } }
public void GetParamValue_Throws_ArgumentException_When_Parameter_Missing_For_Non_Optional() { string[] args = new[] { "bar1"}; var app = new TestApp1(); var invoker = new Invoker(app); invoker.Invoke(args); }
void StubViewOnPaperSelectedInvoker() { OnPaperSelectedInvoker = new Invoker (); MockView.SetupGet (view => view.OnPaperSelected).Returns (OnPaperSelectedInvoker); }
public void OneColorGradient(Int32 style, Int32 variant, Single degree) { object[] paramsArray = Invoker.ValidateParamsArray(style, variant, degree); Invoker.Method(this, "OneColorGradient", paramsArray); }
void TimerTextBlock_Loaded(object sender, RoutedEventArgs e) { Binding binding = new Binding("TimeSpan"); binding.Source = this; binding.Mode = BindingMode.OneWay; binding.StringFormat = TimeFormat; SetBinding(TextProperty, binding); _UpdateTimeInvoker = new Invoker(UpdateTime); OnTick += new EventHandler(TimerTextBlock_OnTick); }
public void Patterned(Int32 pattern) { object[] paramsArray = Invoker.ValidateParamsArray(pattern); Invoker.Method(this, "Patterned", paramsArray); }
public void PresetTextured(Int32 presetTexture) { object[] paramsArray = Invoker.ValidateParamsArray(presetTexture); Invoker.Method(this, "PresetTextured", paramsArray); }
public void AddMemberPropertyField(string property, object propertyOrder, object propertyDisplayedIn) { object[] paramsArray = Invoker.ValidateParamsArray(property, propertyOrder, propertyDisplayedIn); Invoker.Method(this, "AddMemberPropertyField", paramsArray); }
public void Delete() { Invoker.Method(this, "Delete", null); }
public void Refresh() { object[] paramsArray = null; Invoker.Method(this, "Refresh", paramsArray); }
public void AboutBox() { object[] paramsArray = null; Invoker.Method(this, "AboutBox", paramsArray); }
public void OLEDrag() { object[] paramsArray = null; Invoker.Method(this, "OLEDrag", paramsArray); }
public void StartLabelEdit() { object[] paramsArray = null; Invoker.Method(this, "StartLabelEdit", paramsArray); }
public void Change(NetOffice.OfficeApi.CommandBarComboBox ctrl) { object[] paramsArray = Invoker.ValidateParamsArray(ctrl); Invoker.Method(this, "Change", paramsArray); }
public void set_IndexedValue(object index1, object index2, object index3, object value) { object[] paramsArray = Invoker.ValidateParamsArray(index1, index2, index3); Invoker.PropertySet(this, "IndexedValue", paramsArray, value); }
public void Delete() { object[] paramsArray = null; Invoker.Method(this, "Delete", paramsArray); }
public void set_Selected(object index, object value) { object[] paramsArray = Invoker.ValidateParamsArray(index); Invoker.PropertySet(this, "Selected", paramsArray, value); }
public void Replace(string original, string replacement) { object[] paramsArray = Invoker.ValidateParamsArray(original, replacement); Invoker.Method(this, "Replace", paramsArray); }
public void SelectAll() { object[] paramsArray = null; Invoker.Method(this, "SelectAll", paramsArray); }
public static LogFunc SetDefaultHandler (LogFunc log_func) { if (native_handler == null) native_handler = new LogFuncNative (NativeCallback); LogFuncNative prev = g_log_set_default_handler (native_handler, (IntPtr) GCHandle.Alloc (log_func)); if (prev == null) return null; Invoker invoker = new Invoker (prev); return invoker.Handler; }
public void Solid() { object[] paramsArray = null; Invoker.Method(this, "Solid", paramsArray); }
public void Apply() { object[] paramsArray = null; Invoker.Method(this, "Apply", paramsArray); }
public void TwoColorGradient(Int32 style, Int32 variant) { object[] paramsArray = Invoker.ValidateParamsArray(style, variant); Invoker.Method(this, "TwoColorGradient", paramsArray); }
public void raiseEvent(string name, object eventData) { object[] paramsArray = Invoker.ValidateParamsArray(name, eventData); Invoker.Method(this, "raiseEvent", paramsArray); }
private bool IsPropertyValueMatches(dynamic parent, Dictionary<String, object> PropValuePair) { Invoker invoker = new Invoker(parent); foreach (String key in PropValuePair.Keys) { object val = invoker.GetProperty(key); if (val == null) { return false; } if (!PropValuePair[key].Equals("" + val)) { return false; } } return true; }
public void bubbleEvent() { object[] paramsArray = null; Invoker.Method(this, "bubbleEvent", paramsArray); }
/// <summary> /// /// </summary> /// <param name="game"></param> public ListVariables ( Invoker invoker ) : base(invoker) { }
public void setContextMenu(object menuItemPairs) { object[] paramsArray = Invoker.ValidateParamsArray(menuItemPairs); Invoker.Method(this, "setContextMenu", paramsArray); }
void StubViewFilterInvoker() { FilterInvoker = new Invoker (); MockView.SetupGet (view => view.Filter).Returns (FilterInvoker); }
public void _Dummy12() { object[] paramsArray = null; Invoker.Method(this, "_Dummy12", paramsArray); }
/// <summary> /// /// </summary> /// <param name="game"></param> public Set( Invoker invoker ) : base(invoker) { }
public void PresetGradient(Int32 style, Int32 variant, Int32 presetGradientType) { object[] paramsArray = Invoker.ValidateParamsArray(style, variant, presetGradientType); Invoker.Method(this, "PresetGradient", paramsArray); }
/// <summary> /// /// </summary> /// <param name="game"></param> public Help ( Invoker invoker ) : base(invoker) { }
public void UserTextured(string textureFile) { object[] paramsArray = Invoker.ValidateParamsArray(textureFile); Invoker.Method(this, "UserTextured", paramsArray); }
public void Modify() { Invoker.Method(this, "Modify", null); }
public void UserPicture(object pictureFile, object pictureFormat, object pictureStackUnit, object picturePlacement) { object[] paramsArray = Invoker.ValidateParamsArray(pictureFile, pictureFormat, pictureStackUnit, picturePlacement); Invoker.Method(this, "UserPicture", paramsArray); }
public void _AddMemberPropertyField(string property) { object[] paramsArray = Invoker.ValidateParamsArray(property); Invoker.Method(this, "_AddMemberPropertyField", paramsArray); }
public void NotifyEndOfTestSuiteRun() { object[] paramsArray = null; Invoker.Method(this, "NotifyEndOfTestSuiteRun", paramsArray); }
/// <summary> /// Tries the index of the get. /// </summary> /// <param name="binder">The binder.</param> /// <param name="indexes">The indexes.</param> /// <param name="result">The result.</param> /// <returns></returns> public override bool TryGetIndex(GetIndexBinder binder, object[] indexes, out object result) { result = new Invoker(Name, GenericParams, GenericMethodParameters, Parent, indexes.Select(it => Dynamic.InvokeConvert(it, typeof(Type), @explicit: true)).Cast<Type>().ToArray()); return true; }
public void ClearManualFilter() { object[] paramsArray = null; Invoker.Method(this, "ClearManualFilter", paramsArray); }
/// <summary> /// /// </summary> /// <param name="game"></param> public ListCommands( Invoker invoker ) : base(invoker) { }
public void CreatePivotFields() { object[] paramsArray = null; Invoker.Method(this, "CreatePivotFields", paramsArray); }