public Main() { InitializeComponent(); PortableSettingsProvider.SettingsFileName = Common.USER_SETTINGS; PortableSettingsProviderBase.SettingsDirectory = Process.path_prefix; PortableSettingsProvider.ApplyProvider(Common.Settings.Default, Common.History.Default); Common.Settings.Default.Upgrade(); Common.History.Default.Upgrade(); debugLogToolStripMenuItem.Checked = Common.Settings.Default.DebugLog; aboutToolStripMenuItem.Text = String.Format("&About {0}", Application.ProductName); int index = 0; foreach (string property in Title.Properties) { ToolStripMenuItem menuItem = new ToolStripMenuItem { Name = String.Format("property{0}ToolStripMenuItem", index++), Text = property, }; menuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click); copyToolStripMenuItem.DropDownItems.Add(menuItem); } bool init = Process.initialize(out List <string> messages); foreach (var message in messages) { MessageBox.Show(message, Application.ProductName); } if (!init) { Environment.Exit(-1); } Process.migrateSettings(); }
public override void WindowDidLoad() { base.WindowDidLoad(); tableViewDataSource = new TableViewDataSource(); tableViewDelegate = new TableViewDelegate(tableViewDataSource); tableView.DataSource = tableViewDataSource; tableView.Delegate = tableViewDelegate; PortableSettingsProvider.SettingsFileName = Common.USER_SETTINGS; PortableSettingsProviderBase.SettingsDirectory = Process.path_prefix; PortableSettingsProvider.ApplyProvider(Common.Settings.Default, Common.History.Default); Common.Settings.Default.Upgrade(); Common.History.Default.Upgrade(); NSMenuItem debugLog = Window.Menu?.ItemWithTitle("File")?.Submenu.ItemWithTitle("Debug Log"); if (debugLog != null) { debugLog.State = Common.Settings.Default.DebugLog ? NSCellStateValue.On : NSCellStateValue.Off; } historyMenu = Window.Menu?.ItemWithTitle("History")?.Submenu; InitContextMenu(contextMenu.ItemWithTitle("Copy")?.Submenu); bool init = Process.initialize(out List <string> messages); foreach (var message in messages) { var alert = new NSAlert() { InformativeText = message, MessageText = NSBundle.MainBundle.ObjectForInfoDictionary("CFBundleExecutable").ToString(), }; alert.RunModal(); } if (!init) { Environment.Exit(-1); } Process.migrateSettings(); backgroundWorker = new BackgroundWorker { WorkerReportsProgress = true, WorkerSupportsCancellation = true }; backgroundWorker.DoWork += BackgroundWorker_DoWork; backgroundWorker.ProgressChanged += BackgroundWorker_ProgressChanged; backgroundWorker.RunWorkerCompleted += BackgroundWorker_RunWorkerCompleted; int index = 0; foreach (ArrayOfTitle history in Common.History.Default.Titles) { NSMenuItem menuItem = new NSMenuItem(String.Format("{0} ({1} files)", history.description, history.title.Count), new System.EventHandler(History)); historyMenu.AddItem(menuItem); index++; } if (index > 0) { historyMenu.Items[index - 1].State = NSCellStateValue.On; } titles = Process.processHistory(); tableViewDataSource.Titles.AddRange(titles); tableView.ReloadData(); }