示例#1
0
        private void ConfigControls()
        {
            // Configure the Form.
            Text          = "My Mono Win Forms App!";
            ClientSize    = new System.Drawing.Size(366, 90);
            StartPosition = FormStartPosition.CenterScreen;
            AcceptButton  = btnDumpToFile;

            // Configure the Button.
            btnDumpToFile.Text     = "Dump";
            btnDumpToFile.Location = new System.Drawing.Point(13, 40);

            // Handle click event anonymously.
            btnDumpToFile.Click += delegate
            {
                if (TypeDumper.DumpTypeToFile(txtTypeName.Text))
                {
                    MessageBox.Show(string.Format(
                                        "Data saved into {0}.txt",
                                        txtTypeName.Text));
                }
                else
                {
                    MessageBox.Show("Error!  Can't find that type...");
                }
            };
            Controls.Add(btnDumpToFile);

            // Configure the TextBox.
            txtTypeName.Location = new System.Drawing.Point(13, 13);
            txtTypeName.Size     = new System.Drawing.Size(341, 20);
            Controls.Add(txtTypeName);
        }
        public static void Main()
        {
            Console.WriteLine(
                "***** The Type Dumper App *****\n");

            // Ask user for name of type.
            string typeName = "";

            Console.Write("Please enter type name: ");
            typeName = Console.ReadLine();

            // Now send it to the helper library.
            if (TypeDumper.DumpTypeToFile(typeName))
            {
                Console.WriteLine("Data saved into {0}.txt",
                                  typeName);
            }
            else
            {
                Console.WriteLine("Error!  Can't find that type...");
            }
        }