private void Window_Shown(object sender, WindowInfoEventArgs e)
 {
     this.WindowShown?.Invoke(this, e);
     if (!e.Window.IsPinned)
     {
         this.UnRegister(e.Window);
     }
 }
Beispiel #2
0
 private void Store_Removed(object sender, WindowInfoEventArgs e)
 {
     this.Invoke(() =>
     {
         if (!e.Window.IsPinned)
         {
             this.hiddenWindows.Items.RemoveByKey(e.Window.Key);
         }
         this.HiddenWindowsChanged?.Invoke(this, new EventArgs());
     });
 }
Beispiel #3
0
        private void RestoreOnShow(object sender, WindowInfoEventArgs e)
        {
            WindowPlacement windowplacement = WindowPlacement.Load(this.Handle);
            WindowPattern   windowPattern   =
                (WindowPattern)this.AutomationElement.GetCurrentPattern(WindowPattern.Pattern);
            WindowVisualState visualState = ((windowplacement.Flags & WindowPlacementFlags.RestoreToMaximize) > 0)
                ? WindowVisualState.Maximized
                : WindowVisualState.Normal;

            windowPattern.SetWindowVisualState(visualState);

            this.Restored?.Invoke(sender, new WindowInfoEventArgs(this));
        }
Beispiel #4
0
        private void RemoveClosedApplication(object sender, WindowInfoEventArgs e)
        {
            this.Invoke(() =>
            {
                string key = e.Handle.ToInt64().ToString();
                if (!this.hiddenWindows.Items.ContainsKey(key))
                {
                    return;
                }

                WindowInfo.Find(e.Handle).ApplicationExited -= this.RemoveClosedApplication;
                this.hiddenWindows.Items.RemoveByKey(key);
            });
        }
Beispiel #5
0
        private void Store_Added(object sender, WindowInfoEventArgs e)
        {
            this.Invoke(() =>
            {
                WindowListViewItem item = new WindowListViewItem(e.Window);
                this.SetWindowImageList(e.Window, false);

                if (!this.hiddenWindows.Items.ContainsKey(e.Window.Key))
                {
                    this.hiddenWindows.Items.Add(item);
                    e.Window.ApplicationExited += this.RemoveClosedApplication;
                }
                this.HiddenWindowsChanged?.Invoke(this, new EventArgs());
            });
        }
Beispiel #6
0
        private void RemoveAutomationEvents(object sender, WindowInfoEventArgs e)
        {
            lock (this.syncObject)
            {
                if (!this.hasAutomationEvents &&
                    !Runtime.Instance.Settings.PinnedSettings.HideOnMinimize)
                {
                    return;
                }

                Automation.RemoveAutomationPropertyChangedEventHandler(this.AutomationElement, this.HideOnMinimize);
                this.Shown              -= this.RestoreOnShow;
                this.ApplicationExited  -= this.RemoveAutomationEvents;
                this.hasAutomationEvents = false;
            }
        }
Beispiel #7
0
        private void AddAutomationEvents(object sender, WindowInfoEventArgs e)
        {
            lock (this.syncObject)
            {
                if (this.hasAutomationEvents &&
                    !Runtime.Instance.Settings.PinnedSettings.HideOnMinimize)
                {
                    return;
                }

                Automation.AddAutomationPropertyChangedEventHandler(this.AutomationElement, TreeScope.Element,
                                                                    this.HideOnMinimize, WindowPattern.WindowVisualStateProperty);
                this.Shown              += this.RestoreOnShow;
                this.ApplicationExited  += this.RemoveAutomationEvents;
                this.hasAutomationEvents = true;
            }
        }
 private void Window_Pinned(object sender, WindowInfoEventArgs e)
 {
     this.WindowPinned?.Invoke(sender, e);
 }
Beispiel #9
0
 private static void ReturnValue_Hidden(object sender, WindowInfoEventArgs e)
 {
 }
Beispiel #10
0
        private void Store_Added(object sender, WindowInfoEventArgs e)
        {
            this.DoInvoke(() =>
            {
                WindowListViewItem item = new WindowListViewItem(e.Window);
                this.SetWindowImageList(e.Window, false);

                if (!this.hiddenWindows.Items.ContainsKey(e.Window.Key))
                {
                    this.hiddenWindows.Items.Add(item);
                    e.Window.ApplicationExited += this.RemoveClosedApplication;
                }

                this.HiddenWindowsChanged?.Invoke(this, new EventArgs());
            });
        }
        private void RestoreOnShow(object sender, WindowInfoEventArgs e)
        {
            WindowPlacement windowplacement = new WindowPlacement();
            ExternalReferences.GetWindowPlacement(this.Handle, ref windowplacement);
            WindowPattern windowPattern =
                (WindowPattern) this.AutomationElement.GetCurrentPattern(WindowPattern.Pattern);
            WindowVisualState visualState = ((windowplacement.flags & (int) WindowPlacementFlags.RestoreToMaximize) > 0)
                ? WindowVisualState.Maximized
                : WindowVisualState.Normal;
            windowPattern.SetWindowVisualState(visualState);

            this.Restored?.Invoke(sender, new WindowInfoEventArgs(this));
        }
        private void RemoveAutomationEvents(object sender, WindowInfoEventArgs e)
        {
            lock (this.syncObject)
            {
                if (!this.hasAutomationEvents
                    && !Runtime.Instance.Settings.PinnedSettings.HideOnMinimize)
                    return;

                Automation.RemoveAutomationPropertyChangedEventHandler(this.AutomationElement, this.HideOnMinimize);
                this.Shown -= this.RestoreOnShow;
                this.ApplicationExited -= this.RemoveAutomationEvents;
                this.hasAutomationEvents = false;
            }
        }
        private void AddAutomationEvents(object sender, WindowInfoEventArgs e)
        {
            lock (this.syncObject)
            {
                if (this.hasAutomationEvents
                    && !Runtime.Instance.Settings.PinnedSettings.HideOnMinimize)
                    return;

                Automation.AddAutomationPropertyChangedEventHandler(this.AutomationElement, TreeScope.Element,
                    this.HideOnMinimize, WindowPattern.WindowVisualStateProperty);
                this.Shown += this.RestoreOnShow;
                this.ApplicationExited += this.RemoveAutomationEvents;
                this.hasAutomationEvents = true;
            }
        }
 private static void ReturnValue_Hidden(object sender, WindowInfoEventArgs e)
 {
     Runtime.Instance.WindowManager.Register(e.Window);
 }
Beispiel #15
0
 private void Store_Removed(object sender, WindowInfoEventArgs e)
 {
     this.DoInvoke(() =>
     {
         if (!e.Window.IsPinned)
             this.hiddenWindows.Items.RemoveByKey(e.Window.Key);
         this.HiddenWindowsChanged?.Invoke(this, new EventArgs());
     });
 }
 private void Window_Hidden(object sender, WindowInfoEventArgs e)
 {
     this.WindowHidden?.Invoke(this, e);
 }
Beispiel #17
0
        private void RemoveClosedApplication(object sender, WindowInfoEventArgs e)
        {
            this.DoInvoke(() =>
            {
                string key = e.Handle.ToInt64().ToString();
                if (!this.hiddenWindows.Items.ContainsKey(key))
                    return;

                WindowInfo.Find(e.Handle).ApplicationExited -= this.RemoveClosedApplication;
                this.hiddenWindows.Items.RemoveByKey(key);
            });
        }