2
* Xibo - Digitial Signage - http://www.xibo.org.uk
3
* Copyright (C) 2006,2007,2008 Daniel Garner and James Packer
5
* This file is part of Xibo.
7
* Xibo is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU Affero General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
12
* Xibo is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU Affero General Public License for more details.
17
* You should have received a copy of the GNU Affero General Public License
18
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
21
using System.Collections.Generic;
23
using System.Windows.Forms;
27
class WebContent : Media
34
public WebContent(RegionOptions options)
35
: base(options.width, options.height, options.top, options.left)
37
duration = options.duration;
38
scheduleId = options.scheduleId;
39
layoutId = options.layoutId;
40
mediaId = options.mediaid;
43
webBrowser = new WebBrowser();
45
webBrowser.Size = this.Size;
46
webBrowser.ScrollBarsEnabled = false;
47
webBrowser.ScriptErrorsSuppressed = true;
50
webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted);
52
Controls.Add(webBrowser);
54
if (!Properties.Settings.Default.powerpointEnabled && options.type == "powerpoint")
56
webBrowser.DocumentText = "<html><body><h1>Powerpoint not enabled on this display</h1></body></html>";
57
System.Diagnostics.Trace.WriteLine(String.Format("[*]ScheduleID:{1},LayoutID:{2},MediaID:{3},Message:{0}", "Powerpoint is not enabled on this display", scheduleId, layoutId, mediaId));
63
// Try to make a URI out of the file path
66
this.filePath = Uri.UnescapeDataString(options.uri);
70
System.Diagnostics.Debug.WriteLine(ex.Message, "WebContent");
74
webBrowser.Navigate(this.filePath);
78
System.Diagnostics.Trace.WriteLine(String.Format("[*]ScheduleID:{1},LayoutID:{2},MediaID:{3},Message:{0}", ex.Message, scheduleId, layoutId, mediaId));
80
webBrowser.DocumentText = "<html><body><h1>Unable to show this web location - invalid address.</h1></body></html>";
82
System.Diagnostics.Trace.WriteLine(String.Format("[*]ScheduleID:{1},LayoutID:{2},MediaID:{3},Message:{0}", "Unable to show the powerpoint, cannot be located", scheduleId, layoutId, mediaId));
87
public override void RenderMedia()
93
void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
95
base.Duration = duration;
98
// Get ready to show the control
99
Application.DoEvents();
103
protected override void Dispose(bool disposing)
107
System.Diagnostics.Debug.WriteLine(String.Format("Disposing {0}", filePath));
111
if (webBrowser != null)
113
if (webBrowser.Document != null) webBrowser.Document.Body.InnerHtml = "";
114
webBrowser.Dispose();
120
base.Dispose(disposing);
122
System.Diagnostics.Debug.WriteLine(String.Format("Disposed {0}", filePath));
126
WebBrowser webBrowser;
2
* Xibo - Digitial Signage - http://www.xibo.org.uk
3
* Copyright (C) 2006,2007,2008 Daniel Garner and James Packer
5
* This file is part of Xibo.
7
* Xibo is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU Affero General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
12
* Xibo is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU Affero General Public License for more details.
17
* You should have received a copy of the GNU Affero General Public License
18
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
21
using System.Collections.Generic;
23
using System.Windows.Forms;
27
class WebContent : Media
34
public WebContent(RegionOptions options)
35
: base(options.width, options.height, options.top, options.left)
37
duration = options.duration;
38
scheduleId = options.scheduleId;
39
layoutId = options.layoutId;
40
mediaId = options.mediaid;
43
webBrowser = new WebBrowser();
45
webBrowser.Size = this.Size;
46
webBrowser.ScrollBarsEnabled = false;
47
webBrowser.ScriptErrorsSuppressed = true;
50
webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted);
52
Controls.Add(webBrowser);
54
if (!Properties.Settings.Default.powerpointEnabled && options.type == "powerpoint")
56
webBrowser.DocumentText = "<html><body><h1>Powerpoint not enabled on this display</h1></body></html>";
57
System.Diagnostics.Trace.WriteLine(String.Format("[*]ScheduleID:{1},LayoutID:{2},MediaID:{3},Message:{0}", "Powerpoint is not enabled on this display", scheduleId, layoutId, mediaId));
63
// Try to make a URI out of the file path
66
this.filePath = Uri.UnescapeDataString(options.uri);
70
System.Diagnostics.Debug.WriteLine(ex.Message, "WebContent");
74
webBrowser.Navigate(this.filePath);
78
System.Diagnostics.Trace.WriteLine(String.Format("[*]ScheduleID:{1},LayoutID:{2},MediaID:{3},Message:{0}", ex.Message, scheduleId, layoutId, mediaId));
80
webBrowser.DocumentText = "<html><body><h1>Unable to show this web location - invalid address.</h1></body></html>";
82
System.Diagnostics.Trace.WriteLine(String.Format("[*]ScheduleID:{1},LayoutID:{2},MediaID:{3},Message:{0}", "Unable to show the powerpoint, cannot be located", scheduleId, layoutId, mediaId));
87
public override void RenderMedia()
93
void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
95
base.Duration = duration;
98
// Get ready to show the control
99
Application.DoEvents();
103
protected override void Dispose(bool disposing)
107
System.Diagnostics.Debug.WriteLine(String.Format("Disposing {0}", filePath));
111
if (webBrowser != null)
113
if (webBrowser.Document != null) webBrowser.Document.Body.InnerHtml = "";
114
webBrowser.Dispose();
120
base.Dispose(disposing);
122
System.Diagnostics.Debug.WriteLine(String.Format("Disposed {0}", filePath));
126
WebBrowser webBrowser;
b'\\ No newline at end of file'