public bool VerifyManifest()
        {
            try
            {
                _lastResult = GetLastResultFromCache();
                if (_lastResult == null)
                {
                    var sp      = new ProductManifestServiceProvider();
                    var service = sp.GetService(typeof(IProductVerificationService)) as IProductVerificationService;
                    if (service != null)
                    {
                        _lastResult = service.Verify(new ProductVerificationRequest());
                    }

                    if (_lastResult != null)
                    {
                        InsertLastResultIntoCache(_lastResult);
                    }
                }
            }
            catch (Exception ex)
            {
                // This is called on every page. We don't want to fill up the log.
                if (Platform.IsLogLevelEnabled(LogLevel.Debug))
                {
                    Platform.Log(LogLevel.Error, "Error occurred when trying to communicate with manifest service :{0}", ex.Message);
                }
            }

            return(_lastResult != null && _lastResult.IsManifestValid);
        }
 private void InsertLastResultIntoCache(ProductVerificationResponse response)
 {
     using (var cache = ClearCanvas.Common.Caching.Cache.CreateClient(GetType().FullName))
     {
         cache.Put(_cacheKey, response, new CachePutOptions(_cacheRegion, TimeSpan.FromMinutes(15), false));
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            ProductVerificationTester   test   = new ProductVerificationTester();
            ProductVerificationResponse result = test.Verify();

            ComponentName.Text    = String.Format("ComponentName: {0}", result.ComponentName);
            ManifestVerified.Text = String.Format("ManifestVerified: {0}", result.IsManifestValid);
        }