Beispiel #1
0
        public void SerializationCallbackTes()
        {
            {
                var before = false;

                var c1 = new Callback2(0, () => before = true, () => { });
                var d  = MessagePackSerializer.Serialize(c1);
                before.IsTrue();
                Callback2.CalledAfter = false;
                MessagePackSerializer.Deserialize <Callback2>(d);
                Callback2.CalledAfter.IsTrue();
            }
            {
                var c1 = new Callback1_2(0);
                var d  = MessagePackSerializer.Serialize(c1);
                c1.CalledBefore.IsTrue();
                MessagePackSerializer.Deserialize <Callback1_2>(d).CalledAfter.IsTrue();
            }
            {
                var before = false;

                var c1 = new Callback2_2(0, () => before = true, () => { });
                var d  = MessagePackSerializer.Serialize(c1);
                before.IsTrue();

                Callback2.CalledAfter = false;
                MessagePackSerializer.Deserialize <Callback2_2>(d);
                Callback2_2.CalledAfter.IsTrue();
            }
        }
Beispiel #2
0
        public void Initialize()
        {
            var sc = IntPtr.Size == 8 ? OpenSCManager_64() : OpenSCManager_32();

            var cb = new Callback2(ReadStatuses2);

            if (IntPtr.Size == 8)
            {
                EnumServices_64(cb);
            }
            else
            {
                EnumServices_32(cb);
            }
        }
Beispiel #3
0
        internal CallbackBinder(Callback callback)
        {
            this.OnWidgetLoaded = new CallbackVoid(callback.OnWidgetLoaded);

            this.OnStateChange = new CallbackOnStateChange(callback.OnStateChange);

            this.OnProgress        = new CallbackOnProgress(callback.OnProgress);
            this.OnLocationChanged = new CallbackOnLocationChanged(callback.OnLocationChanged);
            this.OnStatusChange    = new CallbackOnStatusChange(callback.OnStatusChange);
            this.OnSecurityChange  = new CallbackOnSecurityChange(callback.OnSecurityChange);

            this.OnKeyDown  = new KeyCallback(callback.OnClientDomKeyDown);
            this.OnKeyUp    = new KeyCallback(callback.OnClientDomKeyUp);
            this.OnKeyPress = new KeyCallback(callback.OnClientDomKeyPress);

            this.OnMouseDown        = new MouseCallback(callback.OnClientMouseDown);
            this.OnMouseUp          = new MouseCallback(callback.OnClientMouseUp);
            this.OnMouseClick       = new MouseCallback(callback.OnClientMouseClick);
            this.OnMouseDoubleClick = new MouseCallback(callback.OnClientMouseDoubleClick);
            this.OnMouseOver        = new MouseCallback(callback.OnClientMouseOver);
            this.OnMouseOut         = new MouseCallback(callback.OnClientMouseOut);

            this.OnActivate = new Callback2(callback.OnClientActivate);
            this.OnFocus    = new Callback2(callback.OnClientFocus);
            this.OnBlur     = new Callback2(callback.OnClientBlur);

            this.OnAlert        = new CallbackPtrPtr(callback.OnAlert);
            this.OnAlertCheck   = new CallbackOnAlertCheck(callback.OnAlertCheck);
            this.OnConfirm      = new CallbackOnConfirm(callback.OnConfirm);
            this.OnConfirmCheck = new CallbackOnConfirmCheck(callback.OnConfirmCheck);
            this.OnConfirmEx    = new CallbackOnConfirmEx(callback.OnConfirmEx);
            this.OnPrompt       = new CallbackOnPrompt(callback.OnPrompt);
            this.OnPromptUsernameAndPassword = new CallbackOnPromptUsernameAndPassword(callback.OnPromptUsernameAndPassword);
            this.OnPromptPassword            = new CallbackOnPromptPassword(callback.OnPromptPassword);
            this.OnSelect = new CallbackOnSelect(callback.OnSelect);

            this.OnLoad   = new CallbackVoid(callback.OnLoad);
            this.OnUnload = new CallbackVoid(callback.OnUnload);

            this.OnShowContextMenu = new CallbackOnShowContextMenu(callback.OnShowContextMenu);

            this.OnGeneric = new CallbackWString(callback.OnGeneric);
        }
