Example #1
0
        private static void Main()
        {
            // if already running, activate it
            if (Process.GetProcessesByName(Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location)).Length > 1)
            {
                IntPtr handle = User32Interop.FindWindow(null, _title);
                if (handle != IntPtr.Zero)
                {
                    User32Interop.ShowWindow(handle.ToInt32(), User32Interop.SW_SHOW);
                }
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            FileUtils.LogAssemblyInfo();

            Splash splash = new Splash(1000);

            splash.Show();

            splash.Close();

            DashboardSettings.PreferencesFilePath = FileUtils.GetFullPathRelativeToApp(_settingsFileName);

            Settings = DashboardSettings.Load();

            var form = new DashboardForm {
                Text = _title
            };

            Application.Run(form);
        }
Example #2
0
        public static void ShowTaskBar()
        {
            IntPtr hwnd = User32Interop.FindWindow("Shell_TrayWnd", "");
            User32Interop.ShowWindow(hwnd, WindowShowStyle.Show);

            IntPtr hwndOrb = User32Interop.FindWindowEx(IntPtr.Zero, IntPtr.Zero, (IntPtr)0xC017, null);
            User32Interop.ShowWindow(hwndOrb, WindowShowStyle.Show);
        }
Example #3
0
        /// <summary>
        /// Closes the talk window. Checks if lecture manager
        /// is active, if so, shows it.  Else, launches a
        /// new instance
        /// </summary>
        /// <param name="form">scanner form</param>
        private void showLectureManager(Form form)
        {
            IntPtr handle = User32Interop.FindWindow(null, R.GetString("LectureManager"));

            if (handle != IntPtr.Zero)
            {
                User32Interop.SetForegroundWindow(handle);
            }
            else
            {
                launchLectureManager(form);
            }
        }
Example #4
0
        /// <summary>
        /// Closes the talk window. Checks if lecture manager
        /// is active, if so, shows it.  Else, launches a
        /// new instance
        /// </summary>
        /// <param name="form">scanner form</param>
        private void showLectureManager(Form form)
        {
            Context.AppTalkWindowManager.CloseTalkWindow();
            IntPtr handle = User32Interop.FindWindow(null, "Lecture Manager");

            if (handle != IntPtr.Zero)
            {
                User32Interop.SetForegroundWindow(handle);
            }
            else
            {
                launchLectureManager(form);
            }
        }
Example #5
0
        /// <summary>
        /// Perform initialization. Hides vision software windows
        /// </summary>
        /// <returns>true on success</returns>
        public override bool Init()
        {
            Settings.SettingsFilePath = UserManager.GetFullPath(SettingsFileName);
            CameraActuatorSettings    = Settings.Load();

            ServerAddress = CameraActuatorSettings.SocketClientConnectToAddress;
            ServerPort    = CameraActuatorSettings.SocketClientConnectToPort;

            IntPtr handle = User32Interop.FindWindow(null, CameraActuatorSettings.ACATVisionWindowName);

            if (handle != IntPtr.Zero)
            {
                Windows.MinimizeWindow(handle);
            }

            return(base.Init());
        }
Example #6
0
        /// <summary>
        /// Waits for MS Word to start. Does this by
        /// checking if the window with the file name title
        /// was created
        /// </summary>
        /// <param name="fileName">name of the file loaded</param>
        private void waitForWordWindow(String fileName)
        {
            String name  = Path.GetFileName(fileName);
            String title = name + " - Microsoft Word";

            Log.Debug(title);
            for (int ii = 0; ii < 10; ii++)
            {
                IntPtr h = User32Interop.FindWindow(null, title);
                if (h != IntPtr.Zero)
                {
                    Log.Debug("window FOUND!!!");
                    break;
                }

                Log.Debug("window not found");
                Thread.Sleep(500);
            }
        }
Example #7
0
        /// <summary>
        /// For text files, checks if the file is already
        /// open in notepad. IF so, activates the window
        /// </summary>
        /// <param name="fileName">name of the file</param>
        /// <returns>true if window was found</returns>
        private bool activateWindowIfAlreadyOpen(String fileName)
        {
            String extension = Path.GetExtension(fileName);

            Log.Debug("Extension: [" + extension + "]");
            if (extension.Equals(".txt", StringComparison.InvariantCultureIgnoreCase) || String.IsNullOrEmpty(extension))
            {
                String name  = Path.GetFileName(fileName);
                String title = name + " - Notepad";
                Log.Debug("Finding window " + title);
                IntPtr h = User32Interop.FindWindow(null, title);
                Log.Debug("handle h = " + h);
                if (h != IntPtr.Zero)
                {
                    User32Interop.ShowWindowAsync(h, User32Interop.SW_RESTORE);
                    activateWindow(h);
                    return(true);
                }

                Log.Debug("Could not find window");
            }

            return(false);
        }
Example #8
0
        public static void MinimizeEverything()
        {
            IntPtr lHwnd = User32Interop.FindWindow("Shell_TrayWnd", null);

            User32Interop.SendMessage(lHwnd, User32_WS.WM_COMMAND, (IntPtr)User32_WS.MIN_ALL, IntPtr.Zero);
        }