public override bool Commit()
        {
            var screens = Screens.Where(s => s.IsSelected.Value).Select(s => s.Id).ToArray();

            Tracker.Instance.SendEvent(AnalyticsCategories.Configuration, AnalyticsEvents.TotalViewportDisplayCount, screens.Length.ToString());

            _profileSettingsService.SetValue(ProfileSettingsCategories.Viewports, SettingsKeys.DeviceViewportsDisplays, screens);

            var profiles        = SettingsProfileStorageAdapter.GetAll();
            var selectedProfile = profiles.FirstOrDefault(p => p.Name == _profileSettingsService.SelectedProfileName);

            Guard.RequireIsNotNull(selectedProfile, nameof(selectedProfile));

            switch (selectedProfile.ProfileType)
            {
            case SettingsProfileType.SingleMonitor:
                break;

            case SettingsProfileType.SimPit:
            case SettingsProfileType.Helios:
                if (screens.Length == 1)
                {
                    Controller.Steps.Add(new SelectInitialViewportsWizardStepViewModel(Container));
                }
                break;

            case SettingsProfileType.VirtualReality:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(base.Commit());
        }
コード例 #2
0
        private void OnRemoveProfile()
        {
            try
            {
                var profiles = SettingsProfileStorageAdapter.GetAll();

                if (profiles.Count() == 1)
                {
                    MessageBoxEx.Show("Cannot delete the only profile that exists.  Create a new profile first, then delete this one if you wish to discard it.", "CANNOT DELETE");
                    return;
                }

                var profile = SelectedProfile.Value;

                if (profile == null)
                {
                    return;
                }

                if (MessageBoxEx.Show($"Are you sure you want to remove the {profile.Name.Value} profile?", "Remove Profile", System.Windows.MessageBoxButton.YesNo) == System.Windows.MessageBoxResult.Yes)
                {
                    Profiles.Remove(profile);
                    Controller.RemoveProfile(profile.Name.Value);

                    UpdateProfiles();
                }
            }
            catch (Exception e)
            {
                GeneralExceptionHandler.Instance.OnError(e);
            }
        }
コード例 #3
0
        private void Load()
        {
            Tracer.Info("Loading profiles");

            try
            {
                var profiles = SettingsProfileStorageAdapter.GetAll();
                _profiles.AddRange(profiles);
            }
            catch (Exception e)
            {
                GeneralExceptionHandler.Instance.OnError(e);
            }
        }
コード例 #4
0
        private void UpdateProfiles()
        {
            var profiles = SettingsProfileStorageAdapter.GetAll();

            Profiles.Clear();

            foreach (var profile in profiles)
            {
                var model = new SettingsProfileModel(profile.Name);
                Profiles.Add(model);
            }

            var selectedProfileName = _profileSettingsService.SelectedProfileName;

            SelectedProfile.Value = Profiles.FirstOrDefault(p => p.Name.Value == selectedProfileName) ?? Profiles.FirstOrDefault();
        }
コード例 #5
0
        private void UpdateProfiles()
        {
            try
            {
                Profiles.Clear();

                var profiles = SettingsProfileStorageAdapter.GetAll();

                foreach (var profile in profiles)
                {
                    var model = new SettingsProfileModel(profile.Name);
                    Profiles.Add(model);
                }
            }
            catch (Exception e)
            {
                Tracer.Error(e);
            }
        }