示例#1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public MainWindow()
        {
            // Get the application settings
            this.m_Settings = SettingsManager.read();
            if (!this.m_Settings.IsValid)
            {
                // Inform the user
                MessageBox.Show("ImarisSelector was not configured on this machine!\n" +
                    "Please contact your administrator.",
                    "Process Info",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);

                // Exit
                Environment.Exit(1);
            }

            // Instantiate the module manager
            this.m_ModuleManager = new ModuleManager(this.m_Settings);

            // Initialize the window components
            InitializeComponent();

            // Make window unresizable
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.MaximizeBox = false;
        }
示例#2
0
        /// <summary>
        /// Fill in the checkedListbox based on the Settings.
        /// </summary>
        private bool FillProductList()
        {
            // Add all products and activate them
            List<String> installedProducts =
                new ModuleManager(this.m_Settings).GetInstalledProductList();

            if (installedProducts.Count == 0)
            {
                return false;
            }

            // We do not display Imaris
            installedProducts.Remove("Imaris");

            // Clear existing lists
            checkedListBoxProducts.Items.Clear();
            this.m_Settings.ProductsWithEnabledState.Clear();

            // Add the new products and states
            foreach (String productName in installedProducts)
            {
                this.m_Settings.ProductsWithEnabledState.Add(productName, true);
                checkedListBoxProducts.Items.Add(productName, true);
            }

            // Return success
            return true;
        }
示例#3
0
        /// <summary>
        /// Update product description in the UI.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void checkedListBoxProducts_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Get the selected product name
            String productName = (String)checkedListBoxProducts.SelectedItem;
            if (productName == null)
            {
                return;
            }

            String descr;
            Dictionary<String, String> productCatalog =
                new ModuleManager(this.m_Settings).GetProductCatalog();
            if (!productCatalog.TryGetValue(productName, out descr))
            {
                descr = "Unknown module.";
            }
            labelProductDescription.Text = descr;
        }