Пример #1
0
        //------------------------------------------------------
        // Adds a folder browser control
        private void AddFolderBrowserButton(object sender, System.EventArgs e)
        {
            if (ProjectCheck())
            {
                return;
            }

            EditFileBrowserButton form2 = new EditFileBrowserButton();

            form2.StartPosition = FormStartPosition.CenterScreen;

            if (form2.ShowDialog() == DialogResult.OK)
            {
                CreateFileBrowser(form2.ButtonName.Text,
                                  form2.FieldName.Text,
                                  "C:\\",
                                  "*.*");
                WriteSettingsToIni();
                ScrollButtons(0);
            }
        }
Пример #2
0
        //------------------------------------------------------------------
        // Edit the Control
        private void EditControl(object sender, System.EventArgs e)
        {
            MenuItem    item = (MenuItem)sender;
            ContextMenu menu = item.GetContextMenu();
            Button      b    = (Button)menu.SourceControl;

            int index             = LocateIndex(b);
            ControlDefinition def = (ControlDefinition)mControlsList[index];

            switch ((ETYPE)def.mEType)
            {
            case ETYPE.STD_BUTTON:
            case ETYPE.STD_BUTTON_EDIT:
                CustomButtonEdit bEdit = new CustomButtonEdit();

                bEdit.NameBox.Text    = b.Text;
                bEdit.CommandBox.Text = def.mCommand;
                bEdit.StartPosition   = FormStartPosition.CenterScreen;
                if ((ETYPE)def.mEType == ETYPE.STD_BUTTON)
                {
                    bEdit.FieldName.ReadOnly = true;
                    bEdit.Arguments.Text     = def.mArguments;
                }
                else
                {
                    bEdit.FieldName.Text = def.mTextBox.Name;
                    bEdit.Arguments.Text = def.mTextBox.Text;
                }

                DialogResult r = bEdit.ShowDialog();
                if (r == DialogResult.OK)
                {
                    def.mButton.Text  = bEdit.NameBox.Text;
                    def.mButton.Text  = bEdit.NameBox.Text;
                    def.mCommand      = bEdit.CommandBox.Text;
                    def.mHiddenOutput = bEdit.hideoutput.Checked? 1:0;

                    if ((ETYPE)def.mEType == ETYPE.STD_BUTTON)
                    {
                        def.mArguments = bEdit.Arguments.Text;
                    }

                    if ((ETYPE)def.mEType == ETYPE.STD_BUTTON_EDIT)
                    {
                        def.mTextBox.Name = bEdit.FieldName.Text;
                        def.mTextBox.Text = bEdit.Arguments.Text;
                    }

                    // write out update to ini
                    WriteSettingsToIni();
                    return;
                }
                break;

            case ETYPE.STD_FILETYPE_LIST:
                EditFileTypeButton form = new EditFileTypeButton();
                form.TBox_ButName.Text    = def.mButton.Text;
                form.TBox_Path.Text       = def.mDirectory;
                form.TBox_Ext.Text        = def.mExtension;
                form.TBox_Command.Text    = def.mCommand;
                form.Check_Hidden.Checked = def.mHiddenOutput == 0 ? false:true;
                form.StartPosition        = FormStartPosition.CenterScreen;
                form.FieldName.Text       = def.mComboBox.Name;

                if (form.ShowDialog() == DialogResult.OK)
                {
                    def.mButton.Text   = form.TBox_ButName.Text;
                    def.mDirectory     = form.TBox_Path.Text;
                    def.mExtension     = form.TBox_Ext.Text;
                    def.mCommand       = form.TBox_Command.Text;
                    def.mHiddenOutput  = form.Check_Hidden.Checked == true ? 1:0;
                    def.mComboBox.Name = form.FieldName.Text;

                    WriteSettingsToIni();
                    RefreshDirList(def);
                    ScrollButtons(0);
                }
                break;

            case ETYPE.STD_FOLDERBROWSER:

                EditFileBrowserButton form2 = new EditFileBrowserButton();
                form2.StartPosition   = FormStartPosition.CenterScreen;
                form2.FieldName.Text  = def.mComboBox.Name;
                form2.ButtonName.Text = def.mButton.Text;
                if (form2.ShowDialog() == DialogResult.OK)
                {
                    def.mComboBox.Name = form2.FieldName.Text;
                    def.mButton.Text   = form2.ButtonName.Text;
                    WriteSettingsToIni();
                    RefreshDirList(def);
                    ScrollButtons(0);
                }
                break;
            }

            System.Console.WriteLine("TEST");
        }