Esempio n. 1
0
 /// <summary>
 /// Deletes the Connection from Configuration
 /// </summary>
 private void DeleteConnectionWithoutFolder()
 {
     try
     {
         Core.Data.StorageExtensions.Delete(Tbx_ConnectionName.Text);
         MessageBox.Show("Deleted Connection.", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
     }
     catch (Exception ex)
     {
         Log.Error(ex.Message, ex);
         Diagnostics.ErrorReport errorReport = new Diagnostics.ErrorReport(ex);
         errorReport.Show();
     }
 }
Esempio n. 2
0
        /// <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 occurred while downloading or extracting the solution");
                errorReport.Show();
            }

            this.loadingPanel.IsLoading = false;
            this.Btn_close.IsEnabled    = true;
            DownloadMultiple.LogToUI("---------------");
            DownloadMultiple.LogToUI("Finished download/extraction");
            DownloadMultiple.LogToUI("---------------");
        }
Esempio n. 3
0
        /// <summary>
        /// Button Click, Opens the Connection Overview Dialog
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void Btn_OpenConnectionOverview_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ConnectionOverview connectionOverview = new ConnectionOverview();
                connectionOverview.ShowDialog();

                ((Pages.SolutionSelector) this.menuItems[0].Content).ReloadConnections();
            }
            catch (Exception ex)
            {
                Diagnostics.ErrorReport errorReport = new Diagnostics.ErrorReport(ex);
                errorReport.Show();
            }
        }
        /// <summary>
        /// Button Save click Event
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void Btn_save_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                try
                {
                    this.crmConnection.Name = this.tbx_connectionName.Text;
                    List <Core.Xrm.CrmConnection> crmConnections = Core.Data.StorageExtensions.Load(MainWindow.EncryptionKey);

                    bool connectionExists = false;
                    foreach (Core.Xrm.CrmConnection crmTempConnection in crmConnections)
                    {
                        if (crmTempConnection.Name == this.tbx_connectionName.Text)
                        {
                            connectionExists = true;
                            MessageBox.Show($"Connection {this.tbx_connectionName.Text} does already exist!", "Connection already exists", MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                    }

                    if (!connectionExists)
                    {
                        Core.Data.StorageExtensions.Save(this.crmConnection, MainWindow.EncryptionKey);
                        this.Close();
                    }
                }
                catch (System.IO.FileNotFoundException)
                {
                    // Ignore Error, in a fresh installation there is no config File
                    Core.Data.StorageExtensions.Save(this.crmConnection, MainWindow.EncryptionKey);
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                if (!Properties.Settings.Default.DisableErrorReports)
                {
                    Diagnostics.ErrorReport errorReport = new Diagnostics.ErrorReport(ex);
                    errorReport.Show();
                }

                ConnectionManger.Log.Error(ex.Message, ex);
            }
        }
        /// <summary>
        /// Button Click Action, Connect and add a CRM Organization
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                crmConnection = null;

                using (Core.Xrm.ToolingConnector toolingConnector = new Core.Xrm.ToolingConnector())
                {
                    CrmServiceClient crmServiceClient = toolingConnector.GetCrmServiceClient(tbx_connectionString.Text);
                    if (crmServiceClient != null && crmServiceClient.IsReady)
                    {
                        this.crmConnection = new Core.Xrm.CrmConnection
                        {
                            ConnectionID     = Guid.NewGuid(),
                            ConnectionString = this.tbx_connectionString.Text,
                            Name             = crmServiceClient.ConnectedOrgFriendlyName
                        };

                        this.tbx_connectionName.IsReadOnly = false;
                        this.tbx_connectionName.Text       = this.crmConnection.Name;
                        this.tbx_connectionName.Text       = this.crmConnection.Name;
                        this.Lbl_ConnectionName.Visibility = Visibility.Visible;
                        this.tbx_connectionName.Visibility = Visibility.Visible;
                        btn_save.IsEnabled = true;
                    }
                    else
                    {
                        MessageBox.Show((string)Application.Current.FindResource("ConnectionManager_Code_UnableToOpenCRM"), (string)Application.Current.FindResource("ConnectionManager_Code_UnableToOpenCRM_Caption"), MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                if (!Properties.Settings.Default.DisableErrorReports)
                {
                    Diagnostics.ErrorReport errorReport = new Diagnostics.ErrorReport(ex);
                    errorReport.Show();
                }

                ConnectionManger.Log.Error(ex.Message, ex);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PatchNotes"/> class.
        /// </summary>
        public PatchNotes()
        {
            try
            {
                UpdateChecker updateChecker = new UpdateChecker();
                Release       release       = updateChecker.GetReleaseInfo($"{Properties.Settings.Default.GitHubAPIURL}/releases/latest");

                this.InitializeComponent();
                this.Tbx_PatchNotes.Text       = release.Body;
                this.Lbl_IsPreRelease.Content  = release.Prerelease.ToString();
                this.Lbl_VersionNumber.Content = release.Name;
                this.Lbl_ReleaseDate.Content   = release.Published_at.ToString();
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message, ex);
                if (!Properties.Settings.Default.DisableErrorReports)
                {
                    Diagnostics.ErrorReport errorReport = new Diagnostics.ErrorReport(ex);
                    errorReport.Show();
                }
            }
        }