示例#1
0
        public MainForm(string[] args)
        {
            InitializeComponent();
            ReadRegistry();

            Splashscreen splashscreen = new Splashscreen();

            splashscreen.ShowDialog();

            //Thread updatesThread = new Thread(LookForUpdates);
            //updatesThread.Start();
            new Lt10Updater(true, UpdateFound);

            //check projects recovery file
            TextReader reader;

            try {
                reader = new StreamReader(recoveryProjectsFile);
                try {
                    string projectPath;
                    bool   reopenedInfoShown = false;
                    while ((projectPath = reader.ReadLine()) != null)
                    {
                        if (!reopenedInfoShown)
                        {
                            MessageBox.Show("Application hasn't closed properly last time. Some projects will be reopened now.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            reopenedInfoShown = true;
                        }
                        try {
                            OpenProject(projectPath);
                        } catch (Exception) { }
                    }
                } finally {
                    reader.Close();
                    //overwrite file
                    try {
                        FileStream fs = File.Create(recoveryProjectsFile);
                        fs.Close();
                    } catch (Exception) { }
                }
            } catch (Exception) { }

            //open program from argument list
            if (args.Length > 0)
            {
                int    i       = 0;
                string project = "";
                //List<string> hosts = new List<string>();
                while (i < args.Length)
                {
                    switch (args[i])
                    {
                    case "-p":
                        project = args[++i];
                        break;
                        //case "-h":
                        //    hosts.Add(args[++i]);
                        //    break;
                    }
                    i++;
                }
                if (project != "")
                {
                    try {
                        bool alreadyOpened = false;
                        foreach (Form f in MdiChildren)
                        {
                            if (f is ProjectForm)
                            {
                                if (((ProjectForm)f).project.ProjectFile == project)
                                {
                                    alreadyOpened = true;
                                    break;
                                }
                            }
                        }
                        if (!alreadyOpened)
                        {
                            OpenProject(project);
                        }
                    } catch (Exception) { }
                }
            }


            SpectraContainerBase.OpenProgressChanged += SpectraContainerBase_OpenSaveProgressChanged;
            SpectraContainerBase.SaveProgressChanged += SpectraContainerBase_OpenSaveProgressChanged;
            helpProvider1.HelpNamespace = helpfile;
            waitForm      = new WaitForm();
            this._exiting = false;
        }
示例#2
0
        public MainForm(string[] args)
        {
            InitializeComponent();
            ReadRegistry();

            Splashscreen splashscreen = new Splashscreen();

            splashscreen.ShowDialog();

            if (args.Length > 0)
            {
                int    i       = 0;
                string project = "";
                //List<string> hosts = new List<string>();
                while (i < args.Length)
                {
                    switch (args[i])
                    {
                    case "-p":
                        project = args[++i];
                        break;
                        //case "-h":
                        //    hosts.Add(args[++i]);
                        //    break;
                    }
                    i++;
                }
                //new SearchTests(project, hosts);
                if (project != "")
                {
                    try {
                        OpenProject(project);
                    } catch (Exception) { }
                }
            }
            //check projects recovery file
            TextReader reader;

            try {
                reader = new StreamReader(recoveryProjectsFile);
                try {
                    string projectPath;
                    while ((projectPath = reader.ReadLine()) != null)
                    {
                        try {
                            OpenProject(projectPath);
                        } catch (Exception) { }
                    }
                } finally {
                    reader.Close();
                    //overwrite file
                    try {
                        FileStream fs = File.Create(recoveryProjectsFile);
                        fs.Close();
                    } catch (Exception) { }
                }
            } catch (Exception) { }

            SpectraContainerBase.OpenProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(SpectraContainerBase_OpenSaveProgressChanged);
            SpectraContainerBase.SaveProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(SpectraContainerBase_OpenSaveProgressChanged);
            helpProvider1.HelpNamespace = helpfile;
            waitForm      = new WaitForm();
            this._exiting = false;
        }