using System; using System.Collections.Generic; using Shared.SimpleControl.Phone; using System.Text; namespace Shared.SimpleControl.Phone { public class UserTVCustomChannel : FrameLayout { FrameLayout LongPressFrameLayout = new FrameLayout (); public void Show (InfraredMode infrared) { #region bodyView FrameLayout BodyView = new FrameLayout () { BackgroundColor = SkinStyle.Current.MainColor }; this.AddChidren (BodyView); VerticalScrolViewLayout tvBodyView = new VerticalScrolViewLayout (); BodyView.AddChidren (tvBodyView); FrameLayout tvRowView = null; if (infrared.InfraredCustomChannel == null) { infrared.InfraredCustomChannel = new List (); } //infraredTV.InfraredCustomChannel.Add (new InfraredCustomChannel () { ChannelName = Language.StringByID(R.MyInternationalizationString.AddButton)}); for (int index = 0; index <= infrared.InfraredCustomChannel.Count; index++) { if (index % 2 == 0) { tvRowView = new FrameLayout () { Height = Application.GetRealHeight (250), Width = Application.GetRealWidth (640), }; tvBodyView.AddChidren (tvRowView); } var tvView = new FrameLayout () { Width = Application.GetRealWidth (320), }; tvRowView.AddChidren (tvView); if (index % 2 == 1) { tvView.X = Application.GetRealWidth (320); } if (index == infrared.InfraredCustomChannel.Count) { tvView.BackgroundImagePath = "Item/SceneAdd.png"; tvView.MouseUpEventHandler += (sender, e) => { var tv3 = new UserTVAddCustomChannel (); tv3.Show (); tv3.Show (infrared, MyRefresh); }; } else { InfraredCustomChannel icc = infrared.InfraredCustomChannel [index]; var btnBGC = new Button () { UnSelectedImagePath = icc.ChannelIconPath, TextAlignment = TextAlignment.BottomCenter, Text = icc.ChannelName, TextColor = SkinStyle.Current.TextColor1, TextSize = 15, Tag = index, }; tvView.AddChidren (btnBGC); btnBGC.MouseUpEventHandler += (sender, e) => { infrared.InfraredCustomChannel [int.Parse (btnBGC.Tag.ToString ())].Send (infrared.SubnetID, infrared.DeviceID, infrared.InfraredType, infrared.IsUniversalSwitch); }; btnBGC.MouseLongEventHandler += (sender, e) => { Alert alert = new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.SureDelete), Language.StringByID (R.MyInternationalizationString.Cancel), Language.StringByID (R.MyInternationalizationString.Confrim)); alert.Show (); alert.ResultEventHandler += (sender2, e2) => { if (e2) { infrared.InfraredCustomChannel.Remove (icc); IO.FileUtils.SaveEquipmentMessage (infrared, infrared.LoopID.ToString ()); MyRefresh (infrared); } }; }; } } #endregion FrameLayout bottomNull = new FrameLayout () { BackgroundColor = SkinStyle.Current.MainColor, Height = Application.GetRealHeight (70), Y = Application.GetRealHeight (910), }; AddChidren (bottomNull); } public void MyRefresh (InfraredMode infraredTV) { this.RemoveAll (); Show (infraredTV); } } }