/// <summary>Hit when the user wants to save the task.</summary>
        /// <param name="sender">The save button.</param>
        /// <param name="e">RoutedEventArgs</param>
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (e != null)
            {
                e.Handled = true;
            }

            try
            {
                this.barSavingIncident.Value   = -5;
                this.barSavingIncident.Maximum = 0;
                this.barSavingIncident.Minimum = -5;

                if (this._isFieldChanged || this._isWkfChanged || this._isResChanged || this._isDescChanged)
                {
                    //Clear highlights.
                    this.workflow_ClearAllRequiredHighlights();

                    //Set working flag.
                    this.IsSaving = true;

                    //Get the new values from the form..
                    RemoteIncident newIncident = this.save_GetFromFields();

                    if (newIncident != null && this.workflow_CheckRequiredFields())
                    {
                        //Create a client, and save task and resolution..
                        ImportExportClient clientSave = StaticFuncs.CreateClient(((SpiraProject)this._ArtifactDetails.ArtifactParentProject.ArtifactTag).ServerURL.ToString());
                        clientSave.Connection_Authenticate2Completed    += clientSave_Connection_Authenticate2Completed;
                        clientSave.Connection_ConnectToProjectCompleted += clientSave_Connection_ConnectToProjectCompleted;
                        clientSave.Incident_UpdateCompleted             += clientSave_Incident_UpdateCompleted;
                        clientSave.Incident_AddCommentsCompleted        += clientSave_Incident_AddCommentsCompleted;
                        clientSave.Connection_DisconnectCompleted       += clientSave_Connection_DisconnectCompleted;

                        //Fire off the connection.
                        this._clientNumSaving = 1;
                        clientSave.Connection_Authenticate2Async(((SpiraProject)this._ArtifactDetails.ArtifactParentProject.ArtifactTag).UserName, ((SpiraProject)this._ArtifactDetails.ArtifactParentProject.ArtifactTag).UserPass, StaticFuncs.getCultureResource.GetString("app_ReportName"), this._clientNum++);
                    }
                    else
                    {
                        //Display message saying that some required fields aren't filled out.
                        MessageBox.Show(StaticFuncs.getCultureResource.GetString("app_General_RequiredFieldsMessage"), StaticFuncs.getCultureResource.GetString("app_General_RequiredFields"), MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.LogMessage(ex, "btnSave_Click()");
                MessageBox.Show(StaticFuncs.getCultureResource.GetString("app_General_UnexpectedError"), StaticFuncs.getCultureResource.GetString("app_General_ApplicationShortName"), MessageBoxButton.OK, MessageBoxImage.Error);
            }

            if (this._clientNumSaving == 0)
            {
                this.IsSaving = false;
            }
        }
        /// <summary>Called when the user changes the workflow step, pulls enabled/required fields.</summary>
        private void workflow_ChangeWorkflowStep()
        {
            try
            {
                //This is a potentially different workflow, so create the client to go out and get fields.
                ImportExportClient wkfClient = StaticFuncs.CreateClient(this._Project.ServerURL.ToString());
                wkfClient.Connection_Authenticate2Completed                  += new EventHandler <Connection_Authenticate2CompletedEventArgs>(wkfClient_Connection_Authenticate2Completed);
                wkfClient.Connection_ConnectToProjectCompleted               += new EventHandler <Connection_ConnectToProjectCompletedEventArgs>(wkfClient_Connection_ConnectToProjectCompleted);
                wkfClient.Incident_RetrieveWorkflowFieldsCompleted           += new EventHandler <Incident_RetrieveWorkflowFieldsCompletedEventArgs>(wkfClient_Incident_RetrieveWorkflowFieldsCompleted);
                wkfClient.Incident_RetrieveWorkflowCustomPropertiesCompleted += new EventHandler <Incident_RetrieveWorkflowCustomPropertiesCompletedEventArgs>(wkfClient_Incident_RetrieveWorkflowCustomPropertiesCompleted);

                //Connect.
                this._clientNumRunning = 1;
                wkfClient.Connection_Authenticate2Async(this._Project.UserName, this._Project.UserPass, StaticFuncs.getCultureResource.GetString("app_ReportName"));
            }
            catch (Exception ex)
            {
                Logger.LogMessage(ex, "workflow_ChangeWorkflowStep()");
                MessageBox.Show(StaticFuncs.getCultureResource.GetString("app_General_UnexpectedError"), StaticFuncs.getCultureResource.GetString("app_General_ApplicationShortName"), MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }