Beispiel #1
0
        //////////////////////////////////////////////////////////////////////
        // Func: RadioButtonCheckedChanged()
        // Desc: EventHandler for Radio Buttons, checks the tags associated
        //       with each radio button. Depending on the Tag it will either
        //       retrieve the folder information from the SDK directory or from
        //       the registry
        //////////////////////////////////////////////////////////////////////
        private void RadioButtonCheckedChanged(object sender, EventArgs e)
        {
            RadioButton    RB = (RadioButton)sender;
            RadioButtonTag rt = (RadioButtonTag)RB.Tag;

            //If it has a valid folder use that
            if (MySet.isValidStr(rt.Folder))
            {
                EnableCBox(rt.SDKname);
                ClearCBox(rt.SDKname);
                TagComboBox(rt.SDKname, rt.OptionName);         // Each combo box knows what option it has selected

                if (MySet.bSDKManagerNetworkPathIsValid)
                {
                    FillCBoxWithFolder(rt.SDKname, rt.Folder, true, "", false);
                }
            }
            else  // lookup project specifics
            {
                // Disabled Logic!
                if (rt.Disabled == "true")
                {
                    ClearCBox(rt.SDKname);
                    TagComboBox(rt.SDKname, rt.OptionName);
                    DisableCBox(rt.SDKname);                   // Disable the combo Box
                }
                else
                {
                    EnableCBox(rt.SDKname);
                    ClearCBox(rt.SDKname);
                    TagComboBox(rt.SDKname, rt.OptionName);  // Each combo box knows what option it has selected

                    // Retrive Folder Settings from Project Info
                    RegistryKey ProjectType = MySet.ProjectTypes.OpenSubKey(rt.ProjectType);

                    if (MySet.isValid(ProjectType))
                    {
                        // First check for basepath and exclude dirs
                        object path    = ProjectType.GetValue("BasePath");
                        object exclude = ProjectType.GetValue("ExcludeDirs");
                        object include = ProjectType.GetValue("IncludeDirs");

                        if (MySet.isValidStr(path))
                        {
                            if (MySet.isValidStr(include) && Directory.Exists(path.ToString()))
                            {
                                FillCBoxWithFolder(rt.SDKname, path.ToString(), false, include.ToString(), true);
                            }
                            else if (MySet.isValidStr(exclude) && Directory.Exists(path.ToString()))
                            {
                                FillCBoxWithFolder(rt.SDKname, path.ToString(), false, exclude.ToString(), false);
                            }
                            else if (Directory.Exists(path.ToString()))
                            {
                                FillCBoxWithFolder(rt.SDKname, path.ToString(), false, "", false);
                            }
                        }
                    }
                    else
                    {
                        MySet.Alert(rt.ProjectType + " is invalid, check Registry");
                    }
                }
            }
        }
Beispiel #2
0
        //////////////////////////////////////////////////////////////////////
        // Func: DrawOptionalRadioButton()
        // Desc: Draws optional Radio Buttons for the SDK (if they are in the
        //       registry)
        //
        // Prms: +SDKname = the name of an SDK to draw Radio Buttons for
        //////////////////////////////////////////////////////////////////////
        private void DrawOptionalRadioButton(string SDKName)
        {
            // check if options are enabled and use thos to draw the combo box with options:
            RegistryKey SDKSpecOptions = MySet.SDKSettings.OpenSubKey(SDKName);

            // Check if options are there first
            if (SDKSpecOptions.SubKeyCount >= 1)
            {
                Panel panel = new Panel();    // intentionally itialized even for hOnly

                if (!hOnly)
                {
                    panel.Left = LEFT;
                    panel.Top  = topPosition;
                    panel.Name = "pnl" + SDKName;
                }

                int radioButPosition = 0;

                foreach (string option in SDKSpecOptions.GetSubKeyNames())
                {
                    if (!hOnly)
                    {
                        RegistryKey OptionSpec    = SDKSpecOptions.OpenSubKey(option);
                        object      isDefault     = OptionSpec.GetValue("default");
                        object      opLabel       = OptionSpec.GetValue("Label");
                        object      opProjectType = OptionSpec.GetValue("ProjectType");
                        object      opFolder      = OptionSpec.GetValue("Folder");

                        RadioButton radioButton = new RadioButton();
                        radioButton.AutoSize = true;
                        radioButton.Top      = radioButPosition;
                        radioButton.Left     = 0;
                        radioButton.Name     = option;
                        radioButton.UseVisualStyleBackColor = true;
                        radioButton.TabIndex = tabIndex++;

                        RadioButtonTag aTag = new RadioButtonTag();
                        aTag.SDKname    = SDKName;
                        aTag.OptionName = option;

                        if (MySet.isValidStr(opProjectType))
                        {
                            aTag.ProjectType = opProjectType.ToString();
                        }

                        if (MySet.isValidStr(opFolder))
                        {
                            aTag.Folder = opFolder.ToString();
                        }

                        if (MySet.isValidStr(opLabel))
                        {
                            radioButton.Text = opLabel.ToString();

                            if (radioButton.Text == "Disabled")
                            {
                                aTag.Disabled = "true";
                            }
                        }
                        else
                        {
                            radioButton.Text = option + " label for " + SDKName + " not specified";
                        }

                        // Assigning the Tag to the Button!
                        radioButton.Tag = aTag;

                        radioButton.CheckedChanged += new System.EventHandler(this.RadioButtonCheckedChanged);

                        // Checking Radio Button if it is a default
                        if (MySet.isValidStr(isDefault))
                        {
                            if (isDefault.ToString() == "true")
                            {
                                radioButton.Checked = true;
                                radioButton.PerformClick(); // have default radio option selected
                            }
                        }

                        panel.Controls.Add(radioButton);
                    }

                    radioButPosition += Settings.RBUTTON_SPACING; //spacing for radio button
                }

                if (!hOnly)
                {
                    panel.Height = radioButPosition;
                    panel.Width  = Settings.WIDTH;
                }

                topPosition += radioButPosition + Settings.AFTER_RBUTTONS_SPACING;

                if (!hOnly)
                {
                    PanelToDrawTo.Controls.Add(panel);
                }
            }
        }