コード例 #1
0
        private bool getValidFileName(string fileName, out string fixedFileName)
        {
            //TODO: launch the error prompt.
            StringBuilder errorMessage = new StringBuilder();

            errorMessage.AppendLine("Windows files cannot have the following characters in them: \\ / * ? | < > \" :");
            errorMessage.AppendLine("The file you are trying to download, " + fileName + " cannot be used because it contains one or more of these characters.");
            errorMessage.AppendLine("Please pick a new name for this file, Note: the name of this file will NOT be changed on the cloud");

            string newFileNameHeader = "New name for the file:";

            string[] headers = new string[2];
            headers[0] = errorMessage.ToString();
            headers[1] = newFileNameHeader;

            dynamicPrompt errorPrompt = new dynamicPrompt(headers);

            //blocks: TODO change to return a ResultDialog type
            errorPrompt.ShowDialog();
            if (errorPrompt.getOK())
            {
                //user accepted
                string[] responses = errorPrompt.getRet();
                fixedFileName = responses[0];
                return(true);
            }
            else
            {
                fixedFileName = null;
                return(false);
            }
        }
コード例 #2
0
        public void dynamicPromptOpenAndClose()
        {
            string[] arrayOfStrings = new string[3] {
                "this", "that", "junk"
            };
            dynamicPrompt winUT = new dynamicPrompt(arrayOfStrings);

            try
            {
                winUT.Show();
                winUT.Close();
            }
            catch (InvalidOperationException e)
            {
                Assert.Fail();
            }
        }