public void delegaty(ToOptions e)
 {
     this.AppContext.Invoke(() => {
         okButton.Sensitive = false;
     });
     SeedTableInterface.InformationMessageEventHandler handler =
         (string message) => {
         Console.WriteLine(message);
         this.AppContext.Invoke(() => {
             textBox.Insert(message + "\n", textBox.CursorPosition);
         });
     };
     SeedTableInterface.InformationMessageEvent += handler;
     try {
         SeedTableInterface.SeedToExcel(e);
         Status = true;
     } catch (SeedTableInterface.CannotContinueException) {
         Status = false;
     }
     finally {
         this.AppContext.Invoke(() => {
             okButton.Sensitive = true;
         });
         SeedTableInterface.InformationMessageEvent -= handler;
     }
 }
        private void seedToExcelBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            var worker = sender as BackgroundWorker;

            SeedTableInterface.InformationMessageEventHandler handler =
                (string message) => worker.ReportProgress(0, message);
            SeedTableInterface.InformationMessageEvent += handler;
            try {
                SeedTableInterface.SeedToExcel((ToOptions)e.Argument);
                e.Result = true;
            } catch (SeedTableInterface.CannotContinueException) {
                e.Result = false;
            }
            SeedTableInterface.InformationMessageEvent -= handler;
        }
 protected void Prepare(ToOptions options)
 {
     SeedTableInterface.SeedToExcel(options);
 }
 protected void Prepare(FromOptions options)
 {
     SeedTableInterface.ExcelToSeed(options);
 }