Exemplo n.º 1
0
        public void SilverlightModuleCLoadedOnDemand()
        {
            AutomationElement aeModuleC = ModularityPage <SilverlightAppLauncher> .ModuleCContent;

            Thread.Sleep(1000);
            Assert.IsNotNull(aeModuleC);

            //Get the clickable point and click on it.
            System.Windows.Point point =
                new System.Windows.Point(aeModuleC.Current.BoundingRectangle.X + aeModuleC.Current.BoundingRectangle.Width / 2,
                                         aeModuleC.Current.BoundingRectangle.Y + aeModuleC.Current.BoundingRectangle.Height / 2);
            System.Windows.Forms.Cursor.Position = new System.Drawing.Point((int)point.X, (int)point.Y);
            Thread.Sleep(2000);
            MouseEvents.Click();
            MouseEvents.Click();
            Thread.Sleep(1000);

            System.Windows.Point point1 =
                new System.Windows.Point(aeModuleC.Current.BoundingRectangle.Width / 2,
                                         aeModuleC.Current.BoundingRectangle.Height / 2);
            System.Windows.Forms.Cursor.Position = new System.Drawing.Point((int)point1.X, (int)point1.Y);
            Thread.Sleep(1000);
            System.Windows.Forms.Cursor.Position = new System.Drawing.Point((int)point.X, (int)point.Y);
            Thread.Sleep(1000);
            AutomationElement aeModCtooltip = ModularityPage <SilverlightAppLauncher> .IntializedModuletooltip;

            Assert.IsFalse(aeModCtooltip.Current.IsOffscreen, "Module C Tooltip is offscreen");
        }
Exemplo n.º 2
0
        public void SubscribeToEvent(Interaction.InteractionTypeEnum interactionType)
        {
            //subscribe to the specified event type (selection, mouse etc.)
            object eventType = null;

            m_interaction.SubscribeToEvent(interactionType, ref eventType);

            if (eventType != null)
            {
                if (eventType is SelectEvents)
                {
                    m_selectEvents = (SelectEvents)eventType;
                }

                if (eventType is MouseEvents)
                {
                    m_mouseEvents = (MouseEvents)eventType;
                }

                if (eventType is TriadEvents)
                {
                    m_triadEvents = (TriadEvents)eventType;
                }
            }
        }
Exemplo n.º 3
0
        public void RaiseMouseEvent(MouseEvents mEv, MouseEventArgs mArgs)
        {
            userMouseEvent = mEv;
            userMouseArgs  = mArgs;

            ProccessMouse(new Drawing.PointF(mArgs.X, mArgs.Y));
        }
Exemplo n.º 4
0
        /////////////////////////////////////////////////////////////
        // use: Initializes event handlers
        //
        /////////////////////////////////////////////////////////////
        public void Initialize()
        {
            _InteractionEvents =
                _Application.CommandManager.CreateInteractionEvents();

            _SelectEvents = _InteractionEvents.SelectEvents;
            _MouseEvents  = _InteractionEvents.MouseEvents;

            _SelectEvents.Enabled             = true;
            _SelectEvents.SingleSelectEnabled = false;

            _SelectEvents.OnPreSelect +=
                new SelectEventsSink_OnPreSelectEventHandler(
                    SelectEvents_OnPreSelect);

            _SelectEvents.OnSelect +=
                new SelectEventsSink_OnSelectEventHandler(
                    SelectEvents_OnSelect);

            _SelectEvents.OnUnSelect +=
                new SelectEventsSink_OnUnSelectEventHandler(
                    SelectEvents_OnUnSelect);

            _InteractionEvents.OnTerminate +=
                new InteractionEventsSink_OnTerminateEventHandler(
                    InteractionEvents_OnTerminate);
        }
Exemplo n.º 5
0
        protected override void OnMouseEvent(MouseEvents mEvent, MouseHookEventArgs mea)
        {
            switch (mEvent)
            {
            case MouseEvents.LeftButtonUp:
                Fire_LeftButtonUp(mea);
                break;

            case MouseEvents.LeftButtonDown:
                Fire_LeftButtonDown(mea);
                break;

            case MouseEvents.RightButtonUp:
                Fire_RightButtonUp(mea);
                break;

            case MouseEvents.RightButtonDown:
                Fire_RightButtonDown(mea);
                break;

            case MouseEvents.MouseWheel:
                Fire_MouseWheel(mea);
                break;

            case MouseEvents.Move:
                Fire_Move(mea);
                break;
            }
        }
