예제 #1
0
        private void btnGenerateClasses_Click(object sender, EventArgs e)
        {
            if (this.lstObjects.CheckedItems.Count == 0)
            {
                MessageBox.Show(Resources.NO_OBJECTS_SELECTED, ApplicationAttributes.AssemblyTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                    Collection<string> selected = new Collection<string>();

                    // Gather each of the selected items (if any) into a collection object.
                    foreach (int item in this.lstObjects.CheckedIndices)
                    {
                        selected.Add(this.lstObjects.Items[item].ToString());

                    }

                    // Pass the collection to Process and display.
                    Process process = new Process(selected);
                    process.ShowDialog();

            }
        }
예제 #2
0
        /// <summary>
        /// Process a table.
        /// </summary>
        /// <param name="sender">object</param>
        /// <param name="e">EventArgs</param>
        private void btnProcess_Click(object sender, EventArgs e)
        {
            // Make sure that there is something to do.
            if (this.lstObjects.CheckedItems.Count == 0)
            {
                MessageBox.Show(Resources.NO_OBJECTS_SELECTED, ApplicationAttributes.AssemblyTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                // Make sure that the template exists or we're wasting time!
                string templatePath =
                    string.Format(
                        CultureInfo.InvariantCulture,
                        @"{0}\Template.txt",
                        Application.StartupPath);

                if (!File.Exists(templatePath))
                {
                    // Construct the message.
                    string failure =
                        string.Format(
                            CultureInfo.InvariantCulture,
                            Resources.NO_TEMPLATE,
                            templatePath,
                            Environment.NewLine);

                    // and display...
                    MessageBox.Show(failure, ApplicationAttributes.AssemblyTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    Collection<string> selected = new Collection<string>();

                    // Gather each of the selected items (if any) into a collection object.
                    foreach (int item in this.lstObjects.CheckedIndices)
                    {
                        selected.Add(this.lstObjects.Items[item].ToString());
                    }

                    // Pass the collection to Process and display.
                    Process process = new Process(selected);
                    process.ShowDialog();
                }
            }
        }