public MainForm(MenuItem menuItem, Options options) { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); onTopToolStripMenuItem.Checked = options.onTop; this.TopMost = onTopToolStripMenuItem.Checked; centerOnScreenToolStripMenuItem.Checked = options.centerScreen; if (centerOnScreenToolStripMenuItem.Checked) { this.StartPosition = FormStartPosition.CenterScreen; } else if (options.mousePosition) { this.StartPosition = FormStartPosition.Manual; this.Top = Cursor.Position.Y - 10; this.Left = Cursor.Position.X - 10; } else { this.StartPosition = FormStartPosition.Manual; this.Top = options.top; this.Left = options.left; } setNewPath(menuItem); this.Text = menuItem.caption; setMouseCursor (); closeAfterExecuteToolStripMenuItem.Checked = options.closeExec; closeOnLostFocusToolStripMenuItem.Checked = options.closeOnLost; }
private static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var options = new Options(); if (CommandLine.Parser.Default.ParseArguments(args, options)) { // TODO - check if dir exists MenuItem menuItem; if (!String.IsNullOrWhiteSpace(options.simplepipe)) { menuItem = new MenuItem(options.windowTitle, ItemTarget.menu, ItemType.simplepipeMenuProvider, options.simplepipe, "", "", null); } else if (!String.IsNullOrWhiteSpace(options.pipe)) { menuItem = new MenuItem(options.windowTitle, ItemTarget.menu, ItemType.pipeMenuProvider, options.pipe, "", "", null); } else if (!String.IsNullOrWhiteSpace(options.notes)) { menuItem = new MenuItem((String.IsNullOrWhiteSpace(options.windowTitle) ? "Notes" : options.windowTitle), ItemTarget.menu, ItemType.noteMenuProvider, options.notes, "", "", null); } else if (!String.IsNullOrWhiteSpace(options.dirmenu)) { var caption = new DirectoryInfo(options.dirmenu).Name; menuItem = new MenuItem (caption, ItemTarget.menu, ItemType.filesystemMenuProvider, options.dirmenu, "", "", null); } else if (!String.IsNullOrWhiteSpace(options.dirRecurse)) { var caption = new DirectoryInfo(options.dirmenu).Name; menuItem = new MenuItem(caption, ItemTarget.menu, ItemType.fsRecurciveMenuProvider, options.dirRecurse, "", "", null); } else { throw new NotSupportedException("Cannot identify any startup menu"); } MainForm.instance = new MainForm (menuItem, options); Application.Run (MainForm.instance); } }