/// <summary>
        ///     The on content changed.
        /// </summary>
        public void OnContentChanged()
        {
            Dispatcher.BeginInvoke(
                DispatcherPriority.ApplicationIdle,
                new Action(
                    () =>
            {
                Rectangle workingArea;
                if (FullScreenHelper.ForegroundIsFullScreen() && Screen.AllScreens.Count(x => !x.Primary) >= 1)
                {
                    workingArea = Screen.AllScreens.First(x => !x.Primary).WorkingArea;
                }
                else
                {
                    workingArea = Screen.PrimaryScreen.WorkingArea;
                }

                var presentationSource = PresentationSource.FromVisual(this);
                if (presentationSource?.CompositionTarget == null)
                {
                    return;
                }

                var transform = presentationSource.CompositionTarget.TransformFromDevice;
                var corner    =
                    transform.Transform(new Point(workingArea.Right,
                                                  ApplicationSettings.ToastsAreLocatedAtTop ? workingArea.Top : workingArea.Bottom));

                Left = corner.X - ActualWidth;
                Top  = corner.Y - (ApplicationSettings.ToastsAreLocatedAtTop ? -ActualHeight : ActualHeight);
            }));
        }
Beispiel #2
0
        private void FullscreenTimerOnElapsed(object sender, ElapsedEventArgs elapsedEventArgs)
        {
            if (cm.CurrentCharacter == null ||
                !ApplicationSettings.AllowAutoBusy ||
                cm.CurrentCharacter.Status == StatusType.Busy)
            {
                return;
            }

            if (cm.CurrentCharacter.Status != StatusType.Online &&
                cm.CurrentCharacter.Status != StatusType.Idle &&
                cm.CurrentCharacter.Status != StatusType.Away)
            {
                return;
            }

            if (!FullScreenHelper.ForegroundIsFullScreen())
            {
                return;
            }

            Log("Setting user status to busy");
            cm.CurrentCharacter.Status = StatusType.Busy;
            events.SendUserCommand("busy", new[] { cm.CurrentCharacter.StatusMessage });
            fullscreenTimer.Stop();
        }
        private void LoadedExcute()
        {
            AxRenderWindow axRenderWindow = ServiceLocator.Current.GetInstance <AxRenderWindow>();

            FullScreenHelper.RepairWpfWindowFullScreenBehavior(axRenderWindow);
            axRenderWindow.WindowState = WindowState.Minimized;
            Window mainWin = this;

            mainWin.LocationChanged += (s, args) =>
            {
                axRenderWindow.Left = mainWin.Left;
                axRenderWindow.Top  = mainWin.Top;
            };
            mainWin.StateChanged += (s, argrs) =>
            {
                axRenderWindow.WindowState = mainWin.WindowState;
            };
            mainWin.Closing += (s, args) =>
            {
                axRenderWindow.Close();
            };
            mainWin.Closed += (s, args) =>
            {
                (this.DataContext as MainWindowViewModel).CloseCommand.Execute();
            };
            axRenderWindow.Show();
            mainWin.Owner              = axRenderWindow;
            this.Background            = Brushes.Transparent;
            axRenderWindow.WindowState = WindowState.Maximized;
            //mainWin.Activate();
        }
Beispiel #4
0
        /// <summary>
        /// Initializes ManagedShell with a custom configuration.
        /// </summary>
        /// <param name="config">A ShellConfig struct containing desired initialization parameters.</param>
        public ShellManager(ShellConfig config)
        {
            if (config.EnableTrayService)
            {
                TrayService         = new TrayService();
                ExplorerTrayService = new ExplorerTrayService();
                NotificationArea    = new NotificationArea(config.PinnedNotifyIcons, TrayService, ExplorerTrayService);
            }

            if (config.EnableTasksService)
            {
                TasksService = new TasksService(config.TaskIconSize);
                Tasks        = new Tasks(TasksService);
            }

            FullScreenHelper = new FullScreenHelper();
            ExplorerHelper   = new ExplorerHelper(NotificationArea);
            AppBarManager    = new AppBarManager(ExplorerHelper);

            if (config.EnableTrayService && config.AutoStartTrayService)
            {
                NotificationArea.Initialize();
            }

            if (config.EnableTasksService && config.AutoStartTasksService)
            {
                Tasks.Initialize();
            }
        }
