Skip to content

Commit 230c2d8

Browse files
committed
WebUI Video Stream Viewer fixed.
1 parent e20bc6a commit 230c2d8

6 files changed

Lines changed: 31 additions & 54 deletions

File tree

UI/OSAE.UI.Controls/VideoStreamViewer.xaml.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ public VideoStreamViewer(string url, OSAEObject obj, string appName)
3131
_mjpeg = new MjpegDecoder();
3232
_mjpeg.FrameReady += mjpeg_FrameReady;
3333
_mjpeg.Error += _mjpeg_Error;
34-
int imgsWidth = Convert.ToInt32(OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "Width").Value);
35-
int imgsHeight = Convert.ToInt32(OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "Height").Value);
36-
ControlWidth = Convert.ToInt32(OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Name, "Width").Value);
37-
imgRatio = ControlWidth / imgsWidth;
38-
ControlHeight = Convert.ToInt32(imgHeight * imgRatio);
34+
imgWidth = Convert.ToDouble(OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "Width").Value);
35+
imgHeight = Convert.ToDouble(OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "Height").Value);
36+
ControlWidth = Convert.ToDouble(OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Name, "Width").Value);
37+
imgRatio = ControlWidth / imgWidth;
38+
ControlHeight = Convert.ToDouble(imgHeight * imgRatio);
3939
streamURI = OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Property("Object Name").Value, "Stream Address").Value;
40-
if (imgsWidth > 0) { imgWidth = Convert.ToDouble(imgsWidth); }
41-
if (imgsHeight > 0) { imgHeight = Convert.ToDouble(imgsHeight); }
40+
// if (imgWidth > 0) { imgWidth = imgWidth); }
41+
// if (imgHeight > 0) { imgHeight = Convert.ToDouble(imgHeight); }
4242
this.Width = ControlWidth;
4343
this.Height = ControlHeight;
4444

UI/Web/MasterPage.master.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Web;
52
using System.Web.UI;
6-
using System.Web.UI.WebControls;
73
using System.Web.UI.HtmlControls;
84
using System.ServiceProcess;
95
using OSAE;
106

117
public partial class MasterPage : System.Web.UI.MasterPage
128
{
13-
//OSAELog
149
public OSAE.General.OSAELog Log = new OSAE.General.OSAELog("SYSTEM");
1510

1611
protected void Page_Load(object sender, EventArgs e)

UI/Web/controls/ctrlEmbedded.ascx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ctrlEmbedded.ascx.cs" Inherits="controls_ctrlEmbedded" className="ctrlEmbedded"%>
22

3-
<iframe id="frame" runat="server">
4-
Your browser does not support the video tag.
5-
</iframe>
3+
<asp:Image ID="imgSnapShot" runat="server"/>

UI/Web/controls/ctrlEmbedded.ascx.cs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Web;
5-
using System.Web.UI;
6-
using System.Web.UI.WebControls;
72
using OSAE;
83

94
public partial class controls_ctrlEmbedded : System.Web.UI.UserControl
105
{
116
public OSAEObject screenObject { get; set; }
127
public string Source;
138
public string width, height;
9+
double imgRatio;
10+
public double ControlWidth;
11+
public double ControlHeight;
12+
string streamURI;
1413

1514
protected void Page_Load(object sender, EventArgs e)
1615
{
1716
OSAEObject obj = OSAEObjectManager.GetObjectByName(screenObject.Property("Object Name").Value);
18-
Source = renameingSys(obj.Property("Stream Address").Value);
19-
width = screenObject.Property("Width").Value;
20-
height = screenObject.Property("Height").Value;
21-
frame.Attributes.Add("width", width);
22-
frame.Attributes.Add("height", height);
23-
frame.Attributes.Add("src", Source);
24-
frame.Attributes.Add("Style", "position:absolute;top:" + (Int32.Parse(screenObject.Property("Y").Value) + 50).ToString() + "px;left:" + (Int32.Parse(screenObject.Property("X").Value) + 10).ToString() + "px;z-index:" + (Int32.Parse(screenObject.Property("ZOrder").Value) + 10).ToString() + ";");
25-
}
17+
Source = renameingSys(obj.Property("SNAP SHOT").Value);
18+
double imgWidth = Convert.ToDouble(obj.Property("Width").Value);
19+
double imgHeight = Convert.ToDouble(obj.Property("Height").Value);
20+
ControlWidth = Convert.ToDouble(screenObject.Property("Width").Value);
21+
imgRatio = ControlWidth / imgWidth;
22+
ControlHeight = Convert.ToInt32(imgHeight * imgRatio);
23+
width = ControlWidth.ToString();
24+
height = ControlHeight.ToString();
25+
imgSnapShot.Attributes.Add("Style", "position:absolute;top:" + (Int32.Parse(screenObject.Property("Y").Value) + 50).ToString() + "px;left:" + (Int32.Parse(screenObject.Property("X").Value) + 10).ToString() + "px;z-index:" + (Int32.Parse(screenObject.Property("ZOrder").Value) + 10).ToString() + ";");
26+
imgSnapShot.ImageUrl = Source;
27+
imgSnapShot.Width = System.Web.UI.WebControls.Unit.Parse(width);
28+
imgSnapShot.Height = System.Web.UI.WebControls.Unit.Parse(height);
29+
}
2630

2731
private string renameingSys(string fieldData)
2832
{
@@ -35,9 +39,7 @@ private string renameingSys(string fieldData)
3539
string getProperty = OSAEObjectPropertyManager.GetObjectPropertyValue(screenObject.Property("Object Name").Value, renameProperty).Value;
3640
// log any errors
3741
if (getProperty.Length > 0)
38-
{
3942
newData = newData.Replace("[" + renameProperty + "]", getProperty);
40-
}
4143
}
4244
newData = @"http://" + newData;
4345
return newData;

UI/Web/controls/ctrlTimerLabel.ascx.cs

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Web;
5-
using System.Web.UI;
62
using System.Web.UI.WebControls;
73
using System.Drawing;
84
using OSAE;
@@ -48,32 +44,23 @@ protected void Page_Load(object sender, EventArgs e)
4844
if (sBackColor != "")
4945
{
5046
try
51-
{
52-
TimerLabel.BackColor = Color.FromName(sBackColor);
53-
}
47+
{ TimerLabel.BackColor = Color.FromName(sBackColor); }
5448
catch (Exception)
55-
{
56-
}
49+
{ }
5750
}
5851
if (sForeColor != "")
5952
{
6053
try
61-
{
62-
TimerLabel.ForeColor = Color.FromName(sForeColor);
63-
}
54+
{ TimerLabel.ForeColor = Color.FromName(sForeColor); }
6455
catch (Exception)
65-
{
66-
}
56+
{ }
6757
}
6858
if (iFontSize != "")
6959
{
7060
try
71-
{
72-
TimerLabel.Font.Size = new FontUnit(iFontSize);
73-
}
61+
{ TimerLabel.Font.Size = new FontUnit(iFontSize); }
7462
catch (Exception)
75-
{
76-
}
63+
{ }
7764
}
7865
}
7966
}

UI/Web/controls/ctrlUserControl.ascx.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Web;
5-
using System.Web.UI;
6-
using System.Web.UI.WebControls;
72
using OSAE;
83

94
public partial class controls_ctrlUserControl : System.Web.UI.UserControl

0 commit comments

Comments
 (0)