using System;
|
namespace Shared.SimpleControl.Phone
|
{
|
public class UserTVNumberView : FrameLayout
|
{
|
|
public void Show (InfraredMode infrared)
|
{
|
this.BackgroundColor = SkinStyle.Current.MainColor;
|
Random ran = new Random ();
|
|
Button tv_1 = new Button () {
|
X = Application.GetRealWidth (45),
|
Y = Application.GetRealHeight (90),
|
Width = Application.GetMinRealAverage (151),
|
Height = Application.GetMinRealAverage (132),
|
UnSelectedImagePath = "TV/TV2_1.png",
|
SelectedImagePath = "TV/TV2_1_on.png",
|
};
|
this.AddChidren (tv_1);
|
tv_1.MouseDownEventHandler += (sender, e) => {
|
tv_1.IsSelected = true;
|
new System.Threading.Thread (() => {
|
System.Threading.Thread.Sleep (300);
|
Application.RunOnMainThread (() => {
|
tv_1.IsSelected = false;
|
});
|
}) { IsBackground = true }.Start ();
|
try {
|
byte keyId = infrared.InfraredType == InfraredType.TV ? (byte)TVKeys.One : (byte)STBKeys.One;
|
if (infrared.IsUniversalSwitch) {
|
var uvId = infrared.infraredFuntionList.Find ((obj) => obj.functionCode == keyId).universalSwitchId;
|
Control.ControlBytesSend (Command.SetCommonSwitch, infrared.SubnetID, infrared.DeviceID, new byte [] { uvId, 255 });
|
} else {
|
int RandKey = ran.Next (0, 255);
|
Control.ControlBytesSend (Command.InfraredControl, infrared.SubnetID, infrared.DeviceID, new byte [] { Convert.ToByte (infrared.Port), infrared.LoopID, keyId, 0, 0, (byte)RandKey });
|
}
|
} catch { }
|
};
|
|
Button tv_2 = new Button () {
|
X = Application.GetRealWidth (248),
|
Y = Application.GetRealHeight (90),
|
Width = Application.GetMinRealAverage (151),
|
Height = Application.GetMinRealAverage (132),
|
UnSelectedImagePath = "TV/TV2_2.png",
|
SelectedImagePath = "TV/TV2_2_on.png",
|
};
|
this.AddChidren (tv_2);
|
tv_2.MouseDownEventHandler += (sender, e) => {
|
((Button) sender).IsSelected = true;
|
new System.Threading.Thread (() => {
|
System.Threading.Thread.Sleep (300);
|
Application.RunOnMainThread (() => {
|
((Button)sender).IsSelected = false;
|
});
|
}) { IsBackground = true }.Start ();
|
try {
|
byte keyId = infrared.InfraredType == InfraredType.TV ? (byte)TVKeys.Two : (byte)STBKeys.Two;
|
if (infrared.IsUniversalSwitch) {
|
var uvId = infrared.infraredFuntionList.Find ((obj) => obj.functionCode == keyId).universalSwitchId;
|
Control.ControlBytesSend (Command.SetCommonSwitch, infrared.SubnetID, infrared.DeviceID, new byte [] { uvId, 255 });
|
} else {
|
int RandKey = ran.Next (0, 255);
|
Control.ControlBytesSend (Command.InfraredControl, infrared.SubnetID, infrared.DeviceID, new byte [] { Convert.ToByte (infrared.Port), infrared.LoopID, keyId, 0, 0, (byte)RandKey });
|
}
|
} catch { }
|
|
};
|
|
Button tv_3 = new Button () {
|
X = Application.GetRealWidth (450),
|
Y = Application.GetRealHeight (90),
|
Width = Application.GetMinRealAverage (151),
|
Height = Application.GetMinRealAverage (132),
|
UnSelectedImagePath = "TV/TV2_3.png",
|
SelectedImagePath = "TV/TV2_3_on.png",
|
};
|
this.AddChidren (tv_3);
|
tv_3.MouseDownEventHandler += (sender, e) => {
|
((Button)sender).IsSelected = true;
|
new System.Threading.Thread (() => {
|
System.Threading.Thread.Sleep (300);
|
Application.RunOnMainThread (() => {
|
((Button)sender).IsSelected = false;
|
});
|
}) { IsBackground = true }.Start ();
|
try {
|
byte keyId = infrared.InfraredType == InfraredType.TV ? (byte)TVKeys.Three : (byte)STBKeys.Three;
|
if (infrared.IsUniversalSwitch) {
|
var uvId = infrared.infraredFuntionList.Find ((obj) => obj.functionCode == keyId).universalSwitchId;
|
Control.ControlBytesSend (Command.SetCommonSwitch, infrared.SubnetID, infrared.DeviceID, new byte [] { uvId, 255 });
|
} else {
|
int RandKey = ran.Next (0, 255);
|
Control.ControlBytesSend (Command.InfraredControl, infrared.SubnetID, infrared.DeviceID, new byte [] { Convert.ToByte (infrared.Port), infrared.LoopID, keyId, 0, 0, (byte)RandKey });
|
}
|
} catch { }
|
};
|
|
Button tv_4 = new Button () {
|
X = Application.GetRealWidth (45),
|
Y = Application.GetRealHeight (287),
|
Width = Application.GetMinRealAverage (151),
|
Height = Application.GetMinRealAverage (132),
|
UnSelectedImagePath = "TV/TV2_4.png",
|
SelectedImagePath = "TV/TV2_4_on.png",
|
};
|
this.AddChidren (tv_4);
|
tv_4.MouseDownEventHandler += (sender, e) => {
|
((Button)sender).IsSelected = true;
|
new System.Threading.Thread (() => {
|
System.Threading.Thread.Sleep (300);
|
Application.RunOnMainThread (() => {
|
((Button)sender).IsSelected = false;
|
});
|
}) { IsBackground = true }.Start ();
|
try {
|
byte keyId = infrared.InfraredType == InfraredType.TV ? (byte)TVKeys.Four : (byte)STBKeys.Four;
|
if (infrared.IsUniversalSwitch) {
|
var uvId = infrared.infraredFuntionList.Find ((obj) => obj.functionCode == keyId).universalSwitchId;
|
Control.ControlBytesSend (Command.SetCommonSwitch, infrared.SubnetID, infrared.DeviceID, new byte [] { uvId, 255 });
|
} else {
|
int RandKey = ran.Next (0, 255);
|
Control.ControlBytesSend (Command.InfraredControl, infrared.SubnetID, infrared.DeviceID, new byte [] { Convert.ToByte (infrared.Port), infrared.LoopID, keyId, 0, 0, (byte)RandKey });
|
}
|
} catch { }
|
};
|
|
Button tv_5 = new Button () {
|
X = Application.GetRealWidth (248),
|
Y = Application.GetRealHeight (287),
|
Width = Application.GetMinRealAverage (151),
|
Height = Application.GetMinRealAverage (132),
|
UnSelectedImagePath = "TV/TV2_5.png",
|
SelectedImagePath = "TV/TV2_5_on.png",
|
};
|
this.AddChidren (tv_5);
|
tv_5.MouseDownEventHandler += (sender, e) => {
|
((Button)sender).IsSelected = true;
|
new System.Threading.Thread (() => {
|
System.Threading.Thread.Sleep (300);
|
Application.RunOnMainThread (() => {
|
((Button)sender).IsSelected = false;
|
});
|
}) { IsBackground = true }.Start ();
|
try {
|
byte keyId = infrared.InfraredType == InfraredType.TV ? (byte)TVKeys.Five : (byte)STBKeys.Five;
|
if (infrared.IsUniversalSwitch) {
|
var uvId = infrared.infraredFuntionList.Find ((obj) => obj.functionCode == keyId).universalSwitchId;
|
Control.ControlBytesSend (Command.SetCommonSwitch, infrared.SubnetID, infrared.DeviceID, new byte [] { uvId, 255 });
|
} else {
|
int RandKey = ran.Next (0, 255);
|
Control.ControlBytesSend (Command.InfraredControl, infrared.SubnetID, infrared.DeviceID, new byte [] { Convert.ToByte (infrared.Port), infrared.LoopID, keyId, 0, 0, (byte)RandKey });
|
}
|
} catch { }
|
};
|
|
Button tv_6 = new Button () {
|
X = Application.GetRealWidth (450),
|
Y = Application.GetRealHeight (287),
|
Width = Application.GetMinRealAverage (151),
|
Height = Application.GetMinRealAverage (132),
|
UnSelectedImagePath = "TV/TV2_6.png",
|
SelectedImagePath = "TV/TV2_6_on.png",
|
};
|
this.AddChidren (tv_6);
|
tv_6.MouseDownEventHandler += (sender, e) => {
|
((Button)sender).IsSelected = true;
|
new System.Threading.Thread (() => {
|
System.Threading.Thread.Sleep (300);
|
Application.RunOnMainThread (() => {
|
((Button)sender).IsSelected = false;
|
});
|
}) { IsBackground = true }.Start ();
|
try {
|
byte keyId = infrared.InfraredType == InfraredType.TV ? (byte)TVKeys.Six : (byte)STBKeys.Six;
|
if (infrared.IsUniversalSwitch) {
|
var uvId = infrared.infraredFuntionList.Find ((obj) => obj.functionCode == keyId).universalSwitchId;
|
Control.ControlBytesSend (Command.SetCommonSwitch, infrared.SubnetID, infrared.DeviceID, new byte [] { uvId, 255 });
|
} else {
|
int RandKey = ran.Next (0, 255);
|
Control.ControlBytesSend (Command.InfraredControl, infrared.SubnetID, infrared.DeviceID, new byte [] { Convert.ToByte (infrared.Port), infrared.LoopID, keyId, 0, 0, (byte)RandKey });
|
}
|
} catch { }
|
};
|
|
|
Button tv_7 = new Button () {
|
X = Application.GetRealWidth (45),
|
Y = Application.GetRealHeight (483),
|
Width = Application.GetMinRealAverage (151),
|
Height = Application.GetMinRealAverage (132),
|
UnSelectedImagePath = "TV/TV2_7.png",
|
SelectedImagePath = "TV/TV2_7_on.png",
|
};
|
this.AddChidren (tv_7);
|
tv_7.MouseDownEventHandler += (sender, e) => {
|
((Button)sender).IsSelected = true;
|
new System.Threading.Thread (() => {
|
System.Threading.Thread.Sleep (300);
|
Application.RunOnMainThread (() => {
|
((Button)sender).IsSelected = false;
|
});
|
}) { IsBackground = true }.Start ();
|
try {
|
byte keyId = infrared.InfraredType == InfraredType.TV ? (byte)TVKeys.Seven : (byte)STBKeys.Seven;
|
if (infrared.IsUniversalSwitch) {
|
var uvId = infrared.infraredFuntionList.Find ((obj) => obj.functionCode == keyId).universalSwitchId;
|
Control.ControlBytesSend (Command.SetCommonSwitch, infrared.SubnetID, infrared.DeviceID, new byte [] { uvId, 255 });
|
} else {
|
int RandKey = ran.Next (0, 255);
|
Control.ControlBytesSend (Command.InfraredControl, infrared.SubnetID, infrared.DeviceID, new byte [] { Convert.ToByte (infrared.Port), infrared.LoopID, keyId, 0, 0, (byte)RandKey });
|
}
|
} catch { }
|
};
|
|
Button tv_8 = new Button () {
|
X = Application.GetRealWidth (248),
|
Y = Application.GetRealHeight (483),
|
Width = Application.GetMinRealAverage (151),
|
Height = Application.GetMinRealAverage (132),
|
UnSelectedImagePath = "TV/TV2_8.png",
|
SelectedImagePath = "TV/TV2_8_on.png",
|
};
|
this.AddChidren (tv_8);
|
tv_8.MouseDownEventHandler += (sender, e) => {
|
((Button)sender).IsSelected = true;
|
new System.Threading.Thread (() => {
|
System.Threading.Thread.Sleep (300);
|
Application.RunOnMainThread (() => {
|
((Button)sender).IsSelected = false;
|
});
|
}) { IsBackground = true }.Start ();
|
try {
|
byte keyId = infrared.InfraredType == InfraredType.TV ? (byte)TVKeys.Eight : (byte)STBKeys.Eight;
|
if (infrared.IsUniversalSwitch) {
|
var uvId = infrared.infraredFuntionList.Find ((obj) => obj.functionCode == keyId).universalSwitchId;
|
Control.ControlBytesSend (Command.SetCommonSwitch, infrared.SubnetID, infrared.DeviceID, new byte [] { uvId, 255 });
|
} else {
|
int RandKey = ran.Next (0, 255);
|
Control.ControlBytesSend (Command.InfraredControl, infrared.SubnetID, infrared.DeviceID, new byte [] { Convert.ToByte (infrared.Port), infrared.LoopID, keyId, 0, 0, (byte)RandKey });
|
}
|
} catch { }
|
};
|
|
Button tv_9 = new Button () {
|
X = Application.GetRealWidth (450),
|
Y = Application.GetRealHeight (483),
|
Width = Application.GetMinRealAverage (151),
|
Height = Application.GetMinRealAverage (132),
|
UnSelectedImagePath = "TV/TV2_9.png",
|
SelectedImagePath = "TV/TV2_9_on.png",
|
};
|
this.AddChidren (tv_9);
|
tv_9.MouseDownEventHandler += (sender, e) => {
|
((Button)sender).IsSelected = true;
|
new System.Threading.Thread (() => {
|
System.Threading.Thread.Sleep (300);
|
Application.RunOnMainThread (() => {
|
((Button)sender).IsSelected = false;
|
});
|
}) { IsBackground = true }.Start ();
|
try {
|
byte keyId = infrared.InfraredType == InfraredType.TV ? (byte)TVKeys.Nine : (byte)STBKeys.Nine;
|
if (infrared.IsUniversalSwitch) {
|
var uvId = infrared.infraredFuntionList.Find ((obj) => obj.functionCode == keyId).universalSwitchId;
|
Control.ControlBytesSend (Command.SetCommonSwitch, infrared.SubnetID, infrared.DeviceID, new byte [] { uvId, 255 });
|
} else {
|
int RandKey = ran.Next (0, 255);
|
Control.ControlBytesSend (Command.InfraredControl, infrared.SubnetID, infrared.DeviceID, new byte [] { Convert.ToByte (infrared.Port), infrared.LoopID, keyId, 0, 0, (byte)RandKey });
|
}
|
} catch { }
|
};
|
|
Button tv_0 = new Button () {
|
X = Application.GetRealWidth (50),
|
Y = Application.GetRealHeight (680),
|
Width = Application.GetMinRealAverage (232),
|
Height = Application.GetMinRealAverage (132),
|
UnSelectedImagePath = "TV/TV2_0.png",
|
SelectedImagePath = "TV/TV2_0_on.png",
|
};
|
this.AddChidren (tv_0);
|
tv_0.MouseDownEventHandler += (sender, e) => {
|
tv_0.IsSelected = true;
|
((Button)sender).IsSelected = true;
|
new System.Threading.Thread (() => {
|
System.Threading.Thread.Sleep (300);
|
Application.RunOnMainThread (() => {
|
((Button)sender).IsSelected = false;
|
});
|
}) { IsBackground = true }.Start ();
|
try {
|
byte keyId = infrared.InfraredType == InfraredType.TV ? (byte)TVKeys.Zero : (byte)STBKeys.Zero;
|
if (infrared.IsUniversalSwitch) {
|
var uvId = infrared.infraredFuntionList.Find ((obj) => obj.functionCode == keyId).universalSwitchId;
|
Control.ControlBytesSend (Command.SetCommonSwitch, infrared.SubnetID, infrared.DeviceID, new byte [] { uvId, 255 });
|
} else {
|
int RandKey = ran.Next (0, 255);
|
Control.ControlBytesSend (Command.InfraredControl, infrared.SubnetID, infrared.DeviceID, new byte [] { Convert.ToByte (infrared.Port), infrared.LoopID, keyId, 0, 0, (byte)RandKey });
|
}
|
} catch { }
|
};
|
|
Button tv_ok = new Button () {
|
X = Application.GetRealWidth (370),
|
Y = Application.GetRealHeight (680),
|
Width = Application.GetMinRealAverage (232),
|
Height = Application.GetMinRealAverage (132),
|
UnSelectedImagePath = "TV/TV2_OK.png",
|
SelectedImagePath = "TV/TV2_OK_on.png",
|
};
|
this.AddChidren (tv_ok);
|
tv_ok.MouseDownEventHandler += (sender, e) => {
|
((Button) sender).IsSelected = true;
|
new System.Threading.Thread (() => {
|
System.Threading.Thread.Sleep (300);
|
Application.RunOnMainThread (() => {
|
((Button)sender).IsSelected = false;
|
});
|
}) { IsBackground = true }.Start ();
|
try {
|
byte keyId = infrared.InfraredType == InfraredType.TV ? (byte)TVKeys.OK : (byte)STBKeys.OK;
|
if (infrared.IsUniversalSwitch) {
|
var uvId = infrared.infraredFuntionList.Find ((obj) => obj.functionCode == keyId).universalSwitchId;
|
Control.ControlBytesSend (Command.SetCommonSwitch, infrared.SubnetID, infrared.DeviceID, new byte [] { uvId, 255 });
|
} else {
|
int RandKey = ran.Next (0, 255);
|
Control.ControlBytesSend (Command.InfraredControl, infrared.SubnetID, infrared.DeviceID, new byte [] { Convert.ToByte (infrared.Port), infrared.LoopID, keyId, 0, 0, (byte)RandKey });
|
}
|
} catch { }
|
};
|
|
FrameLayout bottomNull = new FrameLayout () {
|
BackgroundColor = SkinStyle.Current.MainColor,
|
Height = Application.GetRealHeight (70),
|
Y = Application.GetRealHeight (910),
|
};
|
AddChidren (bottomNull);
|
|
}
|
}
|
}
|