Beispiel #5
0
        public void Dispose()
        {
            IconHelper.DisposeIml();

            AppBarManager.Dispose();
            FullScreenHelper.Dispose();
            NotificationArea?.Dispose();
            Tasks?.Dispose();
        }
Beispiel #6
0
        private void Update()
        {
            if (_settings.Disabled || _view.AnimationRunning)
            {
                return;
            }

            if ((App.IsMuted || _settings.IsMuted()) && !_settings.IgnoreMute)
            {
                Hide(checkHideStatus: false, checkIdleStatus: false);
                return;
            }

            if (!_settings.FullscreenActivation &&
                FullScreenHelper.DoesMonitorHaveFullscreenApp(_view.ViewModel.GetActualScreenBounds(), _view.ThisApp))
            {
                _showTimer.Stop();
                _hideTimer.Stop();
                Hide(false, false, false);
                return;
            }

            if (QueueIntro != null && !App.IsWorkstationLocked)
            {
                _view.ShowIntro(QueueIntro);
                return;
            }

            if (_settings.OpenMode == OpenMode.AlwaysOpen || KeepOpenForIntro)
            {
                Show();
                return;
            }

            if (_settings.DetectIdle && KeepOpenUntilIdle)
            {
                if (!_view.IsIdle)
                {
                    Show();
                }
                else
                {
                    Hide();
                }
                return;
            }

            if (_settings.OpenMode == OpenMode.Hidden)
            {
                Hide();
                return;
            }

            UpdateVisibilityStatus();
        }
Beispiel #7
0
 /// <summary>
 /// 全屏的快捷功能,F11相当于单机按钮;Esc健,如果全屏则退出全屏
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MetroWindow_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.F11)
     {
         FullScreenHelper.GoFullscreen(this);
     }
     else if (e.Key == Key.Escape)//esc键盘退出全屏
     {
         FullScreenHelper.ExitFullscreen(this);
     }
 }
Beispiel #8
0
 /// <summary>
 /// 双击窗体,退出全屏
 /// </summary>
 private void myContent_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (FullScreenHelper.IsFullscreen(this))
     {
         FullScreenHelper.ExitFullscreen(this);
     }
     else
     {
         FullScreenHelper.GoFullscreen(this);
     }
     //this.Visibility = Visibility.Hidden;
     this.Hide();
 }
        private void ShowMainWindowAndAxWindow()
        {
            IUnityContainer container = ServiceLocator.Current.GetInstance <IUnityContainer>();
            MainWindow      mainWin   = container.Resolve <MainWindow>();

            //mainWin.Topmost = true;
            FullScreenHelper.RepairWpfWindowFullScreenBehavior(mainWin);

            mainWin.WindowState            = WindowState.Maximized;
            Application.Current.MainWindow = mainWin;
            CloseAction();//先关闭登录窗口,再加载动画
            //显示加载动画
            //ServiceLocator.Current.GetInstance<EventAggregator>().GetEvent<ShowWaitIndicatorEvent>().Publish(false);
            mainWin.Show();
        }
        public void ShowIntro(IntroData introData = null)
        {
            _mouseChecker.QueueIntro = null;
            if (introData == null)
            {
                introData = new IntroData();
            }
            if (App.IsWorkstationLocked || FullScreenHelper.DoesMonitorHaveFullscreenApp(ViewModel.GetScreenBounds()))
            {
                _mouseChecker.QueueIntro = introData;
                return;
            }
            _lastIntroData = introData;
            if (_introTimer == null)
            {
                _introTimer       = new DispatcherTimer();
                _introTimer.Tick += delegate
                {
                    _introTimer.Stop();
                    if (_lastIntroData.HideOnFinish)
                    {
                        HideIntro();
                    }
                    if (_lastIntroData.ExecuteFinishAction)
                    {
                        ViewModel.OnIntroEnd();
                    }
                };
            }

            _introTimer.Stop();
            _introTimer.Interval =
                TimeSpan.FromMilliseconds(introData.Duration == -1 ? Settings.IntroDuration : introData.Duration);
            if (_mouseChecker.KeepOpenForIntro && introData.Reversable)
            {
                HideIntro(false);
            }
            else if (introData.Duration != 0)
            {
                _mouseChecker.KeepOpenForIntro = true;
                _introTimer.Start();
                ViewModel.OnIntro();
                _mouseChecker.Show(activate: introData.Activate);
            }
        }
