Пример #1
0
        private void assemblyPathTextBox_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            string path = assemblyPathTextBox.Text;

            try
            {
                FileInfo info = new FileInfo(path);

                if (!info.Exists)
                {
                    DialogResult answer = UserMessage.Ask(string.Format(
                                                              "The path {0} does not exist. Do you want to use it anyway?", path));
                    if (answer != DialogResult.Yes)
                    {
                        e.Cancel = true;
                    }
                }
            }
            catch (System.Exception exception)
            {
                assemblyPathTextBox.SelectAll();
                UserMessage.DisplayFailure(exception, "Invalid Entry");
                e.Cancel = true;
            }
        }
Пример #2
0
        private void applicationBaseTextBox_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (applicationBaseTextBox.Text != String.Empty)
            {
                string applicationBase = null;

                try
                {
                    applicationBase = Path.Combine(project.BasePath, applicationBaseTextBox.Text);
                    Directory.Exists(applicationBase);
                }
                catch (Exception exception)
                {
                    applicationBaseTextBox.SelectAll();
                    UserMessage.DisplayFailure(exception, "Invalid Entry");
                    e.Cancel = true;
                }

                /*			if ( !PathUtils.SamePathOrUnder( project.BasePath, applicationBase ) )
                 *                      {
                 *                              applicationBaseTextBox.SelectAll();
                 *                              UserMessage.DisplayFailure( "Path must be equal to or under the project base", "Invalid Entry" );
                 *                              e.Cancel = true;
                 *                      }
                 *                      else */
                if (!Directory.Exists(applicationBase))
                {
                    string msg = string.Format(
                        "The directory {0} does not exist. Do you want to create it?",
                        applicationBase);
                    switch (UserMessage.Ask(msg, "Project Editor"))
                    {
                    case DialogResult.Yes:
                        Directory.CreateDirectory(applicationBase);
                        break;

                    case DialogResult.Cancel:
                        e.Cancel = true;
                        break;

                    case DialogResult.No:
                    default:
                        break;
                    }
                }
            }
        }
Пример #3
0
        private void projectBaseTextBox_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (projectBaseTextBox.Text != string.Empty)
            {
                string projectBase = null;
                try
                {
                    projectBase = projectBaseTextBox.Text;
                    Directory.Exists(projectBase);
                }
                catch (Exception ex)
                {
                    projectBaseTextBox.SelectAll();
                    UserMessage.DisplayFailure(ex, "Invalid Entry");
                    e.Cancel = true;
                }

                if (!Directory.Exists(projectBase))
                {
                    string msg = string.Format(
                        "The directory {0} does not exist. Do you want to create it?",
                        projectBase);
                    switch (UserMessage.Ask(msg, "Project Editor"))
                    {
                    case DialogResult.Yes:
                        Directory.CreateDirectory(projectBase);
                        break;

                    case DialogResult.Cancel:
                        e.Cancel = true;
                        break;

                    case DialogResult.No:
                    default:
                        break;
                    }
                }
            }
        }
Пример #4
0
        private void applicationBaseTextBox_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (applicationBaseTextBox.Text != String.Empty)
            {
                string applicationBase = null;

                try
                {
                    applicationBase = Path.Combine(project.BasePath, applicationBaseTextBox.Text);
                    DirectoryInfo info = new DirectoryInfo(applicationBase);
                }
                catch (Exception exception)
                {
                    applicationBaseTextBox.SelectAll();
                    UserMessage.DisplayFailure(exception, "Invalid Entry");
                    e.Cancel = true;
                }

                if (!ProjectPath.SamePathOrUnder(project.BasePath, applicationBase))
                {
                    applicationBaseTextBox.SelectAll();
                    UserMessage.DisplayFailure("Path must be equal to or under the project base", "Invalid Entry");
                    e.Cancel = true;
                }
                else if (!Directory.Exists(applicationBase))
                {
                    if (UserMessage.Ask("The directory {0} does not exist. Do you want to create it?", "Project Editor") == DialogResult.Yes)
                    {
                        Directory.CreateDirectory(applicationBase);
                    }
                    else
                    {
                        e.Cancel = true;
                    }
                }
            }
        }
Пример #5
0
        private void removeAssemblyButton_Click(object sender, System.EventArgs e)
        {
            if (UserMessage.Ask(string.Format(
                                    "Remove {0} from project?", selectedAssembly)) == DialogResult.Yes)
            {
                int index = assemblyListBox.SelectedIndex;
                selectedConfig.Assemblies.RemoveAt(index);
                assemblyListBox.Items.RemoveAt(index);
                if (index >= assemblyListBox.Items.Count)
                {
                    --index;
                }

                if (index >= 0)
                {
                    selectedAssembly = (string)assemblyListBox.Items[index];
                    assemblyListBox.SelectedIndex = index;
                }
                else
                {
                    selectedAssembly = null;
                }
            }
        }