/// <summary> /// Handles "apply" messages from the Visual Studio environment. /// </summary> /// <devdoc> /// This method is called when VS wants to save the user's /// changes (for example, when the user clicks OK in the dialog). /// </devdoc> protected override void OnApply(PageApplyEventArgs e) { IClippyVSSettings storedValues = settings; IClippyVSSettings currentValues = new ClippyVSSettings() { ShowAtStartup = ShowAtStartup }; settings.ShowAtStartup = currentValues.ShowAtStartup; settings.Store(); base.OnApply(e); }
/// <summary> /// Handles "apply" messages from the Visual Studio environment. /// </summary> /// <devdoc> /// This method is called when VS wants to save the user's /// changes (for example, when the user clicks OK in the dialog). /// </devdoc> protected override async void OnApply(PageApplyEventArgs e) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); var shellSettingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider); var writableSettingsStore = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); IClippyVSSettings appliedValues = new ClippyVSSettings(writableSettingsStore) { ShowAtStartup = ShowAtStartup }; appliedValues.Store(); base.OnApply(e); }
async void MainWindow_ContentRendered(object sender, EventArgs e) { var token = new CancellationToken(); await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(token); var shellSettingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider); var writableSettingsStore = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); IClippyVSSettings settings = new ClippyVSSettings(writableSettingsStore); SpriteContainer container = new SpriteContainer(this); if (settings.ShowAtStartup) { container.Show(); } }