Exemplo n.º 1
0
        /// <summary>
        /// Form is being loaded; restore settings.
        /// </summary>
        /// <param name="sender">Unused.</param>
        /// <param name="e">Unused.</param>
        private void ClusterBrowser_Load(object sender, EventArgs e)
        {
            this.formSettings = new ClusterBrowserSettings();
            Rectangle rect = System.Windows.Forms.Screen.PrimaryScreen.Bounds;

            // set location only if it is inside
            if (rect.Contains(this.formSettings.Location))
            {
                this.Location = this.formSettings.Location;
            }
            bool maximized = this.formSettings.MaximizeWindow;

            if (maximized)
            {
                this.WindowState = FormWindowState.Maximized;
            }
            else
            {
                // then we care about the size
                this.Size = this.formSettings.Size;
            }
            this.autoRefreshToolStripMenuItem.Checked = this.formSettings.AutoRefresh;

            this.AddClusterNameToMenu("<add>");
            this.AddClusterNameToMenu("<scan>");

            ClusterConfiguration.ReconstructKnownCluster(this.formSettings.KnownClusters);

            int found = 0;
            IEnumerable <string> clusters = ClusterConfiguration.GetKnownClusterNames();

            foreach (string c in clusters)
            {
                this.AddClusterNameToMenu(c);
                var config = ClusterConfiguration.KnownClusterByName(c);
                if (config is CacheClusterConfiguration)
                {
                    (config as CacheClusterConfiguration).StartCaching();
                }
                found++;
            }

            if (found == 0)
            {
                // try to find them by scanning
                this.ScanClusters();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Form is being loaded; restore settings.
        /// </summary>
        /// <param name="sender">Unused.</param>
        /// <param name="e">Unused.</param>
        private void ClusterBrowser_Load(object sender, EventArgs e)
        {
            this.formSettings = new ClusterBrowserSettings();
            Rectangle rect = System.Windows.Forms.Screen.PrimaryScreen.Bounds;
            // set location only if it is inside
            if (rect.Contains(this.formSettings.Location))
                this.Location = this.formSettings.Location;
            bool maximized = this.formSettings.MaximizeWindow;
            if (maximized)
                this.WindowState = FormWindowState.Maximized;
            else
                // then we care about the size
                this.Size = this.formSettings.Size;
            this.autoRefreshToolStripMenuItem.Checked = this.formSettings.AutoRefresh;

            this.AddClusterNameToMenu("<add>");
            this.AddClusterNameToMenu("<scan>");

            ClusterConfiguration.ReconstructKnownCluster(this.formSettings.KnownClusters);

            int found = 0;
            IEnumerable<string> clusters = ClusterConfiguration.GetKnownClusterNames();
            foreach (string c in clusters)
            {
                this.AddClusterNameToMenu(c);
                var config = ClusterConfiguration.KnownClusterByName(c);
                if (config is CacheClusterConfiguration)
                {
                    (config as CacheClusterConfiguration).StartCaching();
                }
                found++;
            }

            if (found == 0)
                // try to find them by scanning 
                this.ScanClusters();
        }