Ejemplo n.º 1
0
        /// <summary>
        /// Settings button operation, load the settings screen
        /// </summary>
        /// <param name="sender">sender object</param>
        /// <param name="e">event arguments</param>
        private void BtnSettings_Click(object sender, EventArgs e)
        {
            if (settingsScreen == null || settingsScreen.IsDisposed)
            {
                settingsScreen = new ConfigurationScreen();
            }

            settingsScreen.TopMost       = true;
            settingsScreen.StartPosition = FormStartPosition.CenterScreen;
            settingsScreen.Show();
            settingsScreen.Refresh();
        }
Ejemplo n.º 2
0
        private void LoadScreen()
        {
            int height = Height;

            // Remove all
            pScreen.Controls.Clear();
            string type = cbType.SelectedItem == null ? null : cbType.SelectedItem.ToString();

            if (string.IsNullOrEmpty(type))
            {
                ClientSize    = new Size(ClientSize.Width, pScreen.Top + panelOffset);
                btAdv.Visible = false;
                return;
            }
            ConfigurationScreen cs = SunfishService.GetConfigurator(type).GetConfigurationScreen();

            btAdv.Visible = cs.Advanced != null;
            // Create new
            int y = 0;

            foreach (ConfigurationElement ce in cs.Elements)
            {
                if (ce is ConfigurationMessage)
                {
                    AddElementMessage((ConfigurationMessage)ce, pScreen, ref y);
                }
                else if (ce is ConfigurationString)
                {
                    AddElementString((ConfigurationString)ce, pScreen, ref y);
                }
                else if (ce is ConfigurationBool)
                {
                    AddElementBool((ConfigurationBool)ce, pScreen, ref y);
                }
            }
            ClientSize = new Size(ClientSize.Width, y + pScreen.Top + panelOffset + 5);
            if (Visible)
            {
                Top -= (Height - height) / 2;
            }
        }