Пример #1
0
        static void Main(string[] args)
        {
            System.Windows.Forms.Application.EnableVisualStyles();

            if (LoadConfiguration())
            {
                try
                {
                    Configuration.Environment = ExecutionEnvironment.WindowsApplication;
                    string path           = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                    string executablePath = System.IO.Path.Combine(path, "EpiInfo.exe");
                    Epi.Windows.MakeView.Forms.MakeViewMainForm makeViewMainForm = new Epi.Windows.MakeView.Forms.MakeViewMainForm();
                    ICommandLine commandLine = new CommandLine(args);

                    string titleArgument = commandLine.GetArgument("title");
                    string projectPath   = commandLine.GetArgument("project");
                    string viewName      = commandLine.GetArgument("view");

                    if (titleArgument != null)
                    {
                        makeViewMainForm.Text = titleArgument;
                    }

                    if (!string.IsNullOrEmpty(projectPath))
                    {
                        makeViewMainForm.LoadViewFromCommandLine(projectPath, viewName);
                    }
                    else
                    {
                        if (!makeViewMainForm.IsDisposed)
                        {
                            makeViewMainForm.Show();
                            if (makeViewMainForm.WindowState == FormWindowState.Minimized)
                            {
                                makeViewMainForm.WindowState = FormWindowState.Normal;
                            }
                            makeViewMainForm.Activate();
                        }

                        if (args.Length > 0 && args[0] is string && System.IO.File.Exists(args[0]))
                        {
                            makeViewMainForm.GetTemplate(args[0]);
                        }
                    }

                    System.Windows.Forms.Application.Run(makeViewMainForm);
                    makeViewMainForm = null;
                }
                catch (Exception ex)
                {
                    MsgBox.ShowException(ex);
                }
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            System.Windows.Forms.Application.EnableVisualStyles();

            if (LoadConfiguration())
            {
                try
                {
                    Configuration.Environment = ExecutionEnvironment.WindowsApplication;
                    string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                    string executablePath = System.IO.Path.Combine(path, "EpiInfo.exe");
                    Epi.Windows.MakeView.Forms.MakeViewMainForm makeViewMainForm = new Epi.Windows.MakeView.Forms.MakeViewMainForm();
                    ICommandLine commandLine = new CommandLine(args);

                    string titleArgument = commandLine.GetArgument("title");
                    string projectPath = commandLine.GetArgument("project");
                    string viewName = commandLine.GetArgument("view");

                    if (titleArgument != null)
                    {
                        makeViewMainForm.Text = titleArgument;
                    }

                    if (! string.IsNullOrEmpty(projectPath))
                    {
                        makeViewMainForm.LoadViewFromCommandLine(projectPath, viewName);
                    }
                    else
                    {
                        if (!makeViewMainForm.IsDisposed)
                        {
                            makeViewMainForm.Show();
                            if (makeViewMainForm.WindowState == FormWindowState.Minimized)
                            {
                                makeViewMainForm.WindowState = FormWindowState.Normal;
                            }
                            makeViewMainForm.Activate();
                        }

                        if (args.Length > 0 && args[0] is string && System.IO.File.Exists(args[0]))
                        {
                            makeViewMainForm.GetTemplate(args[0]);
                        }
                    }

                    System.Windows.Forms.Application.Run(makeViewMainForm);
                    makeViewMainForm = null;
                }
                catch(Exception ex)
                {
                    MsgBox.ShowException(ex);
                }
            }
        }