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;
 }
示例#5
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);
        }
示例#6
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 <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));
 }
示例#8
0
        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;
        }
示例#9
0
        static void Main(string[] args)
        {
            var receiver = new Receiver ();
              var command = new ConcreteCommand (receiver);
              var invoker = new Invoker ();

              invoker.Command = command;
              invoker.ExecuteCommand ();
        }
示例#10
0
        public static void Main()
        {
            IReceiver receiver = new Receiver();
            Command command = new ConcreteCommand(receiver);
            Invoker invoker = new Invoker();

            invoker.SetCommand(command);
            invoker.ExecuteCommand();
        }
示例#11
0
        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);
        }
示例#12
0
        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();
        }
示例#13
0
  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();

  }
示例#14
0
        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;
        }
示例#16
0
        /// <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));
            }
        }
示例#17
0
        /// <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();
        }
示例#18
0
	// 
	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();

	}
示例#19
0
        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);
            }
        }
示例#20
0
 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);
 }
示例#22
0
 public void OneColorGradient(Int32 style, Int32 variant, Single degree)
 {
     object[] paramsArray = Invoker.ValidateParamsArray(style, variant, degree);
     Invoker.Method(this, "OneColorGradient", paramsArray);
 }
示例#23
0
        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);
        }
示例#24
0
 public void Patterned(Int32 pattern)
 {
     object[] paramsArray = Invoker.ValidateParamsArray(pattern);
     Invoker.Method(this, "Patterned", paramsArray);
 }
示例#25
0
 public void PresetTextured(Int32 presetTexture)
 {
     object[] paramsArray = Invoker.ValidateParamsArray(presetTexture);
     Invoker.Method(this, "PresetTextured", paramsArray);
 }
示例#26
0
		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);
 }
示例#28
0
 public void Refresh()
 {
     object[] paramsArray = null;
     Invoker.Method(this, "Refresh", paramsArray);
 }
示例#29
0
 public void AboutBox()
 {
     object[] paramsArray = null;
     Invoker.Method(this, "AboutBox", paramsArray);
 }
示例#30
0
 public void OLEDrag()
 {
     object[] paramsArray = null;
     Invoker.Method(this, "OLEDrag", paramsArray);
 }
示例#31
0
 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);
 }
示例#33
0
		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);
		}
示例#34
0
		public void Delete()
		{
			object[] paramsArray = null;
			Invoker.Method(this, "Delete", paramsArray);
		}
示例#35
0
 public void set_Selected(object index, object value)
 {
     object[] paramsArray = Invoker.ValidateParamsArray(index);
     Invoker.PropertySet(this, "Selected", paramsArray, value);
 }
示例#36
0
文件: Fonts.cs 项目: zyfzgt/NetOffice
 public void Replace(string original, string replacement)
 {
     object[] paramsArray = Invoker.ValidateParamsArray(original, replacement);
     Invoker.Method(this, "Replace", paramsArray);
 }
示例#37
0
 public void SelectAll()
 {
     object[] paramsArray = null;
     Invoker.Method(this, "SelectAll", paramsArray);
 }
示例#38
0
		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;
		}
示例#39
0
 public void Solid()
 {
     object[] paramsArray = null;
     Invoker.Method(this, "Solid", paramsArray);
 }
示例#40
0
 public void Apply()
 {
     object[] paramsArray = null;
     Invoker.Method(this, "Apply", paramsArray);
 }
示例#41
0
 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);
 }
示例#43
0
 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);
 }
示例#45
0
		/// <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);
 }
示例#48
0
 public void _Dummy12()
 {
     object[] paramsArray = null;
     Invoker.Method(this, "_Dummy12", paramsArray);
 }
示例#49
0
文件: Set.cs 项目: temik911/audio
 /// <summary>
 /// 
 /// </summary>
 /// <param name="game"></param>
 public Set( Invoker invoker )
     : base(invoker)
 {
 }
示例#50
0
 public void PresetGradient(Int32 style, Int32 variant, Int32 presetGradientType)
 {
     object[] paramsArray = Invoker.ValidateParamsArray(style, variant, presetGradientType);
     Invoker.Method(this, "PresetGradient", paramsArray);
 }
示例#51
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="game"></param>
		public Help ( Invoker invoker ) : base(invoker)
		{
		}
示例#52
0
 public void UserTextured(string textureFile)
 {
     object[] paramsArray = Invoker.ValidateParamsArray(textureFile);
     Invoker.Method(this, "UserTextured", paramsArray);
 }
 public void Modify()
 {
     Invoker.Method(this, "Modify", null);
 }
示例#54
0
 public void UserPicture(object pictureFile, object pictureFormat, object pictureStackUnit, object picturePlacement)
 {
     object[] paramsArray = Invoker.ValidateParamsArray(pictureFile, pictureFormat, pictureStackUnit, picturePlacement);
     Invoker.Method(this, "UserPicture", paramsArray);
 }
示例#55
0
		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;
 }
示例#58
0
		public void ClearManualFilter()
		{
			object[] paramsArray = null;
			Invoker.Method(this, "ClearManualFilter", paramsArray);
		}
示例#59
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="game"></param>
 public ListCommands( Invoker invoker )
     : base(invoker)
 {
 }
示例#60
0
		public void CreatePivotFields()
		{
			object[] paramsArray = null;
			Invoker.Method(this, "CreatePivotFields", paramsArray);
		}