Exemplo n.º 6
0
 public KeyInfo(int key, int modifier,
                MouseEvents mouseEvent = MouseEvents.None)
 {
     Key        = key;
     Modifier   = modifier;
     MouseEvent = mouseEvent;
 }
Exemplo n.º 7
0
 public void RaiseMouseEvent(MouseEvents mEv, MouseEventArgs mArgs)
 {
     if (mArgs != null)
     {
         ProccessMouse(mEv, mArgs.X, mArgs.Y, mArgs.Button, mArgs.Clicks, mArgs.Delta);
     }
 }
Exemplo n.º 8
0
        private static string GetMouseEventExplanation(int button, MouseEvents mouseEvent)
        {
            string explanation = "";

            if (button == 1)
            {
                explanation = "Left Mouse Button";
            }
            if (button == 2)
            {
                explanation = "Right Mouse Button";
            }
            if (button == 4)
            {
                explanation = "Middle Mouse Button";
            }

            if (mouseEvent == MouseEvents.Click)
            {
                explanation += "\nClick";
            }
            if (mouseEvent == MouseEvents.DoubleClick)
            {
                explanation += "\nDouble Click";
            }
            if (mouseEvent == MouseEvents.Down)
            {
                explanation += "\nDown";
            }

            return(explanation);
        }
        //[Ignore]
        public void DesktopLoadModuleFAndDependency()
        {
            //Check if Module F is already loaded
            AutomationElement aeModuleF            = ModularityPage <WpfAppLauncher> .ModuleF;
            AutomationElement aeClickToloadModuleF = aeModuleF.FindElementByContent(new ResXConfigHandler(ConfigHandler.GetValue("ControlIdentifiersFile")).GetValue("ClickToLoadTextBlock"));

            Assert.IsFalse(aeClickToloadModuleF.Current.IsOffscreen, "Module F is initialized");

            //Get the clickable point and click on it.
            System.Windows.Point clickablePoint = aeModuleF.GetClickablePoint();
            System.Windows.Forms.Cursor.Position = new System.Drawing.Point((int)clickablePoint.X, (int)clickablePoint.Y);
            Thread.Sleep(1000);
            MouseEvents.Click();
            Thread.Sleep(1000);
            //Check if depency module (Module E) is loaded
            AutomationElement aeModuleE         = ModularityPage <WpfAppLauncher> .ModuleE;
            AutomationElement aeClickToloadModE = aeModuleE.FindElementByContent(new ResXConfigHandler(ConfigHandler.GetValue("ControlIdentifiersFile")).GetValue("ClickToLoadTextBlock"));

            Assert.IsTrue(aeClickToloadModE.Current.IsOffscreen, "Module E is not initialized");

            //Check if Module F is loaded
            AutomationElement aeClickToloadModF = aeModuleF.FindElementByContent(new ResXConfigHandler(ConfigHandler.GetValue("ControlIdentifiersFile")).GetValue("ClickToLoadTextBlock"));

            Assert.IsTrue(aeClickToloadModF.Current.IsOffscreen, "Module F is not initialized");
        }
Exemplo n.º 10
0
 private extern static void mouse_event(
     MouseEvents dwFlags, // 移動とクリックのオプション
     uint dx,             // 水平位置または移動量
     uint dy,             // 垂直位置または移動量
     uint dwData,         // ホイールの移動
     uint dwExtraInfo     // アプリケーション定義の情報
     );
Exemplo n.º 11
0
        public void ConvertToTable()
        {
            dataTable.Rows.Clear();
            int i = 0;

            foreach (MacroRecordEntry entry in recorder.Entries)
            {
                MacroRecordingsDataSet.MacroEntriesRow row = (MacroRecordingsDataSet.MacroEntriesRow)dataTable.NewRow();
                row.Time = (int)entry.Time;
                //row.OrigIndex = i;
                if (entry.Input.type == 0)                 //mouse input
                {
                    row.X = (int)(entry.Input.mi.dx * Screen.PrimaryScreen.Bounds.Width / 65535f);
                    row.Y = (int)(entry.Input.mi.dy * Screen.PrimaryScreen.Bounds.Height / 65535f);
                    MouseEvents evt = (MouseEvents)(entry.Input.mi.dwFlags & 0x7fff);
                    row.Action = evt.ToString();
                }
                else if (entry.Input.type == 1)                 //kb input
                {
                    if ((entry.Input.ki.dwFlags & (uint)KBEvents.KEYUP) != 0)
                    {
                        row.Pressed = false;
                    }
                    else
                    {
                        row.Pressed = true;
                    }
                    row.Key = System.Windows.Input.KeyInterop.KeyFromVirtualKey(entry.Input.ki.wVk).ToString();
                }
                dataTable.Rows.Add(row);
                i++;
            }
        }
