/// <summary> /// Click event for the OK button. Applies any prefs changes. /// </summary> private void btn_OK_Click(Object sender, EventArgs e) { SSPrefs tprefs = new SSPrefs(); try { tprefs = OptionsPageGeneral.Apply(); } catch { return; //Do not close the dialog if there was a problem } guiprefs.OpenMostRecentDB = tprefs.OpenMostRecentDB; guiprefs.ABAfterOps = tprefs.ABAfterOps; guiprefs.ABAfterTime = tprefs.ABAfterTime; guiprefs.ABNumberKept = tprefs.ABNumberKept; guiprefs.ABOps = tprefs.ABOps; guiprefs.ABTime = tprefs.ABTime; guiprefs.AutoBackup = tprefs.AutoBackup; guiprefs.DefaultBackupDir = tprefs.DefaultBackupDir; guiprefs.DefaultDBDir = tprefs.DefaultDBDir; DialogResult = DialogResult.OK; Close(); }
public void OnClosedTest() { OptionsPageGeneral target = new OptionsPageGeneral(); Microsoft_Samples_VisualStudio_IDE_OptionsPage_OptionsPageGeneralAccessor accessor = optionsPageGeneralAccessor; EventArgs e = null; accessor.OnClosed(e); }
private void InitializeSolutionServiceEvents() { if (_solutionService != null) { _solutionService.AdviseSolutionEvents(this, out _solutionEventsCookie); _options = (OptionsPageGeneral)GetDialogPage(typeof(OptionsPageGeneral)); } }
public void OptionsPageGeneralTestInitialize() { testString = "This is the test string."; tmpImgFilePath = AppDomain.CurrentDomain.BaseDirectory + Path.DirectorySeparatorChar + tmpImgFilePath; optionsPageGeneral = new OptionsPageGeneral(); optionsPageGeneralAccessor = new Microsoft_Samples_VisualStudio_IDE_OptionsPage_OptionsPageGeneralAccessor(optionsPageGeneral); // to forbid display of MessageBoxes WinFormsHelper.AllowMessageBox = false; }
public void OptionStringTest() { OptionsPageGeneral target = optionsPageGeneral; string expectedStringValue = testString; target.OptionString = expectedStringValue; Assert.AreEqual(expectedStringValue, target.OptionString, "OptionString property was not returned expected value."); }
public void OptionIntegerTest() { OptionsPageGeneral target = optionsPageGeneral; int expectedIntegerValue = int.MaxValue; target.OptionInteger = expectedIntegerValue; Assert.AreEqual(expectedIntegerValue, target.OptionInteger, "OptionInteger property was not returned expected value."); }
public void CustomSizeTest() { OptionsPageGeneral target = optionsPageGeneral; Size expectedSizeValue = new Size(100, 100); target.CustomSize = expectedSizeValue; Assert.AreEqual(expectedSizeValue, target.CustomSize, "CustomSize property was not returned expected value."); }
/// <summary> /// Clean up any resources being used. /// </summary> protected virtual void Dispose(bool disposing) { if (disposing) { if (optionsPageGeneral != null) { optionsPageGeneral = null; } GC.SuppressFinalize(this); } }
public void OnActivateTest() { OptionsPageGeneral target = optionsPageGeneral; Microsoft_Samples_VisualStudio_IDE_OptionsPage_OptionsPageGeneralAccessor accessor = optionsPageGeneralAccessor; CancelEventArgs cancelEventArgs = new CancelEventArgs(false); // we simulate Cancel button choice, in this case we expect that // cancelEventArgs.Cancel was switched to the true state. WinFormsHelper.FakeDialogResult = DialogResult.Cancel; accessor.OnActivate(cancelEventArgs); Assert.IsTrue(cancelEventArgs.Cancel, "CancelEventArgs Cancel property was initialized by not expected value in case when simulated Cancel button choice."); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { try { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this)); base.Initialize(); // InitializePackageServices _dte = (DTE2)GetGlobalService(typeof(DTE)); _log = GetService(typeof(SVsActivityLog)) as IVsActivityLog; // Initialize Tools->Options Page _options = (OptionsPageGeneral)GetDialogPage(typeof(OptionsPageGeneral)); //var sccProvider = (Microsoft.VisualStudio.Shell.Interop.IVsGetScciProviderInterface)GetService(typeof(IVsRegisterScciProvider)); //var sccProvider = (IVsRegisterScciProvider)GetGlobalService(typeof(IVsRegisterScciProvider)); //sccProvider.GetSourceControlProviderID(out var pGuid); // Initialize Solution Service Events _solutionService = (IVsSolution2)GetGlobalService(typeof(SVsSolution)); if (_solutionService != null) { _solutionService.AdviseSolutionEvents(this, out _solutionEventsCookie); } _debuggerEvents = (EnvDTE.DebuggerEvents)_dte.Events.DebuggerEvents; _debuggerEvents.OnEnterRunMode += new _dispDebuggerEvents_OnEnterRunModeEventHandler(OnEnterRunMode); ; _debuggerEvents.OnEnterDesignMode += new _dispDebuggerEvents_OnEnterDesignModeEventHandler(OnEnterDesignMode); ; //InitializeOutputWindowPane if (_dte != null && _dte.ToolWindows.OutputWindow.OutputWindowPanes.Cast<OutputWindowPane>().All(p => p.Name != _options.OutputPane)) { _dte.ToolWindows.OutputWindow.OutputWindowPanes.Add(_options.OutputPane); } InitializeMenus(); InitializeAutoShelve(); } catch (Exception ex) { WriteException(ex); } }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { try { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this)); base.Initialize(); // InitializePackageServices _dte = (DTE2)GetGlobalService(typeof(DTE)); _log = GetService(typeof(SVsActivityLog)) as IVsActivityLog; // Initialize Tools->Options Page _options = (OptionsPageGeneral)GetDialogPage(typeof(OptionsPageGeneral)); // Initialize Solution Service Events _solutionService = (IVsSolution2)GetGlobalService(typeof(SVsSolution)); _solutionService?.AdviseSolutionEvents(this, out _solutionEventsCookie); var debuggerEvents = _dte.Events.DebuggerEvents; debuggerEvents.OnEnterRunMode += new _dispDebuggerEvents_OnEnterRunModeEventHandler(OnEnterRunMode); debuggerEvents.OnEnterDesignMode += new _dispDebuggerEvents_OnEnterDesignModeEventHandler(OnEnterDesignMode); //InitializeOutputWindowPane if (_dte.ToolWindows.OutputWindow.OutputWindowPanes.Cast <OutputWindowPane>().All(p => p.Name != _options.OutputPane)) { _dte.ToolWindows.OutputWindow.OutputWindowPanes.Add(_options.OutputPane); } InitializeMenus(); InitializeAutoShelve(); } catch (Exception ex) { WriteException(ex); } }
public void OptionsPageGeneralTestCleanup() { optionsPageGeneral = null; Dispose(); }
/// <summary> /// Constructor /// </summary> /// <param name="_guiprefs">Where the current options are and where to store them on apply.</param> public SSOptionsDialog(SSPrefs _guiprefs) { InitializeComponent(); guiprefs = _guiprefs; OptionsPageGeneral.Activate(); }