using Shared.SimpleControl.Phone;
|
using System;
|
namespace Shared.SimpleControl.Pad
|
{
|
public class UserTVNumberView : FrameLayout
|
{
|
public void Show (Room room, InfraredMode infraredTV)
|
{
|
Random ran = new Random ();
|
InfraredMode linkSTB = null;
|
this.BackgroundColor = SkinStyle.Current.MainColor;
|
if (!string.IsNullOrEmpty (infraredTV.LinkInfraredMode)) {
|
linkSTB = Newtonsoft.Json.JsonConvert.DeserializeObject<InfraredMode> (CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (infraredTV.LinkInfraredMode)));
|
} else
|
linkSTB = null;
|
#region Top View
|
FrameLayout roomBackgroundImageView = new FrameLayout () {
|
X = Application.GetRealWidth (40),
|
Y = Application.GetRealHeight (10),
|
Width = Application.GetRealWidth (920),
|
Height = Application.GetRealHeight (520),
|
};
|
AddChidren (roomBackgroundImageView);
|
roomBackgroundImageView.BackgroundImagePath = room.BackGroundImage;
|
//长按更换背景
|
roomBackgroundImageView.MouseLongEventHandler += (sender, e) => {
|
Camera.SelectPicture ((obj) => {
|
if (obj != null) {
|
roomBackgroundImageView.BackgroundImagePath = room.Name;
|
}
|
}, room.Name);
|
};
|
#endregion
|
#region
|
PageLayout RowControl = new PageLayout () {
|
Y = roomBackgroundImageView.Bottom,
|
Height = Application.GetRealHeight(820),
|
};
|
AddChidren (RowControl);
|
FrameLayout numView = new FrameLayout ();
|
RowControl.AddChidren (numView);
|
var cTVCustom = new UserTVCustomChannel ();
|
RowControl.AddChidren (cTVCustom);
|
cTVCustom.Show (infraredTV);
|
RowControl.PageIndex = 0;
|
FrameLayout powerView = new FrameLayout () {
|
Height = Application.GetRealHeight (250),
|
};
|
numView.AddChidren (powerView);
|
Button btnTVPower = new Button () {
|
X = Application.GetRealWidth (100),
|
Y = Application.GetRealHeight (20),
|
Width = Application.GetMinRealAverage (150),
|
Height = Application.GetMinRealAverage (150),
|
UnSelectedImagePath = "Item/TV_PowerSelected.png",
|
Padding = new Padding (Application.GetRealWidth (130), 0, 0, 0),
|
};
|
powerView.AddChidren (btnTVPower);
|
Button btnTVPowerText = new Button () {
|
X = Application.GetRealWidth (100),
|
Y = btnTVPower.Bottom - Application.GetRealHeight (20),
|
Width = btnTVPower.Width,
|
Height = Application.GetRealHeight (50),
|
TextAlignment = TextAlignment.TopCenter,
|
TextSize = 20,
|
TextID = R.MyInternationalizationString.TV,
|
};
|
powerView.AddChidren (btnTVPowerText);
|
btnTVPower.MouseUpEventHandler += (sender, e) => {
|
int RandKey = ran.Next (0, 255);
|
Control.ControlBytesSend (Command.InfraredControl, infraredTV.SubnetID, infraredTV.DeviceID, new byte [] { Convert.ToByte (infraredTV.Port), infraredTV.LoopID, (byte)InfraredCode_TV.Power, 0, 0, (byte)RandKey });
|
};
|
Button btnSTBPower = new Button () {
|
X = Application.GetRealWidth (1000 - 241),
|
Y = Application.GetRealHeight (20),
|
Width = Application.GetMinRealAverage (150),
|
Height = Application.GetMinRealAverage (150),
|
UnSelectedImagePath = "Item/TV_PowerSelected.png",
|
Padding = new Padding (Application.GetRealHeight (130), 0, 0, 0),
|
};
|
powerView.AddChidren (btnSTBPower);
|
|
Button btnSTBPowerText = new Button () {
|
X = btnSTBPower.X,
|
Y = btnSTBPower.Bottom - Application.GetRealHeight (20),
|
Width = btnTVPower.Width,
|
Height = Application.GetRealHeight (50),
|
TextAlignment = TextAlignment.TopCenter,
|
TextSize = 20,
|
TextID = R.MyInternationalizationString.STB
|
};
|
powerView.AddChidren (btnSTBPowerText);
|
btnSTBPower.MouseUpEventHandler += (sender, e) => {
|
if (!string.IsNullOrEmpty (infraredTV.LinkInfraredMode)) {
|
int RandKey = ran.Next (0, 255);
|
Control.ControlBytesSend (Command.InfraredControl, linkSTB.SubnetID, linkSTB.DeviceID, new byte [] { Convert.ToByte (infraredTV.Port), linkSTB.LoopID, (byte)InfraredCode_STB.Standby, 0, 0, (byte)RandKey });
|
} else {
|
new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.PleaseBindTheSTB), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
|
return;
|
}
|
};
|
btnSTBPower.MouseLongEventHandler += (sender, e) => {
|
Dialog dialogAddSTB = new Dialog ();
|
|
FrameLayout fl = new FrameLayout () {
|
Height = Application.GetRealHeight (480),
|
Width = Application.GetRealWidth (400),
|
};
|
dialogAddSTB.AddChidren (fl);
|
|
Button btnTilte = new Button () {
|
Height = Application.GetRealHeight (80),
|
BackgroundColor = 0xFF333333,
|
TextID = R.MyInternationalizationString.BindTheSTB,
|
};
|
fl.AddChidren (btnTilte);
|
|
Button btBSTVLine = new Button () {
|
Width = LayoutParams.MatchParent,
|
Height = 3,
|
Y = btnTilte.Bottom,
|
BackgroundColor = 0xFF000000,
|
};
|
fl.AddChidren (btBSTVLine);
|
|
VerticalScrolViewLayout verticalView = new VerticalScrolViewLayout () {
|
Height = Application.GetRealHeight (310),
|
Y = btBSTVLine.Bottom,
|
BackgroundColor = 0xFF333333
|
};
|
fl.AddChidren (verticalView);
|
|
Button btBSTVLine2 = new Button () {
|
Width = LayoutParams.MatchParent,
|
Height = 3,
|
Y = Application.GetRealHeight (391),
|
BackgroundColor = 0xFF000000,
|
};
|
fl.AddChidren (btBSTVLine2);
|
|
Button btnClose = new Button () {
|
BackgroundColor = 0xFF333333,
|
Height = Application.GetRealHeight (86),
|
Y = verticalView.Bottom,
|
TextID = R.MyInternationalizationString.Close,
|
};
|
fl.AddChidren (btnClose);
|
btnClose.MouseUpEventHandler += (sende3r, e3) => {
|
dialogAddSTB.Close ();
|
};
|
|
foreach (var path in IO.FileUtils.ReadFiles ()) {
|
var pathArray = path.Split ('_');
|
if (pathArray.Length == 5 && pathArray [1] == typeof (InfraredMode).Name) {
|
var imSTB = Newtonsoft.Json.JsonConvert.DeserializeObject<InfraredMode> (CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (path)));
|
if (imSTB.InfraredType == InfraredType.STB) {
|
var STBView = new RowLayout () {
|
Height = Application.GetRealHeight (85),
|
BackgroundColor = 0xFF2f2f2f,
|
Tag = imSTB.Name
|
};
|
verticalView.AddChidren (STBView);
|
|
var btnSTBName = new Button () {
|
Height = Application.GetRealHeight (80),
|
Text = imSTB.Name,
|
BackgroundColor = 0xFB757575,
|
SelectedBackgroundColor = SkinStyle.Current.SelectedColor
|
};
|
if (infraredTV.LinkInfraredMode == path) {
|
btnSTBName.IsSelected = true;
|
}
|
STBView.AddChidren (btnSTBName);
|
|
btnSTBName.MouseUpEventHandler += (sender1, e1) => {
|
if (btnSTBName.IsSelected) {//取消绑定
|
Alert alert = new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.CancelBinding), Language.StringByID (R.MyInternationalizationString.Cancel), Language.StringByID (R.MyInternationalizationString.Confrim));
|
alert.Show ();
|
alert.ResultEventHandler += (sender2, e2) => {
|
if (e2) {
|
infraredTV.LinkInfraredMode = string.Empty;
|
linkSTB = null;
|
IO.FileUtils.SaveEquipmentMessage (infraredTV, infraredTV.LoopID.ToString ());
|
UserDeviceToTV.curView.ControlTVView.ShowUserTV (infraredTV);
|
dialogAddSTB.Close ();
|
}
|
};
|
} else {
|
Alert alert = new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.SureBindDevice), Language.StringByID (R.MyInternationalizationString.Cancel), Language.StringByID (R.MyInternationalizationString.Confrim));
|
alert.Show ();
|
alert.ResultEventHandler += (sender2, e2) => {
|
if (e2) {
|
infraredTV.LinkInfraredMode = path;
|
linkSTB = Newtonsoft.Json.JsonConvert.DeserializeObject<InfraredMode> (CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (infraredTV.LinkInfraredMode)));
|
IO.FileUtils.SaveEquipmentMessage (infraredTV, infraredTV.LoopID.ToString ());
|
UserDeviceToTV.curView.ControlTVView.ShowUserTV (infraredTV);
|
dialogAddSTB.Close ();
|
}
|
};
|
}
|
};
|
}
|
}
|
}
|
dialogAddSTB.Show ();
|
};
|
#endregion
|
|
FrameLayout NumberView = new FrameLayout () {
|
Y = powerView.Bottom,
|
Height = Application.GetRealHeight (520),
|
};
|
numView.AddChidren (NumberView);
|
|
Button tvNum1 = new Button () {
|
X = Application.GetRealWidth (100),
|
Y = Application.GetRealHeight (10),
|
Width = Application.GetMinRealAverage (165),
|
Height = Application.GetMinRealAverage (140),
|
UnSelectedImagePath = "TV/TV2_1.png",
|
SelectedImagePath = "TV/TV2_1_on.png",
|
};
|
NumberView.AddChidren (tvNum1);
|
tvNum1.MouseDownEventHandler += (sender, e) => {
|
tvNum1.IsSelected = true;
|
int RandKey = ran.Next (0, 255);
|
if (!string.IsNullOrEmpty (infraredTV.LinkInfraredMode)) {
|
linkSTB = Newtonsoft.Json.JsonConvert.DeserializeObject<InfraredMode> (CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (infraredTV.LinkInfraredMode)));
|
Control.ControlBytesSend (Command.InfraredControl, linkSTB.SubnetID, linkSTB.DeviceID, new byte [] { Convert.ToByte (linkSTB.Port), linkSTB.LoopID, (byte)InfraredCode_STB.One, 0, 0, (byte)RandKey });
|
} else {
|
linkSTB = null;
|
Control.ControlBytesSend (Command.InfraredControl, infraredTV.SubnetID, infraredTV.DeviceID, new byte [] { Convert.ToByte (infraredTV.Port), infraredTV.LoopID, (byte)InfraredCode_TV.One, 0, 0, (byte)RandKey });
|
}
|
};
|
tvNum1.MouseUpEventHandler += (sender, e) => {
|
tvNum1.IsSelected = false;
|
};
|
|
Button tvNum2 = new Button () {
|
X = tvNum1.Right + Application.GetRealWidth (50),
|
Y = tvNum1.Y,
|
Width = Application.GetMinRealAverage (165),
|
Height = Application.GetMinRealAverage (140),
|
UnSelectedImagePath = "TV/TV2_2.png",
|
SelectedImagePath = "TV/TV2_2_on.png",
|
};
|
NumberView.AddChidren (tvNum2);
|
tvNum2.MouseDownEventHandler += (sender, e) => {
|
tvNum2.IsSelected = true;
|
int RandKey = ran.Next (0, 255);
|
if (!string.IsNullOrEmpty (infraredTV.LinkInfraredMode)) {
|
linkSTB = Newtonsoft.Json.JsonConvert.DeserializeObject<InfraredMode> (CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (infraredTV.LinkInfraredMode)));
|
} else
|
linkSTB = null;
|
if (linkSTB != null) {
|
Control.ControlBytesSend (Command.InfraredControl, linkSTB.SubnetID, linkSTB.DeviceID, new byte [] { Convert.ToByte (linkSTB.Port), linkSTB.LoopID, (byte)InfraredCode_STB.Two, 0, 0, (byte)RandKey });
|
} else
|
Control.ControlBytesSend (Command.InfraredControl, infraredTV.SubnetID, infraredTV.DeviceID, new byte [] { Convert.ToByte (infraredTV.Port), infraredTV.LoopID, (byte)InfraredCode_TV.Two, 0, 0, (byte)RandKey });
|
};
|
tvNum2.MouseUpEventHandler += (sender, e) => {
|
tvNum2.IsSelected = false;
|
};
|
|
Button tvNum3 = new Button () {
|
X = tvNum2.Right + Application.GetRealWidth (50),
|
Y = tvNum1.Y,
|
Width = Application.GetMinRealAverage (165),
|
Height = Application.GetMinRealAverage (140),
|
UnSelectedImagePath = "TV/TV2_3.png",
|
SelectedImagePath = "TV/TV2_3_on.png",
|
};
|
NumberView.AddChidren (tvNum3);
|
tvNum3.MouseDownEventHandler += (sender, e) => {
|
tvNum3.IsSelected = true;
|
int RandKey = ran.Next (0, 255);
|
if (!string.IsNullOrEmpty (infraredTV.LinkInfraredMode)) {
|
linkSTB = Newtonsoft.Json.JsonConvert.DeserializeObject<InfraredMode> (CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (infraredTV.LinkInfraredMode)));
|
} else
|
linkSTB = null;
|
if (linkSTB != null) {
|
Control.ControlBytesSend (Command.InfraredControl, linkSTB.SubnetID, linkSTB.DeviceID, new byte [] { Convert.ToByte (linkSTB.Port), linkSTB.LoopID, (byte)InfraredCode_STB.Three, 0, 0, (byte)RandKey });
|
} else
|
Control.ControlBytesSend (Command.InfraredControl, infraredTV.SubnetID, infraredTV.DeviceID, new byte [] { Convert.ToByte (infraredTV.Port), infraredTV.LoopID, (byte)InfraredCode_TV.Three, 0, 0, (byte)RandKey });
|
};
|
tvNum3.MouseUpEventHandler += (sender, e) => {
|
tvNum3.IsSelected = false;
|
};
|
|
Button tvNum4 = new Button () {
|
X = tvNum3.Right + Application.GetRealWidth (50),
|
Y = tvNum1.Y,
|
Width = Application.GetMinRealAverage (165),
|
Height = Application.GetMinRealAverage (140),
|
UnSelectedImagePath = "TV/TV2_4.png",
|
SelectedImagePath = "TV/TV2_4_on.png",
|
};
|
NumberView.AddChidren (tvNum4);
|
tvNum4.MouseDownEventHandler += (sender, e) => {
|
tvNum4.IsSelected = true;
|
int RandKey = ran.Next (0, 255);
|
if (!string.IsNullOrEmpty (infraredTV.LinkInfraredMode)) {
|
linkSTB = Newtonsoft.Json.JsonConvert.DeserializeObject<InfraredMode> (CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (infraredTV.LinkInfraredMode)));
|
} else
|
linkSTB = null;
|
if (linkSTB != null) {
|
Control.ControlBytesSend (Command.InfraredControl, linkSTB.SubnetID, linkSTB.DeviceID, new byte [] { Convert.ToByte (linkSTB.Port), linkSTB.LoopID, (byte)InfraredCode_STB.Four, 0, 0, (byte)RandKey });
|
} else
|
Control.ControlBytesSend (Command.InfraredControl, infraredTV.SubnetID, infraredTV.DeviceID, new byte [] { Convert.ToByte (infraredTV.Port), infraredTV.LoopID, (byte)InfraredCode_TV.Four, 0, 0, (byte)RandKey });
|
};
|
tvNum4.MouseUpEventHandler += (sender, e) => {
|
tvNum4.IsSelected = false;
|
};
|
|
Button tvNum5 = new Button () {
|
X = tvNum1.X,
|
Y = tvNum1.Bottom + Application.GetRealHeight (40),
|
Width = Application.GetMinRealAverage (165),
|
Height = Application.GetMinRealAverage (140),
|
UnSelectedImagePath = "TV/TV2_5.png",
|
SelectedImagePath = "TV/TV2_5_on.png",
|
};
|
NumberView.AddChidren (tvNum5);
|
tvNum5.MouseDownEventHandler += (sender, e) => {
|
tvNum5.IsSelected = true;
|
int RandKey = ran.Next (0, 255);
|
if (!string.IsNullOrEmpty (infraredTV.LinkInfraredMode)) {
|
linkSTB = Newtonsoft.Json.JsonConvert.DeserializeObject<InfraredMode> (CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (infraredTV.LinkInfraredMode)));
|
} else
|
linkSTB = null;
|
if (linkSTB != null) {
|
Control.ControlBytesSend (Command.InfraredControl, linkSTB.SubnetID, linkSTB.DeviceID, new byte [] { Convert.ToByte (linkSTB.Port), linkSTB.LoopID, (byte)InfraredCode_STB.Five, 0, 0, (byte)RandKey });
|
} else
|
Control.ControlBytesSend (Command.InfraredControl, infraredTV.SubnetID, infraredTV.DeviceID, new byte [] { Convert.ToByte (infraredTV.Port), infraredTV.LoopID, (byte)InfraredCode_TV.Five, 0, 0, (byte)RandKey });
|
};
|
tvNum5.MouseUpEventHandler += (sender, e) => {
|
tvNum5.IsSelected = false;
|
};
|
|
Button tvNum6 = new Button () {
|
X = tvNum2.X,
|
Y = tvNum5.Y,
|
Width = Application.GetMinRealAverage (165),
|
Height = Application.GetMinRealAverage (140),
|
UnSelectedImagePath = "TV/TV2_6.png",
|
SelectedImagePath = "TV/TV2_6_on.png",
|
};
|
NumberView.AddChidren (tvNum6);
|
tvNum6.MouseDownEventHandler += (sender, e) => {
|
tvNum6.IsSelected = true;
|
int RandKey = ran.Next (0, 255);
|
if (!string.IsNullOrEmpty (infraredTV.LinkInfraredMode)) {
|
linkSTB = Newtonsoft.Json.JsonConvert.DeserializeObject<InfraredMode> (CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (infraredTV.LinkInfraredMode)));
|
} else
|
linkSTB = null;
|
if (linkSTB != null) {
|
Control.ControlBytesSend (Command.InfraredControl, linkSTB.SubnetID, linkSTB.DeviceID, new byte [] { Convert.ToByte (linkSTB.Port), linkSTB.LoopID, (byte)InfraredCode_STB.Six, 0, 0, (byte)RandKey });
|
} else
|
Control.ControlBytesSend (Command.InfraredControl, infraredTV.SubnetID, infraredTV.DeviceID, new byte [] { Convert.ToByte (infraredTV.Port), infraredTV.LoopID, (byte)InfraredCode_TV.Six, 0, 0, (byte)RandKey });
|
};
|
tvNum6.MouseUpEventHandler += (sender, e) => {
|
tvNum6.IsSelected = false;
|
};
|
|
Button tvNum7 = new Button () {
|
X = tvNum3.X,
|
Y = tvNum5.Y,
|
Width = Application.GetMinRealAverage (165),
|
Height = Application.GetMinRealAverage (140),
|
UnSelectedImagePath = "TV/TV2_7.png",
|
SelectedImagePath = "TV/TV2_7_on.png",
|
};
|
NumberView.AddChidren (tvNum7);
|
tvNum7.MouseDownEventHandler += (sender, e) => {
|
tvNum7.IsSelected = true;
|
int RandKey = ran.Next (0, 255);
|
if (!string.IsNullOrEmpty (infraredTV.LinkInfraredMode)) {
|
linkSTB = Newtonsoft.Json.JsonConvert.DeserializeObject<InfraredMode> (CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (infraredTV.LinkInfraredMode)));
|
} else
|
linkSTB = null;
|
if (linkSTB != null) {
|
Control.ControlBytesSend (Command.InfraredControl, linkSTB.SubnetID, linkSTB.DeviceID, new byte [] { Convert.ToByte (linkSTB.Port), linkSTB.LoopID, (byte)InfraredCode_STB.Seven, 0, 0, (byte)RandKey });
|
} else
|
Control.ControlBytesSend (Command.InfraredControl, infraredTV.SubnetID, infraredTV.DeviceID, new byte [] { Convert.ToByte (infraredTV.Port), infraredTV.LoopID, (byte)InfraredCode_TV.Seven, 0, 0, (byte)RandKey });
|
};
|
tvNum7.MouseUpEventHandler += (sender, e) => {
|
tvNum7.IsSelected = false;
|
};
|
|
Button tvNum8 = new Button () {
|
X = tvNum4.X,
|
Y = tvNum5.Y,
|
Width = Application.GetMinRealAverage (165),
|
Height = Application.GetMinRealAverage (140),
|
UnSelectedImagePath = "TV/TV2_8.png",
|
SelectedImagePath = "TV/TV2_8_on.png",
|
};
|
NumberView.AddChidren (tvNum8);
|
tvNum8.MouseDownEventHandler += (sender, e) => {
|
tvNum8.IsSelected = true;
|
int RandKey = ran.Next (0, 255);
|
if (!string.IsNullOrEmpty (infraredTV.LinkInfraredMode)) {
|
linkSTB = Newtonsoft.Json.JsonConvert.DeserializeObject<InfraredMode> (CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (infraredTV.LinkInfraredMode)));
|
} else
|
linkSTB = null;
|
if (linkSTB != null) {
|
Control.ControlBytesSend (Command.InfraredControl, linkSTB.SubnetID, linkSTB.DeviceID, new byte [] { Convert.ToByte (linkSTB.Port), linkSTB.LoopID, (byte)InfraredCode_STB.Eight, 0, 0, (byte)RandKey });
|
} else
|
Control.ControlBytesSend (Command.InfraredControl, infraredTV.SubnetID, infraredTV.DeviceID, new byte [] { Convert.ToByte (infraredTV.Port), infraredTV.LoopID, (byte)InfraredCode_TV.Eight, 0, 0, (byte)RandKey });
|
};
|
tvNum8.MouseUpEventHandler += (sender, e) => {
|
tvNum8.IsSelected = false;
|
};
|
|
Button tvNum9 = new Button () {
|
X = tvNum5.X,
|
Y = tvNum5.Bottom + Application.GetRealHeight (40),
|
Width = Application.GetMinRealAverage (165),
|
Height = Application.GetMinRealAverage (140),
|
UnSelectedImagePath = "TV/TV2_9.png",
|
SelectedImagePath = "TV/TV2_9_on.png",
|
};
|
NumberView.AddChidren (tvNum9);
|
tvNum9.MouseDownEventHandler += (sender, e) => {
|
tvNum9.IsSelected = true;
|
int RandKey = ran.Next (0, 255);
|
if (!string.IsNullOrEmpty (infraredTV.LinkInfraredMode)) {
|
linkSTB = Newtonsoft.Json.JsonConvert.DeserializeObject<InfraredMode> (CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (infraredTV.LinkInfraredMode)));
|
} else
|
linkSTB = null;
|
if (linkSTB != null) {
|
Control.ControlBytesSend (Command.InfraredControl, linkSTB.SubnetID, linkSTB.DeviceID, new byte [] { Convert.ToByte (linkSTB.Port), linkSTB.LoopID, (byte)InfraredCode_STB.Nine, 0, 0, (byte)RandKey });
|
} else
|
Control.ControlBytesSend (Command.InfraredControl, infraredTV.SubnetID, infraredTV.DeviceID, new byte [] { Convert.ToByte (infraredTV.Port), infraredTV.LoopID, (byte)InfraredCode_TV.Nine, 0, 0, (byte)RandKey });
|
};
|
tvNum9.MouseUpEventHandler += (sender, e) => {
|
tvNum9.IsSelected = false;
|
};
|
|
Button tvNum0 = new Button () {
|
X = tvNum6.X,
|
Y = tvNum9.Y,
|
Width = Application.GetMinRealAverage (273),
|
Height = Application.GetMinRealAverage (140),
|
UnSelectedImagePath = "TV/TV2_0.png",
|
SelectedImagePath = "TV/TV2_0_on.png",
|
};
|
NumberView.AddChidren (tvNum0);
|
tvNum0.MouseDownEventHandler += (sender, e) => {
|
tvNum0.IsSelected = true;
|
int RandKey = ran.Next (0, 255);
|
if (!string.IsNullOrEmpty (infraredTV.LinkInfraredMode)) {
|
linkSTB = Newtonsoft.Json.JsonConvert.DeserializeObject<InfraredMode> (CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (infraredTV.LinkInfraredMode)));
|
} else
|
linkSTB = null;
|
if (linkSTB != null) {
|
Control.ControlBytesSend (Command.InfraredControl, linkSTB.SubnetID, linkSTB.DeviceID, new byte [] { Convert.ToByte (linkSTB.Port), linkSTB.LoopID, (byte)InfraredCode_STB.Zero, 0, 0, (byte)RandKey });
|
} else
|
Control.ControlBytesSend (Command.InfraredControl, infraredTV.SubnetID, infraredTV.DeviceID, new byte [] { Convert.ToByte (infraredTV.Port), infraredTV.LoopID, (byte)InfraredCode_TV.Zero, 0, 0, (byte)RandKey });
|
};
|
tvNum0.MouseUpEventHandler += (sender, e) => {
|
tvNum0.IsSelected = false;
|
};
|
|
Button tv_ok = new Button () {
|
X = tvNum0.Right + Application.GetRealHeight (50),
|
Y = tvNum0.Y,
|
Width = Application.GetMinRealAverage (273),
|
Height = Application.GetMinRealAverage (140),
|
UnSelectedImagePath = "TV/TV2_OK.png",
|
SelectedImagePath = "TV/TV2_OK_on.png",
|
};
|
NumberView.AddChidren (tv_ok);
|
tv_ok.MouseDownEventHandler += (sender, e) => {
|
tv_ok.IsSelected = true;
|
int RandKey = ran.Next (0, 255);
|
if (!string.IsNullOrEmpty (infraredTV.LinkInfraredMode)) {
|
linkSTB = Newtonsoft.Json.JsonConvert.DeserializeObject<InfraredMode> (CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (infraredTV.LinkInfraredMode)));
|
} else
|
linkSTB = null;
|
if (linkSTB != null) {
|
Control.ControlBytesSend (Command.InfraredControl, linkSTB.SubnetID, linkSTB.DeviceID, new byte [] { Convert.ToByte (linkSTB.Port), linkSTB.LoopID, (byte)InfraredCode_STB.Confrim, 0, 0, (byte)RandKey });
|
} else
|
Control.ControlBytesSend (Command.InfraredControl, infraredTV.SubnetID, infraredTV.DeviceID, new byte [] { Convert.ToByte (infraredTV.Port), infraredTV.LoopID, (byte)InfraredCode_TV.Confrim, 0, 0, (byte)RandKey });
|
};
|
tv_ok.MouseUpEventHandler += (sender, e) => {
|
tv_ok.IsSelected = false;
|
};
|
}
|
}
|
}
|