Update view after reset OUT-592
authorThomas
Thu, 03 Oct 2019 14:44:32 +0200
branchOUT-592
changeset 27860aa48d1d7f74
parent 2785 db289ac9ff42
child 2787 c8f03f46e06f
Update view after reset
UI/ViewModels/HandshakeViewModel.cs
     1.1 --- a/UI/ViewModels/HandshakeViewModel.cs	Thu Oct 03 14:41:59 2019 +0200
     1.2 +++ b/UI/ViewModels/HandshakeViewModel.cs	Thu Oct 03 14:44:32 2019 +0200
     1.3 @@ -522,16 +522,31 @@
     1.4              try
     1.5              {
     1.6                  pEpIdentity identity = this.Partner.ToCOMType();
     1.7 -                ThisAddIn.PEPEngine.KeyResetIdentity(identity, null);
     1.8  
     1.9 +                // Reset trust or the whole identity according to color
    1.10 +                if (this.Partner.Color == pEpColor.pEpColorGreen)
    1.11 +                {
    1.12 +                    ThisAddIn.PEPEngine.KeyResetTrust(ref identity);
    1.13 +                }
    1.14 +                else
    1.15 +                {
    1.16 +                    ThisAddIn.PEPEngine.KeyResetIdentity(identity, null);
    1.17 +                }
    1.18 +
    1.19 +                // Update the handshake partner
    1.20                  identity = ThisAddIn.PEPEngine.UpdateIdentity(identity);
    1.21 -                this.Partner = new PEPIdentity(identity);
    1.22 +                this.Partner = new PEPIdentity(identity)
    1.23 +                {
    1.24 +                    Rating = ThisAddIn.PEPEngine.IdentityRating(identity)
    1.25 +                };
    1.26  
    1.27 -                pEpColor newColor = ThisAddIn.PEPEngine.IdentityRating(identity).ToColor();
    1.28 -                this.PEPColorIcon = HandshakeDialogViewModel.GetColorIcon(newColor);
    1.29 +                // Update view
    1.30 +                this.InitializeHandshakeView();
    1.31  
    1.32 -                this.SetExplanationText();
    1.33 +                // Update all open windows
    1.34 +                Globals.ThisAddIn.RecalculateAllWindows(null);
    1.35  
    1.36 +                // Shot notification
    1.37                  Notification.Show(Properties.Resources.Options_Reset, Properties.Resources.Notifications_CommunicationPartnerReset);
    1.38              }
    1.39              catch (Exception ex)