예제 #1
0
        /// <summary>
        /// Stops the timer, disposes off the toast messasge
        /// </summary>
        private void stopTimer()
        {
            try
            {
                unsubscribeFromHookEvents();

                if (_form != null)
                {
                    _form.Invoke(new MethodInvoker(delegate
                    {
                        if (_toastForm != null)
                        {
                            _toastForm.Close();
                            _toastForm = null;
                        }

                        if (_timer != null)
                        {
                            _timer.Stop();
                            if (EvtAutoPostionScannerStopped != null)
                            {
                                EvtAutoPostionScannerStopped(this, EventArgs.Empty);
                            }
                        }
                    }));
                }
            }
            catch
            {
            }
        }
예제 #2
0
        /// <summary>
        /// Starts the timer that repositions the scanner on
        /// a timer tick
        /// </summary>
        public void Start()
        {
            _form.Invoke(new MethodInvoker(delegate()
            {
                _toastForm = new ToastForm("Click to stop", -1);
                Windows.SetWindowPosition(_toastForm, Windows.WindowPosition.CenterScreen);
                _toastForm.Show();

                if (!_timer.Enabled)
                {
                    subscribeToHookEvents();
                    startTimer();
                }
            }));
        }
예제 #3
0
        /// <summary>
        /// Displays a toast message centered in the parent form.
        /// </summary>
        /// <param name="message">message to display</param>
        /// <param name="timeout">how long to display</param>
        public static void Toast(String message, int timeout = 2000)
        {
            var toast = new ToastForm(message, timeout);
            var panel = Context.AppPanelManager.GetCurrentPanel() as Form;

            toast.StartPosition = FormStartPosition.CenterParent;
            toast.ShowDialog(panel);
        }
예제 #4
0
        /// <summary>
        /// Stops the timer, disposes off the toast messasge
        /// </summary>
        private void stopTimer()
        {
            try
            {
                unsubscribeFromHookEvents();

                if (_form != null)
                {
                    _form.Invoke(new MethodInvoker(delegate
                    {
                        if (_toastForm != null)
                        {
                            _toastForm.Close();
                            _toastForm = null;
                        }

                        if (_timer != null)
                        {
                            _timer.Stop();
                            if (EvtAutoPostionScannerStopped != null)
                            {
                                EvtAutoPostionScannerStopped(this, EventArgs.Empty);
                            }
                        }
                    }));
                }
            }
            catch
            {
            }
        }
예제 #5
0
        /// <summary>
        /// Starts the timer that repositions the scanner on
        /// a timer tick
        /// </summary>
        public void Start()
        {
            _form.Invoke(new MethodInvoker(delegate()
            {
                _toastForm = new ToastForm("Click to stop", -1);
                Windows.SetWindowPosition(_toastForm, Windows.WindowPosition.CenterScreen);
                _toastForm.Show();

                if (!_timer.Enabled)
                {
                    subscribeToHookEvents();
                    startTimer();
                }
            }));
        }