Ejemplo n.º 1
0
        private void StartProfile()
        {
            if (ActiveProfile != null && !ActiveProfile.IsStarted)
            {
                ActiveProfile.ControlCenterShown  += Profile_ShowControlCenter;
                ActiveProfile.ControlCenterHidden += Profile_HideControlCenter;
                ActiveProfile.ProfileStopped      += new EventHandler(Profile_ProfileStopped);

                ActiveProfile.Dispatcher = Dispatcher;
                ActiveProfile.Start();

                if (_dispatcherTimer != null)
                {
                    _dispatcherTimer.Stop();
                }

                _dispatcherTimer          = new DispatcherTimer();
                _dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 33);
                _dispatcherTimer.Tick    += new EventHandler(DispatcherTimer_Tick);
                _dispatcherTimer.Start();

                foreach (Monitor monitor in ActiveProfile.Monitors)
                {
                    try
                    {
                        if (monitor.Children.Count > 0 || monitor.FillBackground || !String.IsNullOrWhiteSpace(monitor.BackgroundImage))
                        {
                            ConfigManager.LogManager.LogDebug("Creating window (Monitor=\"" + monitor.Name + "\")");
                            MonitorWindow window = new MonitorWindow(monitor, true);
                            window.Show();
                            _windows.Add(window);
                        }
                    }
                    catch (Exception ex)
                    {
                        ConfigManager.LogManager.LogError("Error creating monitor window (Monitor=\"" + monitor.Name + "\")", ex);
                    }
                }

                //App app = Application.Current as App;
                //if (app == null || (app != null && !app.DisableTouchKit))
                //{
                //    try
                //    {
                //        EGalaxTouch.CaptureTouchScreens(_windows);
                //    }
                //    catch (Exception ex)
                //    {
                //        ConfigManager.LogManager.LogError("Error capturing touchkit screens.", ex);
                //    }
                //}

                Message = "Running Profile";

                if (AutoHideCheckBox.IsChecked == true)
                {
                    Minimize();
                }
                else
                {
                    NativeMethods.BringWindowToTop(_helper.Handle);
                }
            }
        }
Ejemplo n.º 2
0
        private void StartProfile()
        {
            if (ActiveProfile == null || ActiveProfile.IsStarted)
            {
                return;
            }

            ActiveProfile.Dispatcher = Dispatcher;
            if (Preferences.PreflightCheck)
            {
                if (!PerformReadyCheck())
                {
                    // this is already logged as an error because we set the StatusMessage to an error type
                    ConfigManager.LogManager.LogDebug("Aborted start up of Profile due to failed preflight check.");
                    return;
                }
            }
            else
            {
                ReportStatus("Preflight check is disabled.  Helios will not be able to ensure configuration is correct.");
            }

            ActiveProfile.ControlCenterShown   += Profile_ShowControlCenter;
            ActiveProfile.ControlCenterHidden  += Profile_HideControlCenter;
            ActiveProfile.ProfileStopped       += Profile_ProfileStopped;
            ActiveProfile.ProfileHintReceived  += Profile_ProfileHintReceived;
            ActiveProfile.DriverStatusReceived += Profile_DriverStatusReceived;
            ActiveProfile.ClientChanged        += Profile_ClientChanged;

            ActiveProfile.Start();

            if (_dispatcherTimer != null)
            {
                _dispatcherTimer.Stop();
            }

            _dispatcherTimer          = new DispatcherTimer();
            _dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 33);
            _dispatcherTimer.Tick    += new EventHandler(DispatcherTimer_Tick);
            _dispatcherTimer.Start();

            foreach (Monitor monitor in ActiveProfile.Monitors)
            {
                try
                {
                    if (monitor.Children.Count > 0 || monitor.FillBackground || !String.IsNullOrWhiteSpace(monitor.BackgroundImage))
                    {
                        monitor.SuppressMouseAfterTouchDuration = Preferences.SuppressMouseAfterTouchDuration;
                        ConfigManager.LogManager.LogDebug("Creating window (Monitor=\"" + monitor.Name + "\")" + " with touchscreen mouse event suppression delay set to " + Convert.ToString(monitor.SuppressMouseAfterTouchDuration) + " msec.");
                        MonitorWindow window = new MonitorWindow(monitor, Preferences.HighQualityBitmapScaling, true);
                        window.Show();
                        _windows.Add(window);
                    }
                }
                catch (Exception ex)
                {
                    ConfigManager.LogManager.LogError("Error creating monitor window (Monitor=\"" + monitor.Name + "\")", ex);
                }
            }

            // success, consider this the most recently run profile for its tags (usually just the aircraft types supported)
            foreach (string tag in ActiveProfile.Tags)
            {
                PreferencesFile.SaveSetting("RecentByTag", tag, ActiveProfile.Path);
            }

            StatusMessage = StatusValue.Running;

            if (Preferences.AutoHide)
            {
                MinimizeWindow();
            }
            else
            {
                NativeMethods.BringWindowToTop(_helper.Handle);
            }
        }
Ejemplo n.º 3
0
        private void StartProfile()
        {
            if (ActiveProfile != null && !ActiveProfile.IsStarted)
            {
                ActiveProfile.ControlCenterShown += Profile_ShowControlCenter;
                ActiveProfile.ControlCenterHidden += Profile_HideControlCenter;
                ActiveProfile.ProfileStopped += new EventHandler(Profile_ProfileStopped);

                ActiveProfile.Dispatcher = Dispatcher;
                ActiveProfile.Start();

                if (_dispatcherTimer != null)
                {
                    _dispatcherTimer.Stop();
                }

                _dispatcherTimer = new DispatcherTimer();
                _dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 33);
                _dispatcherTimer.Tick += new EventHandler(DispatcherTimer_Tick);
                _dispatcherTimer.Start();

                foreach (Monitor monitor in ActiveProfile.Monitors)
                {
                    try
                    {
                        if (monitor.Children.Count > 0 || monitor.FillBackground || !String.IsNullOrWhiteSpace(monitor.BackgroundImage))
                        {
                            ConfigManager.LogManager.LogDebug("Creating window (Monitor=\"" + monitor.Name + "\")");
                            MonitorWindow window = new MonitorWindow(monitor, true);
                            window.Show();
                            _windows.Add(window);
                        }
                    }
                    catch (Exception ex)
                    {
                        ConfigManager.LogManager.LogError("Error creating monitor window (Monitor=\"" + monitor.Name + "\")", ex);
                    }
                }

                //App app = Application.Current as App;
                //if (app == null || (app != null && !app.DisableTouchKit))
                //{
                //    try
                //    {
                //        EGalaxTouch.CaptureTouchScreens(_windows);
                //    }
                //    catch (Exception ex)
                //    {
                //        ConfigManager.LogManager.LogError("Error capturing touchkit screens.", ex);
                //    }
                //}

                Message = "Running Profile";

                if (AutoHideCheckBox.IsChecked == true)
                {
                    Minimize();
                }
                else
                {
                    NativeMethods.BringWindowToTop(_helper.Handle);
                }
            }

        }