/// <summary> /// Initialize static registry settings. /// NOTE: This should be called only by unit tests. /// </summary> public static void Init() { if (s_measurementUnitSetting != null) return; // Data Notebook has the MeasurementUnits setting in the Data Notebook registry // folder rather than in the folder for general FieldWorks settings. // The MeasurementUnits setting should be set for all FieldWorks applications, // not just in the individual applications. s_measurementUnitSetting = new RegistryIntSetting((int)MsrSysType.Cm, "MeasurementSystem"); // This affects all FieldWorks apps. s_disableSplashScreen = new RegistryBoolSetting(false, "DisableSplashScreen"); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="FwRegistrySettings"/> class. /// </summary> /// <param name="app">The application.</param> /// ------------------------------------------------------------------------------------ public FwRegistrySettings(FwApp app) { if (app == null) throw new ArgumentNullException("app"); m_firstTimeAppHasBeenRun = new RegistryBoolSetting(app.SettingsKey, "FirstTime", true); m_showSideBar = new RegistryBoolSetting(app.SettingsKey, "ShowSideBar", true); m_showStatusBar = new RegistryBoolSetting(app.SettingsKey, "ShowStatusBar", true); m_openLastEditedProject = new RegistryBoolSetting(app.SettingsKey, "OpenLastEditedProject", false); m_loadingProcessId = new RegistryIntSetting(app.SettingsKey, "LoadingProcessId", 0); m_numberOfLaunches = new RegistryIntSetting(app.SettingsKey, "launches", 0); m_numberOfSeriousCrashes = new RegistryIntSetting(app.SettingsKey, "NumberOfSeriousCrashes", 0); m_numberOfAnnoyingCrashes = new RegistryIntSetting(app.SettingsKey, "NumberOfAnnoyingCrashes", 0); m_totalAppRuntime = new RegistryIntSetting(app.SettingsKey, "TotalAppRuntime", 0); m_appStartupTime = new RegistryStringSetting(app.SettingsKey, "LatestAppStartupTime", string.Empty); m_latestProject = new RegistryStringSetting(app.SettingsKey, "LatestProject", string.Empty); m_latestServer = new RegistryStringSetting(app.SettingsKey, "LatestServer", string.Empty); }
/// <summary> /// Release static registry settings. /// NOTE: This should be called only by unit tests. /// </summary> public static void Release() { if (s_measurementUnitSetting != null) s_measurementUnitSetting.Dispose(); s_measurementUnitSetting = null; if (s_disableSplashScreen != null) s_disableSplashScreen.Dispose(); s_disableSplashScreen = null; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="DraftViewWrapper"/> class. /// </summary> /// <param name="name">The name of the split grid</param> /// <param name="parent">The parent of the split wrapper (can be null). Will be replaced /// with real parent later.</param> /// <param name="cache">The cache.</param> /// <param name="styleSheet">The style sheet.</param> /// <param name="settingsRegKey">The settings reg key.</param> /// <param name="draftView">The draft view.</param> /// <param name="stylebar">The stylebar.</param> /// <param name="footnoteDraftView">The footnote draft view.</param> /// <param name="footnoteStylebar">The footnote stylebar</param> /// <param name="rows">The number of rows.</param> /// <param name="columns">The number of columns.</param> /// <remarks>If the view wrapper does not have a stylebar, then override the /// kStyleColumn property to a negative value so that it will be ignored.</remarks> /// ------------------------------------------------------------------------------------ protected ViewWrapper(string name, Control parent, FdoCache cache, IVwStylesheet styleSheet, RegistryKey settingsRegKey, object draftView, object stylebar, object footnoteDraftView, object footnoteStylebar, int rows, int columns) : base(cache, styleSheet, rows, columns) { Dock = DockStyle.Fill; Name = name; m_stylePaneWidth = new RegistryIntSetting(settingsRegKey, name + "StyleWidth", 0); if (parent != null) Site = parent.Site; IRootSiteGroup group = CreateGroup((int)TeViewGroup.Scripture); if (kStyleColumn >= 0) AddControl(group, kDraftRow, kStyleColumn, stylebar); AddControl(group, kDraftRow, kDraftViewColumn, draftView, true, true); group = CreateGroup((int)TeViewGroup.Footnote); if (kStyleColumn >= 0) AddControl(group, kFootnoteRow, kStyleColumn, footnoteStylebar); AddControl(group, kFootnoteRow, kDraftViewColumn, footnoteDraftView, false, true); GetRow(kFootnoteRow).FillWeight = 18; m_grid.Rows[kDraftRow].Visible = true; m_grid.Columns[kDraftViewColumn].Visible = true; m_grid.ColumnWidthChanged += new DataGridViewColumnEventHandler(OnColumnWidthChanged); m_grid.RowHeightChanged += new DataGridViewRowEventHandler(OnRowHeightChanged); if (kStyleColumn >= 0) { DataGridViewControlColumn styleColumn = GetColumn(kStyleColumn); styleColumn.ThresholdWidth = 20; styleColumn.StandardWidth = 100; styleColumn.MaxPercentage = 0.5f; styleColumn.IsCollapsible = true; styleColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.None; if (m_stylePaneWidth.Value > 0) { styleColumn.Width = Math.Max(m_stylePaneWidth.Value, styleColumn.ThresholdWidth); styleColumn.Visible = true; } } }