Exemplo n.º 12
0
        private void MouseHookExt_MouseEvent(MouseEvents mEvent, System.Drawing.Point point)
        {
            switch (mEvent)
            {
            case MouseEvents.LeftButtonUp:
                Fire_LeftButtonUp(point);
                break;

            case MouseEvents.LeftButtonDown:
                Fire_LeftButtonDown(point);
                break;

            case MouseEvents.RightButtonUp:
                Fire_RightButtonUp(point);
                break;

            case MouseEvents.RightButtonDown:
                Fire_RightButtonDown(point);
                break;

            case MouseEvents.MouseWheel:
                Fire_MouseWheel(point);
                break;

            case MouseEvents.Move:
                Fire_Move(point);
                break;
            }
        }
Exemplo n.º 13
0
        void MouseAction(MouseEvents @event, MOUSEHOOKSTRUCT data, int delta)
        {
            switch (@event)
            {
            case MouseEvents.LBUTTONDOWN:
                mouseKeyStates[0].state = mouseKeyStates[0].state == ManagerKeyState.Down ? ManagerKeyState.Hold : ManagerKeyState.Down;
                break;

            case MouseEvents.LBUTTONUP:
                mouseKeyStates[0].state = ManagerKeyState.Up;
                break;

            case MouseEvents.MOUSEMOVE:
                break;

            case MouseEvents.MOUSEWHEEL:
                //MessageBox.Show("Test :" + delta);
                break;

            case MouseEvents.MOUSEHWHEEL:
                break;

            case MouseEvents.RBUTTONDOWN:
                mouseKeyStates[1].state = mouseKeyStates[1].state == ManagerKeyState.Down ? ManagerKeyState.Hold : ManagerKeyState.Down;
                break;

            case MouseEvents.RBUTTONUP:
                mouseKeyStates[1].state = ManagerKeyState.Up;
                break;

            default:
                break;
            }
        }
Exemplo n.º 14
0
        private bool MouseHookExt_MouseEvent(MouseEvents mEvent, System.Drawing.Point point)
        {
            bool ret = false;

            switch (mEvent)
            {
            case MouseEvents.LeftButtonUp:
                ret = Fire_LeftButtonUp(point);
                break;

            case MouseEvents.LeftButtonDown:
                ret = Fire_LeftButtonDown(point);
                break;

            case MouseEvents.RightButtonUp:
                ret = Fire_RightButtonUp(point);
                break;

            case MouseEvents.RightButtonDown:
                ret = Fire_RightButtonDown(point);
                break;

            case MouseEvents.MouseWheel:
                ret = Fire_MouseWheel(point);
                break;

            case MouseEvents.Move:
                ret = Fire_Move(point);
                break;
            }
            return(ret);
        }
Exemplo n.º 15
0
 public Sprite()
 {
     MoveState   = MoveOption.DYNAMIC;
     Priority    = DrawPriority.NORMAL;
     SpriteColor = Color.White;
     MouseEvent  = new MouseEvents(this);
 }
Exemplo n.º 16
0
 private void UpdateMouse()
 {
     MouseEvents.DoUpdate();
     if (OnMouseUpdate != null)
     {
         OnMouseUpdate();
     }
 }
Exemplo n.º 17
0
        public Interaction()
        {
            m_interactionTypes = new System.Collections.ArrayList();

            m_interactionEvents = null;
            m_selectEvents      = null;
            m_mouseEvents       = null;
            m_triadEvents       = null;
        }
        public SelectionDrawer(SelectionCanvas selectionCanvas, MouseEvents mouseEvents)
        {
            _selectionCanvas = selectionCanvas;
            mouseEvents.MouseDown += OnMouseDown;
            mouseEvents.MouseMove += OnMouseMove;
            mouseEvents.MouseUp += OnMouseUp;

            PrepareOverlay();
        }
        private void OnMouseEvent(MouseEvents mEvent, MouseHookEventArgs mea)
        {
            if (MouseEvent == null)
            {
                return;
            }

            MouseEvent(mEvent, mea);
        }
