Beispiel #1
0
        private void Profile_ProfileHintReceived(object sender, ProfileHint e)
        {
            string oldValue = _lastProfileHint;

            _lastProfileHint = e.Tag;
            if (oldValue != _lastProfileHint)
            {
                UpdateStatusMessage();
                // send only a simple status message to status viewer instead of whole status via ReportStatusToStatusViewer
                ReportStatus($"Simulator is '{_lastProfileHint}'");
            }
            if (!Preferences.ProfileAutoStart)
            {
                return;
            }
            ConfigManager.LogManager.LogDebug($"received profile hint with tag '{e.Tag}'");
            string mostRecent = PreferencesFile.LoadSetting("RecentByTag", e.Tag, null);

            if (mostRecent == null)
            {
                ConfigManager.LogManager.LogInfo($"received profile hint with tag '{e.Tag}' but no matching profile has been loaded; cannot auto load");
                return;
            }
            if ((ActiveProfile != null) && (ActiveProfile.Path == mostRecent))
            {
                ConfigManager.LogManager.LogDebug($"most recent profile for profile hint with tag '{e.Tag}' is already active");
                // ask simulator to use the one we are running, if possible
                ActiveProfile.RequestProfileSupport();
                return;
            }
            // execute auto load
            ConfigManager.LogManager.LogDebug($"trying to start most recent matching profile '{mostRecent}'");
            ControlCenterCommands.RunProfile.Execute(mostRecent, Application.Current.MainWindow);
        }