public MainForm(string[] args) { bool canSetCurrentDir = true; this.StartPosition = FormStartPosition.WindowsDefaultLocation; bool splash = false; List <string> fileNames = new List <string>(); // Parse command line arguments foreach (string argument in args) { if (0 == string.Compare(argument, "/dontForceGC")) { Utility.AllowGCFullCollect = false; } else if (0 == string.Compare(argument, "/splash", true)) { splash = true; } else if (0 == string.Compare(argument, "/test", true)) { // This lets us use an alternate update manifest on the web server so that // we can test manifests on a small scale before "deploying" them to everybody PdnInfo.IsTestMode = true; } else if (0 == string.Compare(argument, "/profileStartupTimed", true)) { // profileStartupTimed and profileStartupWorkingSet compete, which // ever is last in the args list wins. PdnInfo.StartupTest = StartupTestType.Timed; } else if (0 == string.Compare(argument, "/profileStartupWorkingSet", true)) { // profileStartupTimed and profileStartupWorkingSet compete, which // ever is last in the args list wins. PdnInfo.StartupTest = StartupTestType.WorkingSet; } else if (argument.Length > 0 && argument[0] != '/') { try { string fullPath = Path.GetFullPath(argument); fileNames.Add(fullPath); } catch (Exception) { fileNames.Add(argument); canSetCurrentDir = false; } splash = true; } } if (canSetCurrentDir) { try { Environment.CurrentDirectory = PdnInfo.GetApplicationDir(); } catch (Exception ex) { Tracing.Ping("Exception while trying to set Environment.CurrentDirectory: " + ex.ToString()); } } // make splash, if warranted if (splash) { this.splashForm = new SplashForm(); this.splashForm.TopMost = true; this.splashForm.Show(); this.splashForm.Update(); } InitializeComponent(); this.Icon = PdnInfo.AppIcon; // Does not load window location/state LoadSettings(); foreach (string fileName in fileNames) { this.queuedInstanceMessages.Add(fileName); } // no file specified? create a blank image if (fileNames.Count == 0) { Size newSize = this.appWorkspace.GetNewDocumentSize(); this.appWorkspace.CreateBlankDocumentInNewWorkspace(newSize, true); this.appWorkspace.ActiveDocumentWorkspace.IncrementJustPaintWhite(); this.appWorkspace.ActiveDocumentWorkspace.Document.Dirty = false; this.appWorkspace.ActiveDocumentWorkspace.ZoomIn(8); } LoadWindowState(); deferredInitializationTimer.Enabled = true; Application.Idle += new EventHandler(Application_Idle); }