Exemplo n.º 20
0
        public void UnsubscribeFromEvents()
        {
            //unsubscribe from all event objects (selection, mouse etc.)
            m_interaction.UnsubscribeFromEvents();

            m_selectEvents = null;
            m_mouseEvents  = null;
            m_triadEvents  = null;
        }
Exemplo n.º 21
0
        protected virtual void OnMouseEvent(MouseEvents mEvent, MouseHookEventArgs mea)
        {
            if (MouseEvent == null)
            {
                return;
            }

            MouseEvent(mEvent, mea);
        }
Exemplo n.º 22
0
        //执行任务
        public void ExcuteTask(string applicationName, string url, int x, int y)
        {
            ProcessStartInfo ps = new ProcessStartInfo(applicationName, url);

            Process.Start(ps);
            Thread.Sleep(5000);
            MouseEvents.SetCursorPosition(x, y);
            MouseEvents.MouseOneClick();
        }
Exemplo n.º 23
0
 void LoadAttributes()
 {
     MouseEvent = new MouseEvents(this);
     TextFont   = Singleton.Font.GetFont(FontType.LUCIDA_CONSOLE);
     TextColor  = Color.White;
     Scale      = Vector2.One;
     Active     = true;
     Singleton.Content.LoadResources();
 }
Exemplo n.º 24
0
        void ProcessMotionEvents(MouseEvents eventID, int state)
        {
            var oldValue = _motionValues[eventID];

            if (state != oldValue)
            {
                _motionEvents.Add(new MotionEvent(GetEvent(eventID), state - oldValue));
                _motionValues[eventID] = state;
            }
        }
        //
        // Test methods
        //
        public void TriggerMouseAction(MouseEvents mEvent, MouseHookEventArgs mea)
        {
            if (!hookInstalled)
            {
                string msg = "Mouse trigger cannot be used when the hook is uninstalled.";
                throw new InvalidOperationException(msg);
            }

            OnMouseEvent(mEvent, mea);
        }
Exemplo n.º 26
0
 private void m_InteractionEvents_OnTerminate()
 {
     m_InteractionEvents.InteractionGraphics.PreviewClientGraphics.Delete();
     m_inventorApplication.ActiveView.Update();
     m_flagMouseDown = false;
     m_InteractionEvents.Stop();
     m_MouseEvents       = null;
     m_SelectEvents      = null;
     m_InteractionEvents = null;
 }
Exemplo n.º 27
0
        public void TranslateMouseEvent(LowLevelMouseMessage Message)
        {
            // Store which mouse event occured
            MouseEvent = (MouseEvents)Message.Message;

            // Define new MouseMessageEventArgs to get handled state
            MouseMessageEventArgs args = null;

            switch (MouseEvent)
            {
                case MouseEvents.LeftButtonDown:
                    args = new MouseMessageEventArgs(MouseButtons.Left, 1, Message.Point.X, Message.Point.Y, 0, Message);
                    OnMouseDown(args);

                    break;
                case MouseEvents.LeftButtonUp:
                    args = new MouseMessageEventArgs(MouseButtons.Left, 1, Message.Point.X, Message.Point.Y, 0, Message);
                    OnMouseUp(args);

                    break;
                case MouseEvents.RightButtonDown:
                    args = new MouseMessageEventArgs(MouseButtons.Right, 1, Message.Point.X, Message.Point.Y, 0, Message);
                    OnMouseDown(args);

                    break;
                case MouseEvents.RightButtonUp:
                    args = new MouseMessageEventArgs(MouseButtons.Right, 1, Message.Point.X, Message.Point.Y, 0, Message);
                    OnMouseUp(args);

                    break;
                case MouseEvents.MiddleButtonDown:
                    args = new MouseMessageEventArgs(MouseButtons.Middle, 1, Message.Point.X, Message.Point.Y, 0, Message);
                    OnMouseDown(args);

                    break;
                case MouseEvents.MiddleButtonUp:
                    args = new MouseMessageEventArgs(MouseButtons.Middle, 1, Message.Point.X, Message.Point.Y, 0, Message);
                    OnMouseUp(args);

                    break;
                case MouseEvents.Move:
                    args = new MouseMessageEventArgs(MouseButtons.None, 0, Message.Point.X, Message.Point.Y, 0, Message);
                    OnMouseMove(args);

                    break;
                default:
                    args = new MouseMessageEventArgs(MouseButtons.None, 0, 0, 0, 0, Message);	// Catch additional buttons

                    break;
            }

            // Set handled property of class to MouseMessageEventArgs handled flag to notify the main mouse intercept that one of the events handled it
            this.Handled = args.Handled;
        }