Beispiel #4
0
 public static dynamic sendTunnelWait(string _id, dynamic _data, Callback2 callback)
 {
     //for (int i = 0; i < 10; i++)
     {
         dynamic        ret     = null;
         AutoResetEvent blocker = new AutoResetEvent(false);
         callbacks[_id] = (d) =>
         {
             ret = callback(d);
             blocker.Set();
         };
         sendTunnel(_id, _data);
         if (blocker.WaitOne())
         {
             Connection.callbacks.Remove(_id);
             return(ret);
         }
         Connection.callbacks.Remove(_id);
     }
     return(null);
 }
Beispiel #5
0
        // void TestServiceWithCallback2.Ping1(int code, Callback1 callback) {
        // callback.Pong(code * 2);
        // }

        public void Ping2(int code, Callback2 callback)
        {
            callback.Pong(code);
        }
Beispiel #6
0
 public static extern void be_function2(Callback2 callback);
		internal CallbackBinder (Callback callback) {
			this.OnWidgetLoaded			= new CallbackVoid (callback.OnWidgetLoaded);

			this.OnStateChange			= new CallbackOnStateChange (callback.OnStateChange);

			this.OnProgress				= new CallbackOnProgress (callback.OnProgress);
			this.OnLocationChanged		= new CallbackOnLocationChanged (callback.OnLocationChanged);
			this.OnStatusChange			= new CallbackOnStatusChange (callback.OnStatusChange);
			this.OnSecurityChange		= new CallbackOnSecurityChange (callback.OnSecurityChange);

			this.OnKeyDown				= new KeyCallback (callback.OnClientDomKeyDown);
			this.OnKeyUp				= new KeyCallback (callback.OnClientDomKeyUp);
			this.OnKeyPress				= new KeyCallback (callback.OnClientDomKeyPress);

			this.OnMouseDown			= new MouseCallback (callback.OnClientMouseDown);
			this.OnMouseUp				= new MouseCallback (callback.OnClientMouseUp);
			this.OnMouseClick			= new MouseCallback (callback.OnClientMouseClick);
			this.OnMouseDoubleClick		= new MouseCallback (callback.OnClientMouseDoubleClick);
			this.OnMouseOver			= new MouseCallback (callback.OnClientMouseOver);
			this.OnMouseOut				= new MouseCallback (callback.OnClientMouseOut);

			this.OnActivate				= new Callback2 (callback.OnClientActivate);
			this.OnFocus				= new Callback2 (callback.OnClientFocus);
			this.OnBlur					= new Callback2 (callback.OnClientBlur);

			this.OnAlert				= new CallbackPtrPtr (callback.OnAlert);
			this.OnAlertCheck			= new CallbackOnAlertCheck (callback.OnAlertCheck);
			this.OnConfirm 				= new CallbackOnConfirm (callback.OnConfirm);
			this.OnConfirmCheck 		= new CallbackOnConfirmCheck (callback.OnConfirmCheck);
			this.OnConfirmEx 			= new CallbackOnConfirmEx (callback.OnConfirmEx);
			this.OnPrompt 				= new CallbackOnPrompt (callback.OnPrompt);
			this.OnPromptUsernameAndPassword = new CallbackOnPromptUsernameAndPassword (callback.OnPromptUsernameAndPassword);
			this.OnPromptPassword 		= new CallbackOnPromptPassword (callback.OnPromptPassword);
			this.OnSelect 				= new CallbackOnSelect (callback.OnSelect);

			this.OnLoad 				= new CallbackVoid (callback.OnLoad);
			this.OnUnload 				= new CallbackVoid (callback.OnUnload);
			
			this.OnShowContextMenu		= new CallbackOnShowContextMenu (callback.OnShowContextMenu);
			
			this.OnGeneric				= new CallbackWString (callback.OnGeneric);
		}
Beispiel #8
0
 private static extern bool EnumServices_64(Callback2 callback);
Beispiel #9
0
 public void AddEventCallback2(Callback2 callback2)
 {
     this.callback2 += callback2;
 }
Beispiel #10
0
 public MoveDetect(Callback beginFunc, Callback2 endFunc, Callback continueFunc)
 {
     beginMoving    += beginFunc;
     endMoving      += endFunc;
     continueMoving += continueFunc;
 }
        // void TestServiceWithCallback2.Ping1(int code, Callback1 callback) {
            // callback.Pong(code * 2);
        // }

        public void Ping2(int code, Callback2 callback) {
            callback.Pong(code);
        }