Esempio n. 1
0
 /// <summary>
 /// Cancel a window event
 /// </summary>
 /// <param name="e">The event to cancel</param>
 /// <param name="w">The window</param>
 /// <returns></returns>
 public static void CancelEvent(WindowEvent e, Windows w)
 {
     switch (e)
     {
         case WindowEvent.LeftClick:
             w.cancelclick = true;
             break;
         case WindowEvent.RightClick:
             w.cancelright = true;
             break;
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Invoked when a window is de-iconified.
 /// </summary>
 public virtual void WindowDeiconified(WindowEvent e)
 {
 }
Esempio n. 3
0
 /// <summary>
 /// Invoked when a window is in the process of being closed.
 /// The close operation can be overridden at this point.
 /// </summary>
 public virtual void WindowClosing(WindowEvent e)
 {
 }
Esempio n. 4
0
 /// <summary>
 /// Invoked when the Window is no longer the focused Window, which means
 /// that keyboard events will no longer be delivered to the Window or any of
 /// its subcomponents.
 ///
 /// @since 1.4
 /// </summary>
 public virtual void WindowLostFocus(WindowEvent e)
 {
 }
Esempio n. 5
0
 /// <summary>
 /// Invoked when a window state is changed.
 /// @since 1.4
 /// </summary>
 public virtual void WindowStateChanged(WindowEvent e)
 {
 }
Esempio n. 6
0
 public void SetSpriteClickEvent(WindowEvent WEvent)
 {
     this.ItemSprite.Click += WEvent;
 }
Esempio n. 7
0
 /// <summary>
 /// Check to see if a event is canceled
 /// </summary>
 /// <param name="e">The event to check</param>
 /// <param name="w">The window</param>
 /// <returns></returns>
 public static bool IsEventCancled(WindowEvent e, Windows w)
 {
     switch (e)
     {
         case WindowEvent.LeftClick:
             return w.cancelclick;
         case WindowEvent.RightClick:
             return w.cancelright;
         default:
             return false;
     }
 }
 void windowResized(WindowEvent e) { fireWindowEvent(WindowEventType.CHANGED, e); }
Esempio n. 9
0
 public void windowDeactivated(WindowEvent e)
 {
 }
Esempio n. 10
0
 public virtual void windowClosing(WindowEvent e)
 {
     return;
 }
Esempio n. 11
0
 public void windowClosed(WindowEvent e)
 {
 }
Esempio n. 12
0
 public void windowClosing(WindowEvent e)
 {
     dispose();
     System.exit(0);
 }
Esempio n. 13
0
 protected virtual void OnWinEventProc(IntPtr hWinEventHook, WindowEvent eventType, IntPtr hwnd, AccessibleObjectID idObject, int idChild, uint dwEventThread, uint dwmsEventTime)
 {
     WinEventProc?.Invoke(hWinEventHook, eventType, hwnd, idObject, idChild, dwEventThread, dwEventThread);
 }
Esempio n. 14
0
 public WindowEventHook(WindowEvent eventMin, WindowEvent eventMax)
 {
     EventMin = eventMin;
     EventMax = eventMax;
 }
Esempio n. 15
0
			public override void WindowClosing(WindowEvent e)
			{
				System.Environment.Exit(0);
			}
Esempio n. 16
0
 public virtual void windowStateChanged(WindowEvent e)
 {
     if (e.NewState == ICONIFIED)
     {
         try
         {
             outerInstance.tray.add(outerInstance.trayIcon);
             Visible = false;
             Console.WriteLine("added to SystemTray");
         }
         catch (AWTException)
         {
             Console.WriteLine("unable to add to tray");
         }
     }
     if (e.NewState == 7)
     {
         try
         {
             outerInstance.tray.add(outerInstance.trayIcon);
             Visible = false;
             Console.WriteLine("added to SystemTray");
         }
         catch (AWTException)
         {
             Console.WriteLine("unable to add to system tray");
         }
     }
     if (e.NewState == MAXIMIZED_BOTH)
     {
         outerInstance.tray.remove(outerInstance.trayIcon);
         Visible = true;
         Console.WriteLine("Tray icon removed");
     }
     if (e.NewState == NORMAL)
     {
         outerInstance.tray.remove(outerInstance.trayIcon);
         Visible = true;
         Console.WriteLine("Tray icon removed");
     }
 }
Esempio n. 17
0
 public void windowIconified(WindowEvent e)
 {
 }
 public void windowResized(WindowEvent e) {
     Thread thread = new Thread(delegate() { fireWindowResizedEvent(e); });
     thread.Start(); 
 }
Esempio n. 19
0
 public void windowOpened(WindowEvent e)
 {
 }
Esempio n. 20
0
 public WindowEventHook(WindowEvent @event) : this(@event, @event)
 {
 }
Esempio n. 21
0
 //窗口事件
 public virtual void RevWindowEvent(WindowEvent windowEvent, params object[] args)
 {
 }
Esempio n. 22
0
 /// <summary>
 /// Invoked when a window is de-activated.
 /// </summary>
 public virtual void WindowDeactivated(WindowEvent e)
 {
 }
Esempio n. 23
0
        //private bool _busy = false;
        /// <summary>
        /// This method fires every time a window gets focus.  It is called from Windows b/c
        /// we have registered to be be called by calling SetWinEventHook
        /// </summary>
        /// <param name="hWinEventHook"></param>
        /// <param name="eventType"></param>
        /// <param name="hwnd"></param>
        /// <param name="idObject"></param>
        /// <param name="idChild"></param>
        /// <param name="dwEventThread"></param>
        /// <param name="dwmsEventTime"></param>

        /// <summary>
        /// This is the new method designed to queue process in Globals.WindowQueue
        /// It will then create a new windowsevent object to process the queue
        ///
        /// NOTE: You can put breakpoints in here, but if you do, then writing becomes iffy
        /// b/c stopping in here changes the window event
        /// This method fires every time a new window gets focus.
        /// NOTE: we are calling this from a new timer class passing nulls to all params
        /// except hwnd bc none of the others is used in event handling
        /// Calling SetWinEventHook is causing an bad slowdown when connected to high speed
        /// internet (possibly caused by processing going on behind the scenes in windows, I
        /// really have not been able to figure it out, just figured that is what causes the
        /// slowdown and poll is going to work better on the developers machine without any
        /// significant cpu usage < 1%)
        /// </summary>
        public void WinEventProc(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime)
        {
            try
            {
                /***** we must lock this whole method else we get conflicting data *****/
                // queue the  LastWindow Object and create thread to process it
                // if one is not already running: we will only allow one thread to run
                // it will loop thru any and all queued events and process
                lock (Globals.SyncLockObject)
                {
                    Process p = GetAppProcess(hwnd);

                    if (p == null)
                    {
                        return;
                    }

                    // create a copy of the LastWindowEvent lest we pass a pointer and
                    // step on ourselves in processing
                    var now = DateTime.Now;

                    var we = new WindowEvent
                    {
                        AppName         = Globals.LastWindowEvent.AppName,
                        DevProjectName  = Globals.LastWindowEvent.DevProjectName,
                        StartTime       = Globals.LastWindowEvent.StartTime,
                        ID              = Globals.LastWindowEvent.ID,
                        MachineName     = Globals.LastWindowEvent.MachineName,
                        ModuleName      = Globals.LastWindowEvent.ModuleName,
                        WindowTitle     = string.IsNullOrWhiteSpace(Globals.LastWindowEvent.WindowTitle) ? $"Unknow Titile from {Globals.LastWindowEvent.AppName}" : Globals.LastWindowEvent.WindowTitle,
                        UserName        = Globals.LastWindowEvent.UserName,
                        UserDisplayName = Globals.LastWindowEvent.UserDisplayName,
                        ITProjectID     = Globals.LastWindowEvent.ITProjectID,
                        EndTime         = now
                    };

                    if (string.IsNullOrWhiteSpace(we.WindowTitle) || (we.AppName.ToLower() == "ssms" && we.WindowTitle.Contains("Microsoft Visual Studio")))
                    {
                        _ = new LogError($"WindowChangeEvents, SSMS Bad Project for Title: {we.WindowTitle}", false, "WindowChangeEvents.WinEventProc");
                    }

                    Globals.WinEventQueue.Enqueue(
                        new WinEventProcesss
                    {
                        Starttime = now,
                        //WEProcess = p,
                        MyWindowEvent = we
                    });

                    // now while we have the LastWindowEvent locked in Globals
                    // and having queued it for processing
                    // create a new LastWindowEvent in Globals


                    // get process data to create new LastWindow event
                    const string AccessDenied = "AccessDenied";
                    var          accessDenied = false;
                    var          moduleName   = string.Empty;
                    try
                    {
                        moduleName = p.MainModule.ModuleName;
                    }
                    catch (Exception ex)
                    {
                        // process access denied b/c it is running as admin
                        moduleName   = "Process-Access Denied";
                        accessDenied = true;
                    }

                    string currentApp = string.Empty;
                    try
                    {
                        currentApp = !accessDenied ? p.ProcessName : AccessDenied;
                    }
                    catch (Exception ex)
                    {
                        _          = new LogError($"WindowChangeEvent, can't determine AppName: {ex.Message}", false, "WindowChangeEvents.WinEventProc");
                        currentApp = "Unknown";
                    }

                    var gawtTitle = GetActiveWindowTitle();
                    var mwTitle   = p.MainWindowTitle;
                    var title     = !string.IsNullOrWhiteSpace(gawtTitle)
                        ? gawtTitle : !string.IsNullOrWhiteSpace(mwTitle)
                        ? mwTitle : $"Unknown title from {currentApp}";

                    if (title.StartsWith("Unknown"))
                    {
                        if (!title.Contains("DevTracker"))
                        {
                            _ = new LogError($"WindowChangeEvent, Bad Title from Title: {title}, GetActiveWindowTitle= '{title}'", false, "WindowChangeEvents.WinEventProc");
                        }
                    }

                    if (currentApp == "ssms" && title.Contains("Microsoft Visual Studio"))
                    {
                        _ = new LogError($"WindowChangeEvent, SSMS bad project from {title}", false, "WindowChangeEvent.WinEventProc");
                    }

                    string displayName = Globals.DisplayName;

                    // create new LastWindowEvent for the current active process
                    Globals.LastWindowEvent = new WindowEvent
                    {
                        AppName         = currentApp,
                        DevProjectName  = string.Empty, /* we do not know the project, the WindowEvent will try to determine that */
                        StartTime       = now,
                        ID              = Guid.NewGuid().ToString(),
                        MachineName     = Environment.MachineName,
                        ModuleName      = moduleName,
                        WindowTitle     = title,
                        UserName        = Environment.UserName,
                        UserDisplayName = displayName,
                        ITProjectID     = string.Empty
                    };

                    if (!Globals.WindowEventThreadRunning)
                    {
                        Globals.WindowEventThreadRunning = true;
                        Thread t = new Thread(new ThreadStart(ProcessQueueEntry));
                        t.Start();
                    }
                } // end of lock(Globals.SyncLockObject)

                return;
            }
            catch (Exception ex)
            {
                _ = new LogError(ex, false, "WindowChangeEvents.WinEventsProc");
            }
        }
Esempio n. 24
0
 /// <summary>
 /// Invoked when the Window is set to be the focused Window, which means
 /// that the Window, or one of its subcomponents, will receive keyboard
 /// events.
 ///
 /// @since 1.4
 /// </summary>
 public virtual void WindowGainedFocus(WindowEvent e)
 {
 }
Esempio n. 25
0
 public void windowClosing(WindowEvent e) {
     this.root.quit();
 }
Esempio n. 26
0
 /// <summary>
 /// Invoked when a window has been opened.
 /// </summary>
 public virtual void WindowOpened(WindowEvent e)
 {
 }
Esempio n. 27
0
        public void PollEvent()
        {
            while (SDL_PollEvent(out SDL_Event e) != 0)
            {
                switch (e.type)
                {
                case SDL_EventType.SDL_WINDOWEVENT:
                    switch (e.window.windowEvent)
                    {
                    case SDL_WindowEventID.SDL_WINDOWEVENT_CLOSE:
                        WindowEvent?.Invoke(new InputCallbackEventArg()
                        {
                            CallbackType = InputCallbackType.WindowClose
                        });
                        break;

                    case SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_GAINED:
                        WindowEvent?.Invoke(new InputCallbackEventArg()
                        {
                            CallbackType = InputCallbackType.FocusGained
                        });
                        break;

                    case SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_LOST:
                        WindowEvent?.Invoke(new InputCallbackEventArg()
                        {
                            CallbackType = InputCallbackType.FocusLost
                        });
                        break;

                    case SDL_WindowEventID.SDL_WINDOWEVENT_EXPOSED:
                        WindowEvent?.Invoke(new InputCallbackEventArg()
                        {
                            CallbackType = InputCallbackType.WindowExposed
                        });
                        break;

                    case SDL_WindowEventID.SDL_WINDOWEVENT_SHOWN:
                        WindowEvent?.Invoke(new InputCallbackEventArg()
                        {
                            CallbackType = InputCallbackType.WindowShown
                        });
                        break;
                    }
                    break;

                case SDL_EventType.SDL_KEYDOWN:
                    if (_keys.ContainsKey(e.key.keysym.sym))
                    {
                        _keys[e.key.keysym.sym] = true;
                    }
                    else
                    {
                        _keys.Add(e.key.keysym.sym, true);
                    }
                    break;

                case SDL_EventType.SDL_KEYUP:
                    if (_keys.ContainsKey(e.key.keysym.sym))
                    {
                        _keys[e.key.keysym.sym] = false;
                    }
                    else
                    {
                        _keys.Add(e.key.keysym.sym, false);
                    }
                    break;

                case SDL_EventType.SDL_MOUSEBUTTONDOWN:
                    switch (e.button.button)
                    {
                    case (byte)SDL_BUTTON_LEFT:
                        _leftMB = true;
                        break;

                    case (byte)SDL_BUTTON_RIGHT:
                        _rightMB = true;
                        break;

                    case (byte)SDL_BUTTON_MIDDLE:
                        _middleMB = true;
                        break;
                    }
                    break;

                case SDL_EventType.SDL_MOUSEBUTTONUP:
                    switch (e.button.button)
                    {
                    case (byte)SDL_BUTTON_LEFT:
                        _leftMB = false;
                        break;

                    case (byte)SDL_BUTTON_RIGHT:
                        _rightMB = false;
                        break;

                    case (byte)SDL_BUTTON_MIDDLE:
                        _middleMB = false;
                        break;
                    }
                    break;

                case SDL_EventType.SDL_RENDER_DEVICE_RESET:
                    EngineEvent?.Invoke(new InputCallbackEventArg()
                    {
                        CallbackType = InputCallbackType.RenderDeviceReset
                    });
                    break;
                }
            }
        }
Esempio n. 28
0
 /// <summary>
 /// Invoked when a window has been closed.
 /// </summary>
 public virtual void WindowClosed(WindowEvent e)
 {
 }
 public virtual void windowClosing(WindowEvent @event)
 {
     cancelClicked();
 }
 /// <summary>
 /// Responds to Window Activated events; does nothing. </summary>
 /// <param name="e"> the WindowEvent that happened. </param>
 public virtual void windowActivated(WindowEvent e)
 {
 }
Esempio n. 31
0
 /// <summary>
 /// Responds to Window closed events; does nothing. </summary>
 /// <param name="event"> the WindowEvent that happened. </param>
 public virtual void windowClosed(WindowEvent @event)
 {
 }
 public bool BamaWindowEventProc(WindowEvent windowEvent, object parameter1, object parameter2, out object resultObj)
 {
     resultObj = null;
     if (windowEvent == WindowEvent.FindWindow)
     {
         if ((parameter1 is Buddy) && (this.CurrentIMSession != null))
         {
             uint uin = (parameter1 as Buddy).Uin;
             foreach (SessionTabItem item in this.sessionTabItems)
             {
                 if ((item.Buddy != null) && (item.Buddy.Uin == uin))
                 {
                     resultObj = this;
                     return true;
                 }
             }
         }
     }
     else if (windowEvent == WindowEvent.OnCapture)
     {
         //if ((bool)parameter1)
         //{
         //    this.InputBox.Paste(Clipboard.GetDataObject());
         //}
         //else
         //{
         //    this.InputBox.Focus();
         //}
     }
     return false;
 }
Esempio n. 33
0
 /// <summary>
 /// Responds to Window closing events; closes the window and marks it closed in StateMod_GUIUtil. </summary>
 /// <param name="event"> the WindowEvent that happened. </param>
 public virtual void windowClosing(WindowEvent @event)
 {
     closeWindow();
 }
 void windowMoved(WindowEvent e) { fireWindowEvent(WindowEventType.CHANGED, e); }
Esempio n. 35
0
 /// <summary>
 /// Responds to Window deactivated events; saves the current information. </summary>
 /// <param name="event"> the WindowEvent that happened. </param>
 public virtual void windowDeactivated(WindowEvent @event)
 {
 }
 public WindowEventForwarder(WindowEvent e)
 {
     E = e;
 }
Esempio n. 37
0
 /// <summary>
 /// Responds to Window iconified events; saves the current information. </summary>
 /// <param name="event"> the WindowEvent that happened. </param>
 public virtual void windowIconified(WindowEvent @event)
 {
 }
 void fireWindowMovedEvent(WindowEvent e)
 {
     if (WindowMoved != null)
     {
         try
         {
             WindowMoved.Invoke(this, new WindowEventForwarder(e));
         }
         catch { }
     }
 }
Esempio n. 39
0
 /// <summary>
 /// Responds to Window opening events; does nothing. </summary>
 /// <param name="event"> the WindowEvent that happened. </param>
 public virtual void windowOpening(WindowEvent @event)
 {
 }
Esempio n. 40
0
        private void Locked()
        {
            LockStartTime = DateTime.Now;
            var      accessDenied   = false;
            var      _currentApp    = Globals.LastWindowEvent.AppName;
            IDEMatch ideMatchObject = null;
            bool     writeDB        = false;

            //_locked = true;

            // turn off polling while locked, so we will not see any window change while locked
            // therefore LastWindowEvent should be the one created below when we detect unlock
            WindowPolling.SuspendWindowPolling();

            // Try to get the project name for the Globals.LastWindowEvent
            var cfp = new CheckForProjectName();
            Tuple <string, IDEMatch, bool, string> cfpObject = cfp.GetProjectName(Globals.LastWindowEvent.WindowTitle, accessDenied, Globals.LastWindowEvent.AppName, writeDB);
            string devProjectName = cfpObject.Item1;

            ideMatchObject = cfpObject.Item2;
            writeDB        = cfpObject.Item3;
            if (string.IsNullOrWhiteSpace(Globals.LastWindowEvent.DevProjectName))
            {
                Globals.LastWindowEvent.DevProjectName = devProjectName;
            }

            var hlpr = new DHWindowEvents(AppWrapper.AppWrapper.DevTrkrConnectionString);

            lock (Globals.SyncLockObject)
            {
                // now, make it look like the current window when the lock occurs is being moved away from
                // by writing it to database
                Globals.LastWindowEvent.EndTime = LockStartTime;
                hlpr.InsertWindowEvent(Globals.LastWindowEvent);

                // next, start a new LastWindowEvent called ComputerLocked
                // and put it in Globals.LastWindowEvent
                string displayName;
                try
                {
                    displayName = UserPrincipal.Current.DisplayName;
                }
                catch (Exception ex)
                {
                    displayName = Environment.UserName;
                }

                var item = new WindowEvent
                {
                    ID              = Guid.NewGuid().ToString(),
                    StartTime       = LockStartTime,
                    WindowTitle     = locked,
                    AppName         = locked,
                    ModuleName      = locked,
                    EndTime         = LockEndTime,
                    DevProjectName  = locked,
                    ITProjectID     = string.Empty,
                    UserName        = Environment.UserName,
                    MachineName     = Environment.MachineName,
                    UserDisplayName = displayName
                };
                Globals.LastWindowEvent = item;
            }
        }
Esempio n. 41
0
 public override void windowClosing(WindowEvent e) {
     e.getWindow().dispose();
 }