示例#1
0
        private void AddCustomControls(CommonFileDialog openDialog)
        {
            // Add a RadioButtonList
            CommonFileDialogRadioButtonList list = new CommonFileDialogRadioButtonList("Options");

            list.Items.Add(new CommonFileDialogRadioButtonListItem("Option A"));
            list.Items.Add(new CommonFileDialogRadioButtonListItem("Option B"));
            list.SelectedIndexChanged += RBLOptions_SelectedIndexChanged;
            list.SelectedIndex         = 1;
            openDialog.Controls.Add(list);

            // Create a groupbox
            CommonFileDialogGroupBox groupBox = new CommonFileDialogGroupBox("Options");

            // Create and add two check boxes to this group
            CommonFileDialogCheckBox checkA = new CommonFileDialogCheckBox("Option A", true);
            CommonFileDialogCheckBox checkB = new CommonFileDialogCheckBox("Option B", true);

            checkA.CheckedChanged += ChkOptionA_CheckedChanged;
            checkB.CheckedChanged += ChkOptionB_CheckedChanged;
            groupBox.Items.Add(checkA);
            groupBox.Items.Add(checkB);

            // Create and add a separator to this group
            groupBox.Items.Add(new CommonFileDialogSeparator());

            // Create and add a button to this group
            CommonFileDialogButton btnCFDPushButton = new CommonFileDialogButton("Push Button");

            btnCFDPushButton.Click += PushButton_Click;
            groupBox.Items.Add(btnCFDPushButton);

            // Add groupbox to dialog
            openDialog.Controls.Add(groupBox);

            // Add a Menu
            CommonFileDialogMenu     menu  = new CommonFileDialogMenu("Sample Menu");
            CommonFileDialogMenuItem itemA = new CommonFileDialogMenuItem("Menu Item 1");
            CommonFileDialogMenuItem itemB = new CommonFileDialogMenuItem("Menu Item 2");

            itemA.Click += MenuOptionA_Click;
            itemB.Click += MenuOptionA_Click;
            menu.Items.Add(itemA);
            menu.Items.Add(itemB);
            openDialog.Controls.Add(menu);

            // Add a TextBox
            openDialog.Controls.Add(new CommonFileDialogLabel("Enter name"));
            openDialog.Controls.Add(new CommonFileDialogTextBox("textBox", Environment.UserName));

            // Add a ComboBox
            CommonFileDialogComboBox comboBox = new CommonFileDialogComboBox();

            comboBox.SelectedIndexChanged += ComboEncoding_SelectedIndexChanged;
            comboBox.Items.Add(new CommonFileDialogComboBoxItem("Combobox Item 1"));
            comboBox.Items.Add(new CommonFileDialogComboBoxItem("Combobox Item 2"));
            comboBox.SelectedIndex = 1;
            openDialog.Controls.Add(comboBox);
        }
示例#2
0
 public void OnButtonClicked(IFileDialogCustomize pfdc, int dwIDCtl)
 {
     // Find control
     DialogControl control = this.parent.controls.GetControlbyId(dwIDCtl);
     CommonFileDialogButton button = control as CommonFileDialogButton;
     // Call corresponding event
     if (button != null)
     {
         button.RaiseClickEvent();
     }
 }
示例#3
0
        private void ButtonItem_ExportToFile_Click(object sender, EventArgs e)
        {
            var isMultiselect = IsMultiselect();
            CommonFileDialog sfd_SM64RM_ExportCustomObjectToFile;
            var tbxName      = new CommonFileDialogTextBox("rmobj.name", customObject.Name);
            var btnAddScript = new CommonFileDialogButton("rmobj.script", "Setup Script")
            {
                IsProminent = true
            };

            btnAddScript.Click  += BtnAddScript_Click;
            export_EmbeddedFiles = new EmbeddedFilesContainer();
            export_Script        = new PatchScript();

            if (isMultiselect && MessageBoxEx.Show(this, "You are going to export multiple custom objects. Do you want to save all objects to one single file (Yes) or do you want to save every single object to one file (No)?", "Export Custom Objects", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                sfd_SM64RM_ExportCustomObjectToFile = new CommonOpenFileDialog()
                {
                    IsFolderPicker = true
                }
            }
            ;
            else
            {
                isMultiselect = false;
                sfd_SM64RM_ExportCustomObjectToFile = new CommonSaveFileDialog()
                {
                    DefaultExtension = FILTER_CUSTOM_OBJECT_EXTENSIONS
                };
                sfd_SM64RM_ExportCustomObjectToFile.Filters.Add(new CommonFileDialogFilter(FILTER_CUSTOM_OBJECT_NAMES, FILTER_CUSTOM_OBJECT_EXTENSIONS));
            }

            sfd_SM64RM_ExportCustomObjectToFile.Controls.Add(tbxName);
            sfd_SM64RM_ExportCustomObjectToFile.Controls.Add(btnAddScript);

            if (sfd_SM64RM_ExportCustomObjectToFile.ShowDialog(Handle) == CommonFileDialogResult.Ok)
            {
                ExportObjects(sfd_SM64RM_ExportCustomObjectToFile.FileName, isMultiselect, tbxName.Text);
            }
        }