Exemplo n.º 28
0
        public Sprite(string baseTX, DrawPriority priority, MoveOption moveState = MoveOption.STATIC)
        {
            Texture         = Singleton.Content.AddTexture(baseTX);
            TextureClicked  = Singleton.Content.AddTexture(baseTX + "Clicked");
            TextureOver     = Singleton.Content.AddTexture(baseTX + "Over");
            TextureDisabled = Singleton.Content.AddTexture(baseTX + "Disabled");

            Priority    = priority;
            MoveState   = moveState;
            SpriteColor = Color.White;
            MouseEvent  = new MouseEvents(this);
        }
Exemplo n.º 29
0
        public static void SelectContactAvatarsOptions()
        {
            //Find Calendar radio button and click on it
            AutomationElement aeContactAvatarsButton = ViewSwitchingNavigationPage <TApp> .ContactAvatarsButton;

            aeContactAvatarsButton.Select();
            System.Windows.Forms.Cursor.Position =
                new System.Drawing.Point((int)aeContactAvatarsButton.GetClickablePoint().X, (int)aeContactAvatarsButton.GetClickablePoint().Y);
            System.Threading.Thread.Sleep(TIMEWAIT);
            MouseEvents.Click();
            Thread.Sleep(TIMEWAIT);
        }
Exemplo n.º 30
0
    void Start()
    {
        foreach (GameObject rectangle in GameObject.FindGameObjectsWithTag("Rectangles"))
        {
            //if (rectangle.gameObject.name == "FocusRectangle")
            //FocusSprite = rectangle.GetComponent<FocusRectangleObject>();
            if (rectangle.gameObject.name == "SelectionRectangle")
            {
                SelectionSprite = rectangle.GetComponent <SelectorScript>();
            }
            else if (rectangle.gameObject.name == "GroupRectangle")
            {
                GroupSprite = rectangle.GetComponent <GroupRectangleScript>();
            }
        }

        MouseEvents.Setup(gameObject);

        SelectedGroup = ScriptableObject.CreateInstance <UnitGroup>();
        SelectedGroup.startGroup();

        //scrolling = (GetComponent<Scrolling>()) ? GetComponent<Scrolling>() : null;

        //if (camera.name == null)
        //{
        camera = Camera.main;
        //}
        Scale = new Vector2((camera.pixelRect.width / gameObject.guiTexture.texture.width), (camera.pixelRect.height / gameObject.guiTexture.texture.height));


        //gameObject.guiTexture.pixelInset = new Rect(0, -camera.pixelHeight, camera.pixelWidth, camera.pixelHeight);
        //if (gameObject.GetComponent<GUIText>() == null) gameObject.AddComponent<GUIText>();

        gameObject.guiText.pixelOffset = new Vector2(-Camera.main.pixelWidth / 2 + 25 * Scale.x, Camera.main.pixelHeight / 2 - 80 * Scale.y);
        MapViewArea = new Rect(20 * Scale.x, 20 * Scale.y, 1675 * Scale.x, 1047 * Scale.y);
        MainGuiArea = new Rect(1716 * Scale.x, 20 * Scale.y, 184 * Scale.x, 1047 * Scale.y);
        gameObject.guiText.fontSize = (int)(40f * Scale.x + 0.5f);

        //guiTexture.pixelInset = MapViewArea;
        //guiTexture.guiTexture.border.left = (int)(20f * Scale.x);
        //guiTexture.guiTexture.border.right = (int)(225f * Scale.x);
        //guiTexture.guiTexture.border.top = (int)(20f * Scale.y);
        //guiTexture.guiTexture.border.bottom = (int)(13f * Scale.y);


        //QamAcsess = Camera.main.GetComponent<camScript>();

        MouseEvents.LEFTCLICK   += MouseEvents_LEFTCLICK;
        MouseEvents.RIGHTCLICK  += MouseEvents_RIGHTCLICK;
        MouseEvents.LEFTRELEASE += MouseEvents_LEFTRELEASE;

        UpdateManager.GUIUPDATE += UpdateManager_GUIUPDATE;
    }
Exemplo n.º 31
0
        public static void SelectEmailOption()
        {
            //Find Email radio button and click on it
            AutomationElement aeMailButton = ViewSwitchingNavigationPage <TApp> .EMailButton;

            aeMailButton.Select();
            System.Windows.Forms.Cursor.Position =
                new System.Drawing.Point((int)aeMailButton.GetClickablePoint().X, (int)aeMailButton.GetClickablePoint().Y);
            System.Threading.Thread.Sleep(1000);
            MouseEvents.Click();
            Thread.Sleep(2000);
        }
