Ejemplo n.º 1
0
        void OnToolbarEvent(object sender, AppBarEventArgs e)
        {
            Debug.Print("OnToolbarEvent - Action: {0}, Data: {1}, ReserveScreen: {2}, Win32Window.IsFullScreen {3}", e.Action, e.Data, ReserveScreen, Win32Window.IsFullScreen());

            switch (e.Action)
            {
            case AppBarNotificationAction.FullScreenApp:
                IsFullScreenAppOpen = (bool)e.Data;

                if (IsFullScreenAppOpen && ReserveScreen)
                {
                    //Topmost = false;
                    //Win32Window.SetWindowPos(Handle, (IntPtr)HWND.BOTTOM, 0, 0, 0, 0, SWP.NOMOVE | SWP.NOSIZE | SWP.NOACTIVATE);
                }
                else if (!IsFullScreenAppOpen && ReserveScreen)
                {
                    //Topmost = true;
                    //Win32Window.SetWindowPos(Handle, (IntPtr)HWND.NOTOPMOST, 0, 0, 0, 0, SWP.NOMOVE | SWP.NOSIZE | SWP.NOACTIVATE | SWP.FRAMECHANGED);
                }
                AppBarEvent(this, e);
                break;

            default:
                AppBarEvent(this, e);
                break;
            }
        }
Ejemplo n.º 2
0
        void OnAppBarEvent(object sender, AppBarEventArgs e)
        {
            Thread.Sleep(10);
            Debug.Print("OnAppBarEvent, Action: {0}, Data: {1}", e.Action, e.Data);

            switch (e.Action)
            {
                case AppBarNotificationAction.ErrorEvent:
                    Log.Warn(e.Data);
                    break;
                case AppBarNotificationAction.ShowWindow:
                    ShowWindow();
                    break;
                case AppBarNotificationAction.HideWindow:
                    HideWindow();
                    break;
                case AppBarNotificationAction.PositionChanged:
                case AppBarNotificationAction.StateChanged:
                    Log.Debug("PositionChanged/StateChanged");
                    HideWindow();
                    ShowWindow();
                    break;
                case AppBarNotificationAction.FullScreenApp:
                    ClearAnimations();

                    if ((bool)e.Data)
                    {
                        Log.Debug("FullScreenApp opened");

                        //Position position = new Position();
                        //if (_appbar.ReserveScreen)
                        //{
                        //    Width = 0;
                        //    Height = 0;

                        //    _appbar.Resize(ref position);
                        //}
                    }
                    else
                    {
                        Log.Debug("FullScreenApp closed");

                        Position position = CalculateSlideOutPosition();

                        if (_appbar.ReserveScreen)
                        {
                            _appbar.Resize(ref position);
                            Log.DebugFormat("SlideOut after resize position {0}", position);
                        }

                        _actionQueue.QueueAction(SlideOut);

                        /*
                        DispatcherHelper.UIDispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new Action(() =>
                            {
                                Top = position.Top;
                                Left = position.Left;
                                Width = position.Width;
                                Height = position.Height;

                                _mainGrid.Width = position.Width;
                                _mainGrid.Height = position.Height;

                                System.Threading.Thread.Sleep(5000);

                                HideWindow();
                                ShowWindow();
                            }));
                         */
                    }
                    break;
            }
        }
Ejemplo n.º 3
0
        void OnToolbarEvent(object sender, AppBarEventArgs e)
        {
            Debug.Print("OnToolbarEvent - Action: {0}, Data: {1}, ReverseScreen: {2}, Win32Window.IsFullScreen {3}", e.Action, e.Data, ReserveScreen, Win32Window.IsFullScreen());

            switch (e.Action)
            {
                case AppBarNotificationAction.FullScreenApp:
                    IsFullScreenAppOpen = (bool)e.Data;                    

                    if (IsFullScreenAppOpen && ReserveScreen)
                    {                        
                        //Topmost = false;
                        //Win32Window.SetWindowPos(Handle, (IntPtr)HWND.BOTTOM, 0, 0, 0, 0, SWP.NOMOVE | SWP.NOSIZE | SWP.NOACTIVATE);
                    }
                    else if (!IsFullScreenAppOpen && ReserveScreen)
                    {
                        //Topmost = true;
                        //Win32Window.SetWindowPos(Handle, (IntPtr)HWND.NOTOPMOST, 0, 0, 0, 0, SWP.NOMOVE | SWP.NOSIZE | SWP.NOACTIVATE | SWP.FRAMECHANGED);                                               
                    }
                    AppBarEvent(this, e);
                    break;
                default:
                    AppBarEvent(this, e);
                    break;
            }
        }