Ejemplo n.º 1
0
        public static List <string> Prompt(string question, string title, string defaultValue = "", InputType inputType = InputType.Text)
        {
            FolderMsgPrompt inst          = new FolderMsgPrompt(question, title, defaultValue, inputType);
            List <string>   folderDetails = new List <string>();

            inst.ShowDialog();

            if (inst.DialogResult == true)
            {
                // if the user choose to create a new folder
                if (inst.txtFolderName.Text != defaultValue && inst.cbChooseFolder.SelectedValue == null)
                {
                    folderDetails.Add(inst.txtFolderName.Text);
                    if (inst.txtFolderDesc.Text != defaultValue)
                    {
                        folderDetails.Add(inst.txtFolderDesc.Text);
                    }
                    return(folderDetails);
                }
                // if the user choose to use an existing folder
                else if (inst.cbChooseFolder.SelectedValue != null)
                {
                    folderDetails.Add((string)inst.cbChooseFolder.SelectedValue);
                    return(folderDetails);
                }
                // if the user didn't choose any
                else
                {
                    MessageBox.Show("Please enter a name for the template file.");
                    Prompt(question, title, defaultValue, inputType);
                    //folderDetails.Add(defaultValue);
                    //return folderDetails;
                }
            }
            //System.Console.WriteLine();
            return(null);
        }
Ejemplo n.º 2
0
        public static List<string> Prompt(string question, string title, string defaultValue = "", InputType inputType = InputType.Text)
        {
            FolderMsgPrompt inst = new FolderMsgPrompt(question, title, defaultValue, inputType);
            List<string> folderDetails = new List<string>();
            inst.ShowDialog();

            if (inst.DialogResult == true)
            {
                // if the user choose to create a new folder
                if (inst.txtFolderName.Text != defaultValue && inst.cbChooseFolder.SelectedValue == null)
                {
                    folderDetails.Add(inst.txtFolderName.Text);
                    if (inst.txtFolderDesc.Text != defaultValue)
                    {
                        folderDetails.Add(inst.txtFolderDesc.Text);
                    }
                    return folderDetails;
                }
                // if the user choose to use an existing folder
                else if (inst.cbChooseFolder.SelectedValue != null)
                {
                    folderDetails.Add((string)inst.cbChooseFolder.SelectedValue);
                    return folderDetails;
                }
                // if the user didn't choose any
                else
                {
                    MessageBox.Show("Please enter a name for the template file.");
                    Prompt(question, title, defaultValue, inputType);
                    //folderDetails.Add(defaultValue);
                    //return folderDetails;
                }
            }
            //System.Console.WriteLine();
            return null;
        }
Ejemplo n.º 3
0
 private List <string> getFolderName()
 {
     return(FolderMsgPrompt.Prompt("Create new folder", "Folder options", inputType: FolderMsgPrompt.InputType.Text));
 }