public ConfigurationDialog(TagDatabase db) : base() { DB = db; InitializeComponent(); cbTextEditor.Items.Clear(); cbTextEditor.Items.AddRange(Program.GetDirectorNames()); Program.Scheduler.WaitFor( Program.Scheduler.Start( ReadPreferences(), TaskExecutionPolicy.RunAsBackgroundTask )); }
static void Main(string[] argv) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (argv.Length < 1) { using (var dlg = new SaveFileDialog()) { dlg.Title = "Select Index Database"; dlg.Filter = "Index Databases (*.db)|*.db"; dlg.CheckFileExists = false; dlg.CheckPathExists = true; dlg.AddExtension = true; dlg.AutoUpgradeEnabled = true; dlg.OverwritePrompt = false; if (dlg.ShowDialog() != DialogResult.OK) { MessageBox.Show( "NDexer cannot start without a path specified for the index database on the command line.\n" + @"For example: ndexer.exe C:\mysource\index.db", "NDexer Error" ); return; } else { DatabasePath = dlg.FileName; } } } else { DatabasePath = System.IO.Path.GetFullPath(argv[0]); } if (System.IO.File.Exists(DatabasePath)) { if (System.IO.File.Exists(DatabasePath + "_new")) { System.IO.File.Move(DatabasePath, DatabasePath + "_old"); System.IO.File.Move(DatabasePath + "_new", DatabasePath); System.IO.File.Delete(DatabasePath + "_old"); } } else { } Scheduler = new TaskScheduler(JobQueue.WindowsMessageBased); Database = new TagDatabase(Scheduler, DatabasePath); InitUI(); Scheduler.Start( MainTask(argv), TaskExecutionPolicy.RunAsBackgroundTask ); Application.Run(); }