/// <summary> /// Loads every Solution into Grid /// </summary> /// <param name="connectionNane">CRM Connection</param> private void LoadSolutions(string connectionNane) { try { if (Cbx_Connection.SelectedItem != null) { Core.Xrm.CrmConnection crmConnection = Core.Data.StorageExtensions.Load(MainWindow.EncryptionKey).SingleOrDefault(x => x.Name == connectionNane); this.Dtg_Solutions.ItemsSource = null; MainWindow.SetProgress(true); this.worker.DoWork += this.Worker_DoWork; this.worker.RunWorkerCompleted += this.Worker_RunWorkerCompleted; this.worker.RunWorkerAsync(); this.selectedCrmConnection = crmConnection; this.Btn_Reload.IsEnabled = true; } } catch (Exception ex) { Log.Error(ex.Message, ex); if (!Properties.Settings.Default.DisableErrorReports) { Diagnostics.ErrorReport errorReport = new Diagnostics.ErrorReport(ex); errorReport.Show(); } MainWindow.SetProgress(false); SolutionDownloader.Log.Error(ex.Message, ex); Cbx_Connection.IsEnabled = true; Btn_Reload.IsEnabled = true; } }
/// <summary> /// Background Worker Event Worker_RunWorkerCompleted /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="RunWorkerCompletedEventArgs"/> instance containing the event data.</param> private void Worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Error != null) { Diagnostics.ErrorReport errorReport = new Diagnostics.ErrorReport(e.Error, "An error occured while downloading or extracting the solution"); errorReport.Show(); } this.Close(); }
/// <summary> /// Background Worker Event RunWorkerCompleted /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="DoWorkEventArgs"/> instance containing the event data.</param> private void Worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Error != null) { Diagnostics.ErrorReport errorReport = new Diagnostics.ErrorReport(e.Error, "An error occured while retriving the CRM Solutions"); errorReport.Show(); } this.Dtg_Solutions.ItemsSource = this.crmSolutions; this.Lbx_Repos.IsEnabled = true; MainWindow.SetProgress(false); }
/// <summary> /// Initializes a new instance of the <see cref="SolutionDownloader"/> class. /// </summary> public SolutionDownloader() { try { this.InitializeComponent(); this.LoadConnections(); } catch (System.Exception ex) { Log.Error(ex.Message, ex); Diagnostics.ErrorReport errorReport = new Diagnostics.ErrorReport(ex); errorReport.Show(); } }
/// <summary> /// Background Worker Event Worker_RunWorkerCompleted /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="RunWorkerCompletedEventArgs"/> instance containing the event data.</param> private void Worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Error != null) { Diagnostics.ErrorReport errorReport = new Diagnostics.ErrorReport(e.Error, "An error occured while downloading or extracting the solution"); errorReport.Show(); } else if (this.uploadCount == this.crmSolutions.Count) { this.tbx_status.Text += "\n Upload of {0} completed" + this.crmSolutions[this.uploadCount].LocalPath; this.tbx_status.Text += "\n Upload completed"; this.pgr_upload.Value = 100; } else { this.pgr_upload.Value += 100.00 / this.uploadCount; this.tbx_status.Text += "\n Upload of {0} completed" + this.crmSolutions[this.uploadCount].LocalPath; } }
/// <summary> /// Loads the CRM Solution for the selected Repo into the grid /// </summary> private void LoadSolutions() { this.Btn_Reload.IsEnabled = false; try { if (Lbx_Repos.SelectedItem != null) { Lbx_Repos.IsEnabled = false; this.selectedCrmConnection = null; Core.Xrm.CrmConnection crmConnection = (Core.Xrm.CrmConnection)Lbx_Repos.SelectedItem; Core.Repository.Connector repositoryConnector = new Core.Repository.Connector(); this.localSolutions = null; this.localSolutions = repositoryConnector.GetLocalCRMSolutions(((Core.Xrm.CrmConnection)Lbx_Repos.SelectedItem).LocalPath); this.Dtg_Solutions.ItemsSource = null; MainWindow.SetProgress(true); this.worker.DoWork += this.Worker_DoWork; this.worker.RunWorkerCompleted += this.Worker_RunWorkerCompleted; this.worker.RunWorkerAsync(); this.selectedCrmConnection = crmConnection.Name; this.Btn_Reload.IsEnabled = true; } } catch (Exception ex) { Log.Error(ex.Message, ex); if (!Properties.Settings.Default.DisableErrorReports) { Diagnostics.ErrorReport errorReport = new Diagnostics.ErrorReport(ex); errorReport.Show(); } MainWindow.SetProgress(false); SolutionSelector.Log.Error(ex.Message, ex); Lbx_Repos.IsEnabled = true; Btn_Reload.IsEnabled = true; } }