/// <summary>
 /// Initializes the database
 /// </summary>
 /// <param name="win">The windwow that calls this task.</param>
 public void Init()
 {
     Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
     ed.WriteMessage(MSG_LOADING_DB);
     OracleTransactions.InitDatabase(
        (BackgroundWorker worker, Object result) =>
        {
            this.InitCompleted(result);
            ed.WriteMessage("\n{0}", MSG_MEMORY_LOADED);
        });
 }
 /// <summary>
 /// Initializes the database
 /// </summary>
 /// <param name="win">The windwow that calls this task.</param>
 public async void Init(MetroWindow win)
 {
     ActiveWindow = win;
     await ShowProgressDialog(CAP_LOADING, MSG_LOADING_DB);
     OracleTransactions.InitDatabase(
        async (BackgroundWorker worker, Object result) =>
     {
         string msg;
         if (result is Exception)
             msg = (result as Exception).Message;
         else
         {
             this.InitCompleted(result);
             msg = MSG_MEMORY_LOADED;
         }
         await CloseProgressDialog();
         await win.ShowMessageAsync(String.Empty, msg, MessageDialogStyle.Affirmative);
         win.Close();
         if (!(result is Exception) && DatabaseLoaded != null)
             this.DatabaseLoaded();
     });
 }