Exemplo n.º 32
0
        public static void MouseEvent(MouseEvents value)
        {
            MousePoint position = GetCursorPosition();

            mouse_event
                ((int)value,
                position.X,
                position.Y,
                0,
                0)
            ;
        }
        public override void Activate(bool instancePreserved)
        {
            base.Activate(instancePreserved);

            if (mouseEvents == null)
            {
                mouseEvents = new MouseEvents(ScreenManager.GraphicsDevice);
            }

            mouseEvents.Click += new EventHandler<MouseEventArgs>(MouseEvents_Click);

            // Load existing pins
            PinPacker packer = new PinPacker();
            Pins = packer.Unpack(this.BodyPart.Pins);
        }
Exemplo n.º 34
0
        void DoDemo()
        {
            Inventor.Application InvApp = AdnInventorUtilities.InvApplication;

            //Create new interaction event
            _interactionEvents = InvApp.CommandManager.CreateInteractionEvents();

            //Store mouse events
            _mouseEvents = _interactionEvents.MouseEvents;

            //Enable mouse move. This is disabled by default for performance reasons
            _mouseEvents.MouseMoveEnabled = true;

            //Listen to OnMouseMove event
            _mouseEvents.OnMouseMove +=
                new MouseEventsSink_OnMouseMoveEventHandler(MouseEvents_OnMouseMove);

            _interactionEvents.StatusBarText = "Select triangle vertex: ";

            //Retrieve InteractionGraphics
            InteractionGraphics ig = _interactionEvents.InteractionGraphics;

            //Create new node
            GraphicsNode node = ig.OverlayClientGraphics.AddNode(1);

            //Add Triangle primitive
            _triangleGraph = node.AddTriangleGraphics();

            //Set up coordinates
            GraphicsCoordinateSet coordSet = ig.GraphicsDataSets.CreateCoordinateSet(1);

            double[] coords = new double[]
            {
                0.0, 0.0, 0.0, //vertex 1
                5.0, 0.0, 0.0, //vertex 2
                2.5, 5.0, 0.0  //vertex 3
            };

            coordSet.PutCoordinates(ref coords);

            _triangleGraph.CoordinateSet = coordSet;

            _interactionEvents.Start();
        }
Exemplo n.º 35
0
 /// <summary>
 /// Simulates mouse button actions.
 /// </summary>
 /// <param name="flags">The button action to simulate.</param>
 public static void Button(MouseEvents flags)
 {
   mouse_event((int) flags, 0, 0, 0, IntPtr.Zero);
 }
Exemplo n.º 36
0
        public void RaiseMouseEvent(MouseEvents mEv, MouseEventArgs mArgs)
        {
            _userMouseEvent = mEv;
            _userMouseArgs = mArgs;

            ProccessMouse(new Drawing.PointF(mArgs.X, mArgs.Y));
        }
Exemplo n.º 37
0
 /// <summary>
 /// HOOK MouseEvent event.
 /// </summary>
 /// <param name="mouseEvent">The mouse event.</param>
 /// <param name="mouse">The mouse.</param>
 /// <param name="delayTime">The delay time.</param>
 void kbmHOOK_MouseEvent(MouseEvents mouseEvent, MSLLHOOKSTRUCT mouse, int delayTime)
 {
     OnRecording(mouseEvent.ToString() + "|" + mouse.pt.ToString());
     this.kbmActionRecorder.WriteData(mouseEvent.ToString(), mouse, delayTime);
 }
Exemplo n.º 38
0
 /// <summary>
 /// Hook the MouseEvent event.
 /// </summary>
 /// <param name="mouseEvent">The mouse event.</param>
 /// <param name="myMouse">My mouse.</param>
 /// <param name="delayTime">The delay time.</param>
 void MHook_MouseEvent( MouseEvents mouseEvent, MSLLHOOKSTRUCT myMouse,int delayTime)
 {
     OnRecording(mouseEvent.ToString()+"|"+myMouse.pt.ToString());
     mActionRecorder.WriteData(mouseEvent.ToString(), myMouse, delayTime);
 }
Exemplo n.º 39
0
 private void MouseHookMouseEvent(MouseEvents mEvent, Point point)
 {
     string message = string.Format("Mouse event: {0}: ({1},{2}).", mEvent, point.X, point.Y);
     AddText(message);
 }
