/// <summary> /// Constructor. /// <param name="settings">Application settings (read from disk).</param> /// </summary> public ApplicationManager(Settings settings) { // Store the settings this.m_Settings = settings; // Initialize the Registry Manager this.m_RegistryManager = new RegistryManager(this.m_Settings.ImarisVersion); }
/// <summary> /// Constructor. /// <param name="settings">Application settings (read from disk).</param> /// </summary> public ModuleManager(Settings settings) { // Store the settings this.m_Settings = settings; // Build the catalog Build(); // Initialize the Registry Manager this.m_RegistryManager = new RegistryManager(this.m_Settings.ImarisVersion); // Make sure the Imaris product is enabled EnableProducts(new List<String> { "Imaris" }); }
/// <summary> /// Constructor. /// </summary> public MainWindow() { // Initialize the UI InitializeComponent(); // Initialize timer for handling the state of the save button timer = new Timer(); timer.Tick += new EventHandler(resetSaveButtonText); timer.Interval = 500; // Make window unresizable this.FormBorderStyle = FormBorderStyle.FixedSingle; this.MaximizeBox = false; // Get the application settings from the settings file. this.m_Settings = SettingsManager.read(); if (this.m_Settings.IsValid) { // Check that the Imaris version stored in the file exists in // the registry. Otherwise inform the admin. RegistryManager manager = new RegistryManager(this.m_Settings.ImarisVersion); if (!manager.ImarisKeyExists()) { // Inform the user MessageBox.Show( "The Imaris version stored in the settings file does not have " + "the corresponding registry entries. This probably means that " + "the settings file is obsolete.\n\n" + "It is highly recommended to choose current Imaris executable " + "to manage and, if needed, reconfigure it.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } // Display the Imaris path on the button buttonImarisPath.Text = this.m_Settings.ImarisPath; // Fill in the list of products checkedListBoxProducts.Items.Clear(); foreach (String productName in this.m_Settings.ProductsWithEnabledState.Keys) { bool state; if (this.m_Settings.ProductsWithEnabledState.ContainsKey(productName)) { if (!this.m_Settings.ProductsWithEnabledState.TryGetValue(productName, out state)) { state = true; } } else { state = true; } // Add the product with the state read from the application settings checkedListBoxProducts.Items.Add(productName, state); } // Now set all other settings // TODO: Add all necessary checks // Texture cache if (this.m_Settings.TextureCache == -1) { numericTextureCache.Text = ""; } else { numericTextureCache.Value = this.m_Settings.TextureCache; } // Data cache if (this.m_Settings.DataCache == -1) { numericDataCache.Text = ""; } else { numericDataCache.Value = this.m_Settings.DataCache; } // Data cache file paths if (!this.m_Settings.DataBlockCachingFilePath.Equals("")) { String[] dataBlockCachingFilePathArray = this.m_Settings.DataBlockCachingFilePath.Split(';'); listCLFileCachePaths.Items.Clear(); foreach (String d in dataBlockCachingFilePathArray) { if (!d.Equals("")) { listCLFileCachePaths.Items.Add(d); } } } // XT folder paths if (!this.m_Settings.XTFolderPath.Equals("")) { String[] xtFolderPathArray = this.m_Settings.XTFolderPath.Split(';'); listCTXTPaths.Items.Clear(); foreach (String x in xtFolderPathArray) { if (!x.Equals("")) { listCTXTPaths.Items.Add(x); } } } // Python path if (!this.m_Settings.PythonPath.Equals("")) { buttonCTAddPythonPath.Text = this.m_Settings.PythonPath; } // Fiji path if (!this.m_Settings.FijiPath.Equals("")) { buttonCTAddFijiPath.Text = this.m_Settings.FijiPath; } // Enable save button this.buttonSave.Enabled = true; } }