private void ManageCommandLineArgs(string[] args) { if (args != null && args.Length == 1) { string filename = args[0]; if (System.IO.File.Exists(filename)) { Application.DoEvents(); if (System.IO.Path.GetExtension(filename).ToLower() == ".zbn") //zipped button { PreviewForm.ImportButton(filename); } else { if (Core.CanLoadNewFile) { Core.OpenFile(this, filename, false); } else { MessageBox.Show(Strings.MsgboxCannotOpenFileNow); } } } } }
private void MainForm_Load(object sender, EventArgs e) { UpdateTimer.Enabled = true; if (Settings.GetObject("Auto Update", true)) { GitHub.CheckVersion(false); } SuspendLayout(); //restore last size and position Object[] msp = Settings.GetObject <Object[]>("Mainform Size and Position", null); FormWindowState state = msp == null ? FormWindowState.Maximized : (FormWindowState)msp[2] != FormWindowState.Minimized ? (FormWindowState)msp[2] : FormWindowState.Maximized; if (state == FormWindowState.Normal) { WindowState = state; Size = (Size)msp[0]; Location = (Point)msp[1]; } ResumeLayout(); ManageMessage(); if (args != null && args.Length == 1) { string filename = args[0]; if (System.IO.File.Exists(filename)) { Application.DoEvents(); if (System.IO.Path.GetExtension(filename).ToLower() == ".zbn") //zipped button { PreviewForm.ImportButton(filename); } else { Core.OpenFile(this, filename, false); } } } }