Exemple #1
0
        /// <summary>Hit when the user wants to merge their changes with the concurrent task.</summary>
        /// <param name="sender">btnConcurrencyMergeYes</param>
        /// <param name="e">RoutedEventArgs</param>
        private void btnConcurrencyMergeYes_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                e.Handled = true;
                //Get the client.
                ImportExportClient client = ((dynamic)sender).Tag as ImportExportClient;
                if (client != null)
                {
                    //Switch screens again...
                    this.display_SetOverlayWindow(this.panelSaving, System.Windows.Visibility.Visible);
                    this.display_SetOverlayWindow(this.panelError, System.Windows.Visibility.Hidden);
                    this.barSavingReq.Value--;

                    //Re-launch the saving..
                    RemoteRequirement reqMerged = StaticFuncs.MergeWithConcurrency(this.save_GetFromFields(), this._Requirement, this._RequirementConcurrent);

                    this._clientNumSaving++;
                    client.Requirement_UpdateAsync(reqMerged, this._clientNum++);
                }
            }
            catch (Exception ex)
            {
                Logger.LogMessage(ex, "btnConcurrencyMergeYes_Click()");
                MessageBox.Show(StaticFuncs.getCultureResource.GetString("app_General_UnexpectedError"), StaticFuncs.getCultureResource.GetString("app_General_ApplicationShortName"), MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemple #2
0
        /// <summary>Hit when we're finished connecting to the project.</summary>
        /// <param name="sender">ImportExportClient</param>
        /// <param name="e">Connection_ConnectToProjectCompletedEventArgs</param>
        private void clientSave_Connection_ConnectToProjectCompleted(object sender, Connection_ConnectToProjectCompletedEventArgs e)
        {
            const string METHOD = CLASS + "clientSave_Connection_ConnectToProjectCompleted()";

            Logger.LogTrace_EnterMethod(METHOD + "  " + this._clientNumSaving.ToString() + " clients running.");

            try
            {
                ImportExportClient client = (sender as ImportExportClient);
                this._clientNumSaving--;
                this.barSavingReq.Value++;

                if (!e.Cancelled)
                {
                    if (e.Error == null)
                    {
                        if (e.Result)
                        {
                            //Get the new RemoteIncident
                            RemoteRequirement newRequirement = this.save_GetFromFields();

                            if (newRequirement != null)
                            {
                                //Fire off our update calls.
                                this._clientNumSaving++;
                                client.Requirement_UpdateAsync(newRequirement, this._clientNum++);
                            }
                            else
                            {
                                //TODO: Show Error.
                                //Cancel calls.
                                this._clientNumSaving++;
                                client.Connection_DisconnectAsync(this._clientNum++);
                            }
                        }
                        else
                        {
                            //TODO: Show Error.
                            //Cancel calls.
                            this._clientNumSaving++;
                            client.Connection_DisconnectAsync(this._clientNum++);
                        }
                    }
                    else
                    {
                        //TODO: Show Error.
                        //Cancel calls.
                        this._clientNumSaving++;
                        client.Connection_DisconnectAsync(this._clientNum++);
                    }
                }

                //See if it's okay to reload.
                this.save_CheckIfOkayToLoad();
            }
            catch (Exception ex)
            {
                Logger.LogMessage(ex, METHOD);
                MessageBox.Show(StaticFuncs.getCultureResource.GetString("app_General_UnexpectedError"), StaticFuncs.getCultureResource.GetString("app_General_ApplicationShortName"), MessageBoxButton.OK, MessageBoxImage.Error);
            }
            Logger.LogTrace_ExitMethod(METHOD + "  " + this._clientNumSaving.ToString() + " clients left.");
        }