private void xmds1_BlackListCompleted(object sender, R23SignageClient.xmds.BlackListCompletedEventArgs e) { if (e.Error != null) { System.Diagnostics.Trace.WriteLine("Error sending blacklist", "BlackList - BlackListCompleted"); } else { System.Diagnostics.Trace.WriteLine("Blacklist sending complete", "BlackList - BlackListCompleted"); } return; }
/// <summary> /// Refresh Complete /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void xmds_GetResourceCompleted(object sender, R23SignageClient.xmds.GetResourceCompletedEventArgs e) { try { // Success / Failure if (e.Error != null) { Trace.WriteLine(new LogMessage("xmds_GetResource", "Unable to get Resource: " + e.Error.Message), LogType.Error.ToString()); // We have failed to update from XMDS, do we have a cached file we can revert to if (File.Exists(_filePath)) { // Cached file to revert to UpdateCacheIfNecessary(); _webView.Browser.GetMainFrame().LoadUrl(_filePath); } else { // No cache to revert to // Start the timer so that we expire base.RenderMedia(); } } else { // Ammend the resource file so that we can open it directly from the library (this is better than using a tempoary file) string cachedFile = e.Result; // Handle the background String bodyStyle; String backgroundColor = _options.Dictionary.Get("backgroundColor", _options.backgroundColor); if (_options.backgroundImage == null || _options.backgroundImage == "") { bodyStyle = "background-color:" + backgroundColor + " ;"; } else { bodyStyle = "background-image: url('" + _options.backgroundImage.Replace('\\', '/') + "'); background-attachment:fixed; background-color:" + backgroundColor + "; background-repeat: no-repeat; background-position: " + _options.backgroundLeft + "px " + _options.backgroundTop + "px;"; } string html = cachedFile.Replace("</head>", "<style type='text/css'>body {" + bodyStyle + " }</style></head>"); html = html.Replace("[[ViewPortWidth]]", _width.ToString()); // Write to the library using (StreamWriter sw = new StreamWriter(File.Open(_filePath, FileMode.Create, FileAccess.Write, FileShare.Read))) { sw.Write(html); sw.Close(); } // Read the control meta back out ReadControlMeta(); // Handle Navigate in here because we will not have done it during first load _webView.Browser.GetMainFrame().LoadUrl(_filePath); } } catch (ObjectDisposedException) { Trace.WriteLine(new LogMessage("WebMedia", "Retrived the data set, stored the document but the media has already expired."), LogType.Error.ToString()); } catch (Exception ex) { Trace.WriteLine(new LogMessage("WebMedia", "Unknown exception " + ex.Message), LogType.Error.ToString()); // This should exipre the media Duration = 5; base.RenderMedia(); } }
/// <summary> /// Register display completed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void xmds1_RegisterDisplayCompleted(object sender, R23SignageClient.xmds.RegisterDisplayCompletedEventArgs e) { tbStatus.ResetText(); if (e.Error != null) { tbStatus.AppendText("Status" + Environment.NewLine); tbStatus.AppendText(e.Error.Message); Debug.WriteLine("Error returned from Call to XMDS Register Display.", "xmds1_RegisterDisplayCompleted"); Debug.WriteLine(e.Error.Message, "xmds1_RegisterDisplayCompleted"); Debug.WriteLine(e.Error.StackTrace, "xmds1_RegisterDisplayCompleted"); } else { tbStatus.AppendText(RegisterAgent.ProcessRegisterXml(e.Result)); } }