Exemplo n.º 40
0
        /////////////////////////////////////////////////////////////
        // use: Initializes event handlers
        //
        /////////////////////////////////////////////////////////////
        public void Initialize()
        {
            _InteractionEvents =
               _Application.CommandManager.CreateInteractionEvents();

            _SelectEvents = _InteractionEvents.SelectEvents;
            _MouseEvents = _InteractionEvents.MouseEvents;

            _SelectEvents.Enabled = true;
            _SelectEvents.SingleSelectEnabled = false;

            _SelectEvents.OnPreSelect +=
                new SelectEventsSink_OnPreSelectEventHandler(
                    SelectEvents_OnPreSelect);

            _SelectEvents.OnSelect +=
                new SelectEventsSink_OnSelectEventHandler(
                    SelectEvents_OnSelect);

            _SelectEvents.OnUnSelect +=
                new SelectEventsSink_OnUnSelectEventHandler(
                    SelectEvents_OnUnSelect);

            _InteractionEvents.OnTerminate +=
                new InteractionEventsSink_OnTerminateEventHandler(
                    InteractionEvents_OnTerminate);
        }
Exemplo n.º 41
0
        public void ProccessMouse(System.Drawing.PointF mousePosition)
        {
            if (ScaleX != 1f || ScaleY != 1f)
                mousePosition = new Drawing.PointF(mousePosition.X / ScaleX, mousePosition.Y / ScaleY);

            _mouseEvent = MouseEvents.None;
            _mouseButton = MouseButtons.None;
            if (_mousePosition != mousePosition)
                updateHoveredControl = true;
            _mousePosition = mousePosition;

            #region Set events.

            int eventButton = -1;
            int eventClicks = 0;
            float eventDelta = 0;
            EventType eventType = EventType.Ignore;

            if (_userMouseArgs != null)
            {
                switch (_userMouseArgs.Button)
                {
                    case MouseButtons.Left: eventButton = 0; break;
                    case MouseButtons.Right: eventButton = 1; break;
                    case MouseButtons.Middle: eventButton = 2; break;
                }
                eventClicks = _userMouseArgs.Clicks;
                eventDelta = _userMouseArgs.Delta;
                switch (_userMouseEvent)
                {
                    case MouseEvents.Down: eventType = EventType.MouseDown; break;
                    case MouseEvents.Up: eventType = EventType.MouseUp; break;
                    case MouseEvents.Wheel: eventType = EventType.ScrollWheel; break;
                }
                _userMouseArgs = null;
            }
            else
            {
                eventButton = Event.current.button;
                eventClicks = Event.current.clickCount;
                eventDelta = Event.current.delta.y;
                eventType = Event.current.type;
            }

            switch (eventType)
            {
                case EventType.MouseDown:
                    switch (eventButton)
                    {
                        case 0:
                            _mouseButton = MouseButtons.Left;
                            _mouseEvent = MouseEvents.Down;
                            if (eventClicks > 1)
                                _mouseEvent = MouseEvents.DoubleClick;
                            break;
                        case 1:
                            _mouseButton = MouseButtons.Right;
                            _mouseEvent = MouseEvents.Down;
                            break;
                        case 2:
                            _mouseButton = MouseButtons.Middle;
                            _mouseEvent = MouseEvents.Down;
                            break;
                    }
                    break;
                case EventType.MouseUp:
                    switch (eventButton)
                    {
                        case 0:
                            _mouseButton = MouseButtons.Left;
                            _mouseEvent = MouseEvents.Up;
                            break;
                        case 1:
                            _mouseButton = MouseButtons.Right;
                            _mouseEvent = MouseEvents.Up;
                            break;
                        case 2:
                            _mouseButton = MouseButtons.Middle;
                            _mouseEvent = MouseEvents.Up;
                            break;
                    }
                    break;
                case EventType.ScrollWheel:
                    _mouseEvent = MouseEvents.Wheel;
                    _mouseWheelDelta = eventDelta;
                    break;
            }

            #endregion

            //if (_mouseLastClickControl != null && _mouseEvent == MouseEvents.None && _mouseMovePosition != mousePosition)
            //    _ProcessControl(mousePosition, _mouseLastClickControl, true);

            if (_mouseEvent != MouseEvents.None || _mouseMovePosition != mousePosition)
            {
                // Dispose context first.
                for (int i = 0; i < Contexts.Count; i++)
                {
                    if (Contexts[i].Context)
                    {
                        var contextControl = Contexts[i];
                        if (Contains(contextControl, hoveredControl) == false)
                        {
                            if (_mouseEvent == MouseEvents.Down)
                            {
                                contextControl.Dispose();
                                i--;
                            }
                            continue;
                        }
                    }
                }

                if (hoveredControl == null && _mouseEvent == MouseEvents.Up)
                {
                    _dragndrop = false;
                    _dragData = null;
                }

                if (hoveredControl != null)
                    _ProcessControl(_mousePosition, hoveredControl, false);

                if (_mouseEvent == MouseEvents.Down)
                    DownClick(hoveredControl, new MouseEventArgs(_mouseButton, 1, (int)mousePosition.X, (int)mousePosition.Y, 0));

                if (_mouseEvent == MouseEvents.Up)
                    UpClick(hoveredControl, new MouseEventArgs(_mouseButton, 1, (int)mousePosition.X, (int)mousePosition.Y, 0));
            }

            _mouseMovePosition = mousePosition;
        }
