void xmds_GetResourceCompleted(object sender, GetResourceCompletedEventArgs e) { // Success / Failure if (e.Error != null) { Trace.WriteLine(new LogMessage("xmds_GetResource", "Unable to get Resource: " + e.Error.Message), LogType.Error.ToString()); } else { // Handle the background String bodyStyle; if (_backgroundImage == null || _backgroundImage == "") { bodyStyle = "background-color:" + _backgroundColor + " ;"; } else { bodyStyle = "background-image: url('" + _backgroundImage + "'); background-attachment:fixed; background-color:" + _backgroundColor + " background-repeat: no-repeat; background-position: " + _backgroundLeft + " " + _backgroundTop + ";"; } string html = e.Result.Replace("</head>", "<style type='text/css'>body {" + bodyStyle + " font-size:" + _scaleFactor.ToString() + "em; }</style></head>"); string fullPath = Settings.Default.LibraryPath + @"\" + _mediaId + ".htm"; using (StreamWriter sw = new StreamWriter(File.Open(fullPath, FileMode.Create, FileAccess.Write, FileShare.Read))) { sw.Write(html); sw.Close(); } _webBrowser.Navigate(fullPath); } }
private void xmds_GetResourceCompleted(object sender, GetResourceCompletedEventArgs e) { if (e.Error != null) { Trace.WriteLine(new LogMessage("xmds_GetResource", "Unable to get Resource: " + e.Error.Message), LogType.Error.ToString()); } else { string str; if ((this._backgroundImage == null) || (this._backgroundImage == "")) { str = "background-color:" + this._backgroundColor + " ;"; } else { str = "background-image: url('" + this._backgroundImage + "'); background-attachment:fixed; background-color:" + this._backgroundColor + " background-repeat: no-repeat; background-position: " + this._backgroundLeft + " " + this._backgroundTop + ";"; } string str2 = e.Result.Replace("</head>", "<style type='text/css'>body {" + str + " font-size:" + this._scaleFactor.ToString() + "em; }</style></head>"); string path = Settings.Default.LibraryPath + @"\" + this._mediaId + ".htm"; using (StreamWriter writer = new StreamWriter(File.Open(path, FileMode.Create, FileAccess.Write, FileShare.Read))) { writer.Write(str2); writer.Close(); } this._webBrowser.Navigate(path); } }