Ejemplo n.º 1
0
        protected void ProcessLicenseServiceResponse(IEnterKeyResponse response)
        {
            ILicenseService        service1 = this.Services.GetService <ILicenseService>();
            IMessageDisplayService service2 = this.Services.GetService <IMessageDisplayService>();

            this.IsLicensed = response.IsEnabled;
            if ((int)response.ErrorCode != -1073418160)
            {
                LicensingDialogHelper.ShowErrorMessageFromResponse((ILicenseSubServiceResponse)response, service2);
            }
            if (!response.IsEnabled)
            {
                if (service1.HasKey(response.KeySku) && service1.GetUnlicensedReason(response.KeySku) == UnlicensedReason.GraceTimeExpired)
                {
                    MessageBoxArgs args = new MessageBoxArgs()
                    {
                        Owner   = (Window)this,
                        Message = StringTable.LicensingYouNeedToActivate,
                        Button  = MessageBoxButton.OK,
                        Image   = MessageBoxImage.Exclamation
                    };
                    int num = (int)service2.ShowMessage(args);
                }
                else
                {
                    MessageBoxArgs args = new MessageBoxArgs()
                    {
                        Owner   = (Window)this,
                        Message = StringTable.LicensingInvalidKeyMessage,
                        Button  = MessageBoxButton.OK,
                        Image   = MessageBoxImage.Hand
                    };
                    int num = (int)service2.ShowMessage(args);
                }
            }
            else if (this.ShouldActivate && service1.SkusFromFeature(ExpressionFeatureMapper.ActivationLicense).Contains(response.KeySku) && !response.IsActivated)
            {
                MessageBoxArgs args = new MessageBoxArgs()
                {
                    Owner   = (Window)this,
                    Message = StringTable.LicensingEnterKeySucceededAndActivationFailed,
                    Image   = MessageBoxImage.Exclamation
                };
                int num = (int)service2.ShowMessage(args);
                LicensingDialogHelper.ShowActivationDialog(this.Services, (CommonDialogCreator) new ActivationDialogCreator(this.Services, ActivationWizardAction.ChooseActivationType));
            }
            else
            {
                MessageBoxArgs args = new MessageBoxArgs()
                {
                    Owner   = (Window)this,
                    Message = StringTable.LicensingValidMessage
                };
                int num = (int)service2.ShowMessage(args);
            }
        }
Ejemplo n.º 2
0
        private void ProcessProductKeyWorker_Work(object sender, DoWorkEventArgs e)
        {
            IEnterKeyResponse enterKeyResponse = this.InsertKeyIntoLicenseStore((string)e.Argument);

            e.Result = (object)enterKeyResponse;
        }