Exemplo n.º 1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            string[] argv = Environment.GetCommandLineArgs();
            int argc = argv.GetLength(0);

            Form mainWindow;

            if (argc == 1) {
                mainWindow = new MainForm();
            }
            else if (argc == 2)
            {
                FillForm fillForm = new FillForm();
                fillForm.openFile(argv[1]);
                fillForm.WindowState = FormWindowState.Maximized;
                mainWindow = fillForm;
            }
            else if (argc == 3)
            {
                if (argv[1] != "/E" && argv[1] != "/e")
                {
                    InvalidCommandLineArgument();
                    return;
                }

                EditorForm editorForm = new EditorForm();
                editorForm.openFile(argv[2]);
                editorForm.WindowState = FormWindowState.Maximized;
                mainWindow = editorForm;
            }
            else
            {
                InvalidCommandLineArgument();
                return;
            }

            Application.Run(mainWindow);
        }
Exemplo n.º 2
0
        private void buttonFill_Click(object sender, EventArgs e)
        {
            if (listBox1.SelectedIndex == -1)
                return;

            if (listBox1.SelectedItem.ToString() == ListItemNew)
                return;

            FillForm form = new FillForm();
            form.Closed += delegate {
                fillRecentFilesListboxFromRegistry();
                Show();
            };
            if (listBox1.SelectedItem.ToString() == ListItemOpen)
            {
                if (form.ShowOpenDialog())
                {
                    Hide();
                    form.WindowState = FormWindowState.Maximized;
                    form.Show();
                }
            }
            else
            {
                form.openFile(listBox1.SelectedItem.ToString());
                Hide();
                form.WindowState = FormWindowState.Maximized;
                form.Show();
            }
        }