Beispiel #11
0
        private void Form1_Load(object sender, EventArgs e)
        {
            hook = new KeysHook();
            this.time1.Parent      = this.skinPictureBox1;
            this.skinLabel1.Parent = this.skinPictureBox1;
            //==
            FullScreenConfigBO tmpFBO = FullScreenConfigBO.getFullScreenConfigBO();

            if (tmpFBO.isImg)
            {
                // this.BackPalace = File.Exists(tmpFBO.backgroundImg) ? Image.FromFile(tmpFBO.backgroundImg) : null;
                this.skinPictureBox1.ImageLocation = File.Exists(tmpFBO.backgroundImg) ? tmpFBO.backgroundImg : "";
            }
            else
            {
                this.skinPictureBox1.BackColor = tmpFBO.backgroundColor;
                //this.CaptionBackColorTop = tmpFBO.backgroundColor;
                //this.CaptionBackColorBottom = tmpFBO.backgroundColor;
                //this.BackColor = tmpFBO.backgroundColor;
            }
            this.SkinOpacity = tmpFBO.transparency * 0.01;

            //===
            PasswordConfigBO pBO = PasswordConfigBO.getPasswordConfigBO();

            infoPictureBox.Visible = pBO.isPasswordPrompt;
            infoLabel.Text         = pBO.passwordPrompt;

            //===
            this.oBO = OperatingConfigBO.getOperatingConfigBO();

            skinLabel1.Text    = "可尝试次数:" + this.oBO.frequency;
            skinLabel1.Visible = this.oBO.isFrequency;


            hook.Hook_Start();
            passTextBox.Text    = "";
            this.timer1.Enabled = true;
            FullScreenHelper.SetFormFullScreen(true);
            this.WindowState = FormWindowState.Maximized;
            this.Activate();//
        }
Beispiel #12
0
 private void skinButton1_Click(object sender, EventArgs e)
 {
     if (Md5Helper.VerifyMd5Hash(passTextBox.Text, this.passMd5))
     {
         if (this.oBO.isRecording)
         {
             LogHelper.addLog("开锁成功");
         }
         hook.Hook_Clear();
         this.timer1.Enabled = false;
         FullScreenHelper.SetFormFullScreen(false);
         this.Close();
     }
     else if (this.oBO.frequency > 0)
     {
         if (this.oBO.isRecording)
         {
             LogHelper.addLog("开锁失败,第" + this.oBO.frequency + "次尝试密码:" + passTextBox.Text);
         }
         if (this.oBO.isFrequency)
         {
             this.oBO.frequency -= 1;
         }
         skinLabel1.Text = "可尝试次数:" + this.oBO.frequency;
         if (this.oBO.frequency <= 0)
         {
             if (this.oBO.isFinalProcedure)
             {
                 Process.Start(this.oBO.finalProcedure);
             }
             else
             {
                 Process.Start("shutdown.exe", "-s");//关机
             }
         }
     }
     else
     {
         skinPanel2.Visible = false;
     }
 }
