示例#1
0
        public void OnLoad(IMubox mubox)
        {
            "AntiAfk::OnLoad".Log();
            _mubox = mubox;
            (_mubox as MarshalByRefObject).GetLifetimeService();

            _onActiveClientChanged      = new ProxyEventHandler <ClientEventArgs>(_mubox_ActiveClientChanged);
            _mubox.ActiveClientChanged += _onActiveClientChanged.Proxy;

            _onKeyboardInputReceived       = new ProxyEventHandler <Mubox.Extensibility.Input.KeyboardEventArgs>(Keyboard_InputReceived);
            _mubox.Keyboard.InputReceived += _onKeyboardInputReceived.Proxy;

            _onMouseInputReceived       = new ProxyEventHandler <Mubox.Extensibility.Input.MouseEventArgs>(Mouse_InputReceived);
            _mubox.Mouse.InputReceived += _onMouseInputReceived.Proxy;

            _exitYet = false;

            Show();
        }
示例#2
0
        public void OnLoad(IMubox mubox)
        {
            "AntiAfk::OnLoad".Log();
            _mubox = mubox;
            (_mubox as MarshalByRefObject).GetLifetimeService();

            _onActiveClientChanged = new ProxyEventHandler<ClientEventArgs>(_mubox_ActiveClientChanged);
            _mubox.ActiveClientChanged += _onActiveClientChanged.Proxy;

            _onKeyboardInputReceived = new ProxyEventHandler<Mubox.Extensibility.Input.KeyboardEventArgs>(Keyboard_InputReceived);
            _mubox.Keyboard.InputReceived += _onKeyboardInputReceived.Proxy;

            _onMouseInputReceived = new ProxyEventHandler<Mubox.Extensibility.Input.MouseEventArgs>(Mouse_InputReceived);
            _mubox.Mouse.InputReceived += _onMouseInputReceived.Proxy;

            _exitYet = false;

            Show();
        }
示例#3
0
        public void OnLoad(IMubox mubox)
        {
            "Console::OnLoad".Log();
            _mubox = mubox;

            _onActiveClientChanged      = new ProxyEventHandler <ClientEventArgs>(_mubox_ActiveClientChanged);
            _mubox.ActiveClientChanged += _onActiveClientChanged.Proxy;

            _onKeyboardInputReceived       = new ProxyEventHandler <Mubox.Extensibility.Input.KeyboardEventArgs>(Keyboard_InputReceived);
            _mubox.Keyboard.InputReceived += _onKeyboardInputReceived.Proxy;

            _onMouseInputReceived       = new ProxyEventHandler <Mubox.Extensibility.Input.MouseEventArgs>(Mouse_InputReceived);
            _mubox.Mouse.InputReceived += _onMouseInputReceived.Proxy;

            _exitYet = false;

            //_mubox.AddServiceProvider(this);

            Show();
        }
示例#4
0
        public void OnLoad(IMubox mubox)
        {
            "Console::OnLoad".Log();
            _mubox = mubox;

            _onActiveClientChanged = new ProxyEventHandler<ClientEventArgs>(_mubox_ActiveClientChanged);
            _mubox.ActiveClientChanged += _onActiveClientChanged.Proxy;

            _onKeyboardInputReceived = new ProxyEventHandler<Mubox.Extensibility.Input.KeyboardEventArgs>(Keyboard_InputReceived);
            _mubox.Keyboard.InputReceived += _onKeyboardInputReceived.Proxy;

            _onMouseInputReceived = new ProxyEventHandler<Mubox.Extensibility.Input.MouseEventArgs>(Mouse_InputReceived);
            _mubox.Mouse.InputReceived += _onMouseInputReceived.Proxy;

            _exitYet = false;

            //_mubox.AddServiceProvider(this);

            Show();
        }
示例#5
0
        /// <summary>
        /// Represents the proxy method that will handle various routed events that do not
        /// have specific event data beyond the data that is common for all routed events.
        /// </summary>
        /// <param name="sender">The object which is the originator of the event.</param>
        /// <param name="e">The event data.</param>
        public void RoutedEventHandlerProxy(object sender, T e)
        {
            if ((_handler == null) && (!_errorInHandlerSetup))
            {
                // Try to get a proper handler
                var element = sender as DependencyObject;
                if (element != null)
                {
                    var sourceBaseProvided = BindHelper.LocateValidDependencyPropertyByAllTrees(element, FrameworkElement.DataContextProperty, _methodName, _propertyName);
                    if (sourceBaseProvided != null)
                    {
                        try
                        {
                            if (!string.IsNullOrEmpty(_methodName))
                            {
                                _handler = (ProxyEventHandler)BindHelper.EventHandlerDelegateFromMethod(_methodName, sourceBaseProvided, typeof(ProxyEventHandler));
                            }
                            if (!string.IsNullOrEmpty(_propertyName))
                            {
                                _handler = (ProxyEventHandler)BindHelper.EventHandlerDelegateFromProperty(_propertyName, sourceBaseProvided, typeof(ProxyEventHandler));
                            }
                        }
#if DEBUG
                        catch (Exception ex)
                        {
                            // Should cause an exception if binding was not resolved.
                            Debug.WriteLine($"Cannot create delegate: {_methodName}|{_propertyName} for {sourceBaseProvided} Exception: {ex.Message}");
#else
                        catch
                        {
#endif
                            _errorInHandlerSetup = true;
                        }
                    }
                }
            }
            if (_handler != null)
            {
                _handler(sender, e);
            }
        }