Exemplo n.º 42
0
		/// <include file='ManagedHooks.xml' path='Docs/MouseHook/FilterMessage/*'/>
		public void FilterMessage(MouseEvents eventType)
		{
			base.FilterMessage(this.HookType, (int)eventType);
		}
Exemplo n.º 43
0
    //private Vector3 oldDirection = Vector3.zero;
    public void MouseEvents_MQUSEWHEEL(MouseEvents.MouseState.MOUSEWHEELSTATE wheelstate)
    {
        if (CamMode==CAMERAMODE.ORTHOGRAFIC)
        {
            gameObject.camera.orthographicSize -= (int)wheelstate * (camera.orthographicSize / 120f);

            if (gameObject.camera.orthographicSize >= this.Orthografic_Y_MaxSize)
                gameObject.camera.orthographicSize = this.Orthografic_Y_MaxSize;
            if (gameObject.camera.orthographicSize <= this.Orthografic_Y_MinSize)
            {
                gameObject.camera.orthographicSize = this.Orthografic_Y_MinSize;
            }

        }
        else if (CamMode == CAMERAMODE.PERSPECTIVE)
        {
            Vector3 buffer = gameObject.transform.position;
            buffer.y -= (int)wheelstate * (gameObject.transform.position.y / 120f);

            if (buffer.y > Perspective_Y_MaxHeight)
                buffer.y = Perspective_Y_MaxHeight;
            if (buffer.y < Perspective_Y_MinHeight)
                buffer.y = Perspective_Y_MinHeight;

            Ray centerRay = camera.ScreenPointToRay(new Vector3(camera.pixelWidth / 2f, camera.pixelHeight / 2f, 0f));
            RaycastHit groundHit;
            Ground.Current.collider.Raycast(centerRay, out groundHit, camera.farClipPlane);
            gameObject.transform.position = buffer;

            // rotation ->
            Vector3 newDirection = (groundHit.point - gameObject.transform.position).normalized;
            gameObject.transform.forward = newDirection;

        }
    }
Exemplo n.º 44
0
        private void OnMouseEvent(MouseEvents mEvent, Point point)
        {
            var ev = MouseEvent;
            if (ev == null)
                return;

            MouseEventType type;
            switch (mEvent)
            {
                case MouseEvents.LeftButtonDown:
                    type = MouseEventType.LeftDown;
                    break;

                case MouseEvents.LeftButtonUp:
                    type = MouseEventType.LeftUp;
                    break;

                case MouseEvents.RightButtonDown:
                    type = MouseEventType.RightDown;
                    break;

                case MouseEvents.RightButtonUp:
                    type = MouseEventType.RightUp;
                    break;

                case MouseEvents.Move:
                    type = MouseEventType.Move;
                    break;

                default:
                    return;
            }

            ev (this, new MouseEventArgs (new MouseEvent (type, GetNormalizedPosition (point))));
        }
        public OnOffMouseEvents(MouseEvents decoratedMouseEvents)
        {
            decoratedMouseEvents.MouseDown += (sender, args) =>
            {
                if (!On || MouseDown == null)
                {
                    return;
                }

                MouseDown(sender, args);
            };

            decoratedMouseEvents.MouseMove += (sender, args) =>
            {
                if (!On || MouseMove == null)
                {
                    return;
                }

                MouseMove(sender, args);
            };

            decoratedMouseEvents.MouseUp += (sender, args) =>
            {
                if (!On || MouseUp == null)
                {
                    return;
                }

                MouseUp(sender, args);
            };
        }