/// <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> /// Realizá la carga de información de la base de datos /// </summary> public void LoadDBData() { if (this.lvProjects.ItemsSource == null) { this.lvProjects.ItemsSource = OracleTransactions.GetProjects().Where(x => !x.ProjectName.ToLower().Contains(".rvt")).OrderBy(x => x.ProjectName); if (this.Credentials.ProjectId != -1) { try { this.tboProject.Text = OracleTransactions.GetProjectName(this.Credentials); } catch (Exception exc) { this.tboProject.Text = String.Empty; App.Riviera.Log.AppendEntry(exc, null, false); } } } }
/// <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(); }); }