private void Main_Load(object sender, EventArgs e) { //Create temp directory if (!Directory.Exists(TEMP_FOLDER)) { Directory.CreateDirectory(TEMP_FOLDER); } //Check for Update CheckForUpdate(); //Set open dialog filters openFileDialog.Filter = string.Join("|", SupportedFileTypes.Select(x => $"{x.Key} ({x.Value})|{x.Value}")); //Allow keyboard shortcuts Parallel.ForEach(this.Controls.Cast <Control>(), c => c.KeyDown += new KeyEventHandler(KeyDownEvent)); //Init Find and Replace FormHandler.Init(advancedDataGridView); //Load definitions Task.Run(() => Database.LoadDefinitions()) .ContinueWith(x => AutoRun(), TaskScheduler.FromCurrentSynchronizationContext()); //Start FileWatcher Watcher(); //Setup Single Instance Delegate InstanceManager.AutoRunAdded += delegate { this.Invoke((MethodInvoker) delegate { InstanceManager.FlashWindow(this); AutoRun(); }); }; }