Exemple #1
0
        private IntPtr captureKey(int nCode, IntPtr wp, IntPtr lp)
        {
            if (nCode >= 0)
            {
                KBDLLHOOKSTRUCT objKeyInfo = (KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lp, typeof(KBDLLHOOKSTRUCT));
                if (objKeyInfo.key == Forms.Keys.Right)
                {
                    MonitorManager.CenteredCursorInRight();
                }
                if (objKeyInfo.key == Forms.Keys.Left)
                {
                    MonitorManager.CenteredCursorInLeft();
                }

                KeyBordControlMedia(objKeyInfo);

                if (App.Setting.IsKioskMode)
                {
                    if (objKeyInfo.key == Forms.Keys.RWin ||
                        objKeyInfo.key == Forms.Keys.LWin ||
                        objKeyInfo.key == Forms.Keys.Alt ||
                        objKeyInfo.key == Forms.Keys.Tab ||
                        objKeyInfo.key == Forms.Keys.Delete ||
                        objKeyInfo.key == Forms.Keys.F4 ||
                        objKeyInfo.key == Forms.Keys.Control ||
                        objKeyInfo.key == Forms.Keys.Escape)
                    {
                        return((IntPtr)1);
                    }
                }
            }


            return(CallNextHookEx(ptrHook, nCode, wp, lp));
        }
Exemple #2
0
 public void ChangeDisplay(int numberMonitor)
 {
     MonitorManager.MoveWindow(LockScreenWindowName, numberMonitor);
     //WindowState = WindowState.Normal;
     //WindowState = WindowState.Maximized;
     Topmost = false;
     //Hide();
     _log.Error("hide");
 }
        public static void RestartApp()
        {
            try
            {
                var _rep = App.Repository;
                MainWnd = new MainWindow();
                if (MonitorManager.IsTwoMonitor)
                {
                    LockDisplayWindow = new LockScreenWindow();
                }
                else
                {
                    MessageBox.Show("Пожалуйста подключите второй монитор или окулус");
                    return;
                }

                if (_rep.Setting.FirstOrDefault() == null)
                {
                    _rep.FirstExecute();
                }
                else
                {
                    Setting.Import();
                }


                if (App.Setting.IsKioskMode)
                {
                    Taskbar.Hide();
                    MainWnd.Topmost = true;
                }
                else
                {
                    MainWnd.Topmost = false;
                }

                if (MonitorManager.IsTwoMonitor)
                {
                    LockDisplayWindow.Show();
                }
                MainWnd.Show();
                MonitorManager meneger = new MonitorManager();

                if (MonitorManager.IsTwoMonitor)
                {
                    MonitorManager.RestartPositionWindows();
                }
            }
            catch (Exception ex)
            {
                MainWnd.Show();
                App.Frame.Navigate(new MainSettingPage(true));
            }
        }
        public static void RestartApp()
        {
            try
            {
                var _rep = App.Repository;
                MainWnd = new MainWindow();

                ScreenManagerInit();

                if (_rep.Setting.FirstOrDefault() == null)
                {
                    _rep.FirstExecute();
                }
                else
                {
                    Setting.Import();
                }


                if (App.Setting.IsKioskMode)
                {
                    Taskbar.Hide();
                    MainWnd.Topmost = true;
                }
                else
                {
                    MainWnd.Topmost = false;
                }

                if (MonitorManager.IsTwoMonitor)
                {
                    LockDisplayWindow.Show();
                }
                MainWnd.Show();
                MonitorManager meneger = new MonitorManager();

                if (MonitorManager.IsTwoMonitor)
                {
                    MonitorManager.RestartPositionWindows();
                }
            }
            catch (Exception ex)
            {
                MainWnd.Show();
                App.Frame.Navigate(new MainSettingPage(true));

                SingeltonCommandInvoker <NavigateToCommand> .Command.Execute(new ComandArgs(nameof(MainSettingPage), true));
            }
        }
 public void ChangeDisplay(int numberMonitor)
 {
     try
     {
         MonitorManager.MoveWindow(LockScreenWindowName, numberMonitor);
         //WindowState = WindowState.Normal;
         //WindowState = WindowState.Maximized;
         Topmost = false;
         //Hide();
     }
     catch (Exception ex)
     {
         App.SendException(ex);
     }
 }
        public void Application_Startup(object sender, StartupEventArgs e)
        {
            try
            {
                log4net.Config.XmlConfigurator.Configure();

                Logger.Info("Start seanse in VrManager!!!!!");
                var a = App.Repository.Setting;
            }
            catch (Exception ex)
            {
                App.Logger.Error($"exeption {ex.Message} (Пожалуста установите Microsoft SQL Server Compact 4.0) ||| in class {nameof(App)} and method {GetStackTraseMethod().GetMethod().Name}");
                MessageBox.Show("Пожалуста установите Microsoft SQL Server Compact 4.0");
                return;
            }
            try
            {
                MainWnd = new VrManager.MainWindow();
                MainWnd.Show();
                var _rep = App.Repository;
                if (MonitorManager.IsTwoMonitor)
                {
                    LockDisplayWindow = new LockScreenWindow();
                }

                if (_rep.Setting.FirstOrDefault() == null)
                {
                    _rep.FirstExecute();
                }
                else
                {
                    Setting.Import();
                }

                ObserverUserActivity.StartActivityObserv();

                if (App.Setting.IsKioskMode)
                {
                    Taskbar.Hide();
                    MainWnd.Topmost = true;
                }
                else
                {
                    MainWnd.Topmost = false;
                }

                if (MonitorManager.IsTwoMonitor)
                {
                    LockDisplayWindow.Show();
                }
                MainWnd.Show();

                MonitorManager.RestartPositionWindows();
            }
            catch (Exception ex)
            {
                try
                {
                    MainWnd.Show();
                }
                catch
                {
                    MessageBox.Show("Подключите оккулус или второй монитор");
                }
                App.Frame.Navigate(new MainSettingPage(true));
            }
        }