Beispiel #13
0
        public Desktop(DesktopManager desktopManager, AppBarManager appBarManager, FullScreenHelper fullScreenHelper)
        {
            InitializeComponent();

            _appBarManager    = appBarManager;
            _desktopManager   = desktopManager;
            _fullScreenHelper = fullScreenHelper;

            if (_desktopManager.ShellWindow != null)
            {
                AllowsTransparency = false;
            }

            setSize();
            setGridPosition();
            setBackground();

            Settings.Instance.PropertyChanged += Settings_PropertyChanged;

            _fullScreenHelper.FullScreenApps.CollectionChanged += FullScreenApps_CollectionChanged;
        }
Beispiel #14
0
 /// <summary>
 /// 通过重写PopupWindowAction中的GetWindow方法,设置Window的Style属性。
 /// 否则打开的只能是默认窗体,无法设置样式。
 /// </summary>
 /// <param name="notification"></param>
 /// <returns></returns>
 protected override Window GetWindow(INotification notification)
 {
     if (this.WindowContent != null)
     {
         IUnityContainer container = ServiceLocator.Current.GetInstance <IUnityContainer>();
         _window = container.Resolve <PopWindow>();
         Dictionary <string, object> args = notification.Content as Dictionary <string, object>;
         (_window.DataContext as PopWindowViewModel).PopWindowInfo = args[ParameterNames.PopWindowInfo] as PopWindowInfoEntity;
         args.Remove(ParameterNames.PopWindowInfo);
         (_window.DataContext as PopWindowViewModel).InitDatas = args;
         float dpi = FullScreenHelper.GetDPI();
         (_window.DataContext as PopWindowViewModel).PopWindowInfo.WindowWidth  = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width / (dpi / 100) * 0.8;//计算dpi 再乘以当前屏幕的80%
         (_window.DataContext as PopWindowViewModel).PopWindowInfo.WindowHegiht = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height / (dpi / 100) * 0.8;
         _window.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
         _window.Title = notification.Title;
         this.PrepareContentForWindow(notification, _window);
     }
     else
     {
         _window = this.CreateDefaultWindow(notification);
     }
     return(_window);
 }
Beispiel #15
0
 public void Execute()
 {
     if (!WorksIfMuted && App.IsMuted ||
         (!WorksIfForegroundIsFullscreen && FullScreenHelper.DoesAnyMonitorHaveFullscreenApp()))
     {
         return;
     }
     DelayedAction.RunAction((int)Delay.TotalMilliseconds, () =>
     {
         try
         {
             ExecuteAction();
         }
         catch (Exception ex)
         {
             if (ShowErrors)
             {
                 Popup.ShowAsync($"{GetType().Name} failed to execute.\n\n{ex.Message}",
                                 image: MessageBoxImage.Error);
             }
         }
     });
 }
        public ShellFrame()
        {
            SetValue(MenuBarProperty, Repository.MenuBarItems);

            _instance = this;

            _splitscreen = false;

            _shell_data = Navigator.ShellData;

            this.InitializeComponent();

            // The Main Window gets a custom title bar.
            InitializeCustomTitlebar();

            tabbed_frame0.DataContext = _shell_data.Frames[0];
            tabbed_frame1.DataContext = _shell_data.Frames[1];

            // Save column definitions
            _column_definitions = grid_with_a_split.ColumnDefinitions.ToArray();

            // Clear the column definitions
            grid_with_a_split.ColumnDefinitions.Clear();

            _fullScreen = new FullScreenHelper();

            NavigationBarControl.DisplayMenuPanel += NavigationBar_DisplayMenuPanel;
            NavigationBarControl.HideMenuPanel    += NavigationBar_HideMenuPanel;

            WorkSpaceGrid.AddHandler(UIElement.TappedEvent, new TappedEventHandler(WorkSpaceGrid_Tapped), true);
            WorkSpaceGrid.SizeChanged += WorkSpaceGrid_SizeChanged;

            _shell_data.PropertyChanged += ShellData_PropertyChanged;

            this.Loaded += ShellFrame_Loaded;
        }
Beispiel #17
0
 public MainWindow()
 {
     InitializeComponent();
     FullScreenHelper.GoFullscreen(this);
 }