| | |
| | | #endregion |
| | | |
| | | #region 区域变量 |
| | | Function function; |
| | | Function device; |
| | | Button btnCollection_Out; |
| | | Button btnFunctionName_Out; |
| | | Button btnFromFloor_Out; |
| | |
| | | public StbPage(Function func) |
| | | { |
| | | bodyView = this; |
| | | function = func; |
| | | device = func; |
| | | } |
| | | |
| | | |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, |
| | | Text = function.name, |
| | | Text = device.name, |
| | | }; |
| | | controlView.AddChidren(btnFunctionName); |
| | | |
| | |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = function.GetRoomListName() |
| | | Text = device.GetRoomListName() |
| | | }; |
| | | controlView.AddChidren(btnFromFoorAndRoom); |
| | | |
| | |
| | | Height = Application.GetMinRealAverage(40), |
| | | SelectedImagePath = "Collection/CollectionIcon.png", |
| | | UnSelectedImagePath = "Collection/CollectionGrayIcon.png", |
| | | IsSelected = function.collect |
| | | IsSelected = device.collect |
| | | }; |
| | | controlView.AddChidren(btnCollection); |
| | | //2020-12-16 如果是成员隐藏收藏功能 |
| | |
| | | UnSelectedImagePath = "FunctionIcon/AC/More.png", |
| | | }; |
| | | controlView.AddChidren(btnMore); |
| | | btnMore.MouseUpEventHandler = (sender, e) => { |
| | | LoadDialog_IrMoreView(); |
| | | }; |
| | | |
| | | btnPower = new Button() |
| | | { |
| | |
| | | |
| | | LoadEventList(); |
| | | |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.STB)).LoadTopView_FunctionTop(function, actionRefresh); |
| | | DriverLayer.Control.Ins.SendReadCommand(function); |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.STB)).LoadTopView_FunctionTop(device, actionRefresh); |
| | | Control.Ins.SendReadCommand(device); |
| | | |
| | | } |
| | | |
| | |
| | | { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add($"number_{index}", ""); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | } |
| | | }; |
| | | btn.MouseDownEventHandler = (sender, e) => { |
| | |
| | | |
| | | //回退刷新信息事件 |
| | | actionRefresh = () => { |
| | | btnFunctionName.Text = btnFunctionName_Out.Text = function.name; |
| | | btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName(); |
| | | function.UpdataFuncitonInfo(); |
| | | btnFunctionName.Text = btnFunctionName_Out.Text = device.name; |
| | | btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = device.GetRoomListName(); |
| | | device.UpdataFuncitonInfo(); |
| | | }; |
| | | } |
| | | |
| | |
| | | void LoadCollectionEvent() |
| | | { |
| | | btnCollection.MouseUpEventHandler += (sender, e) => { |
| | | btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; |
| | | function.CollectFunction(); |
| | | btnCollection.IsSelected = device.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; |
| | | device.CollectFunction(); |
| | | }; |
| | | } |
| | | |
| | |
| | | { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add("av_tv", ""); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | } |
| | | }; |
| | | btnChlPlus.MouseUpEventHandler = (sender, e) => |
| | |
| | | { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add("ch+", ""); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | } |
| | | }; |
| | | btnChlReduce.MouseUpEventHandler = (sender, e) => |
| | |
| | | { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add("ch-", ""); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | } |
| | | }; |
| | | btnVolPlus.MouseUpEventHandler = (sender, e) => |
| | |
| | | { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add("volume+", ""); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | } |
| | | }; |
| | | btnVolReduce.MouseUpEventHandler = (sender, e) => |
| | |
| | | { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add("volume-", ""); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | } |
| | | }; |
| | | btnBack.MouseUpEventHandler = (sender, e) => |
| | |
| | | { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add("return", ""); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | } |
| | | }; |
| | | |
| | |
| | | { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add("menu", ""); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | } |
| | | }; |
| | | btn123.MouseUpEventHandler = (sender, e) => |
| | |
| | | { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add("mute", ""); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | } |
| | | }; |
| | | btnPower.MouseUpEventHandler = (sender, e) => |
| | |
| | | { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add("on_off", ""); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | } |
| | | }; |
| | | |
| | |
| | | { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add("menu", ""); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | } |
| | | }; |
| | | btnTopMenuUp.MouseUpEventHandler = (sender, e) => { |
| | |
| | | { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add("up", ""); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | } |
| | | }; |
| | | btnTopMenuLeft.MouseUpEventHandler = (sender, e) => { |
| | |
| | | { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add("left", ""); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | } |
| | | }; |
| | | btnTopMenuRight.MouseUpEventHandler = (sender, e) => { |
| | |
| | | { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add("right", ""); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | } |
| | | }; |
| | | btnTopMenuDown.MouseUpEventHandler = (sender, e) => { |
| | |
| | | { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add("down", ""); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | } |
| | | }; |
| | | btnOk.MouseUpEventHandler = (sender, e) => { |
| | |
| | | { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add("ok", ""); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | } |
| | | }; |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 加载额外对红外按钮界面 |
| | | /// </summary> |
| | | void LoadDialog_IrMoreView() |
| | | { |
| | | Dialog dialog = new Dialog(); |
| | | |
| | | var div = new FrameLayout(); |
| | | dialog.AddChidren(div); |
| | | div.MouseUpEventHandler = (sender, e) => { |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | var bodyView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(427),//667 |
| | | Height = Application.GetRealHeight(240), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | div.AddChidren(bodyView); |
| | | |
| | | var contentView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(16), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(296 + 200), |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | | |
| | | var row = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(60), |
| | | Width = Application.GetRealWidth(296), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | }; |
| | | contentView.AddChidren(row); |
| | | |
| | | int index = 0; |
| | | List<FunctionAttributes> attrList = new List<FunctionAttributes>(); |
| | | attrList.AddRange(device.attributes); |
| | | attrList.Add(new FunctionAttributes() |
| | | { |
| | | key = "+", |
| | | }); |
| | | |
| | | foreach (var attr in attrList) |
| | | { |
| | | if (attr.key == "up" |
| | | || attr.key == "down" |
| | | || attr.key == "right" |
| | | || attr.key == "left" |
| | | || attr.key == "zoom+" |
| | | || attr.key == "zoom-" |
| | | || attr.key == "volume+" |
| | | || attr.key == "volume-" |
| | | || attr.key == "back" |
| | | || attr.key == "menu" |
| | | || attr.key == FunctionAttributeKey.OnOff |
| | | ) |
| | | { |
| | | continue; |
| | | } |
| | | if (index != 0 && index % 3 == 0) |
| | | { |
| | | row = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(56), |
| | | Width = Application.GetRealWidth(296), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | }; |
| | | contentView.AddChidren(row); |
| | | } |
| | | if (attr.key == "+") |
| | | { |
| | | var addView = new FrameLayout() |
| | | { |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetRealWidth(88), |
| | | Height = Application.GetRealHeight(40), |
| | | Radius = (uint)Application.GetRealHeight(18), |
| | | BorderColor = CSS_Color.PromptingColor1, |
| | | BorderWidth = (uint)Application.GetRealWidth(2), |
| | | }; |
| | | |
| | | |
| | | if (index % 3 == 1) |
| | | { |
| | | addView.Gravity = Gravity.Center; |
| | | } |
| | | else if (index % 3 == 2) |
| | | { |
| | | addView.X = Application.GetRealWidth(208); |
| | | } |
| | | row.AddChidren(addView); |
| | | |
| | | var btnAdd = new Button() |
| | | { |
| | | Gravity = Gravity.Center, |
| | | UnSelectedImagePath = "Public/PlusSignIcon.png", |
| | | Width = Application.GetRealWidth(32), |
| | | Height = Application.GetRealWidth(32), |
| | | }; |
| | | addView.AddChidren(btnAdd); |
| | | |
| | | btnAdd.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | Action action = () => { |
| | | LoadDialog_IrMoreView(); |
| | | }; |
| | | var addButton = new AcControlPage_AddIrButton(action); |
| | | MainPage.BasePageView.AddChidren(addButton); |
| | | addButton.Show(device); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | | |
| | | var btn = new Button() |
| | | { |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetRealWidth(88), |
| | | Height = Application.GetRealHeight(40), |
| | | Radius = (uint)Application.GetRealHeight(18), |
| | | BorderColor = CSS_Color.PromptingColor1, |
| | | BorderWidth = (uint)Application.GetRealWidth(2), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | SelectedTextColor = CSS_Color.MainBackgroundColor, |
| | | SelectedBackgroundColor = CSS_Color.MainColor, |
| | | }; |
| | | if (attr.value.Count > 0) |
| | | { |
| | | btn.Text = attr.value[0]; |
| | | } |
| | | if (index % 3 == 1) |
| | | { |
| | | btn.Gravity = Gravity.Center; |
| | | } |
| | | else if (index % 3 == 2) |
| | | { |
| | | btn.X = Application.GetRealWidth(208); |
| | | } |
| | | row.AddChidren(btn); |
| | | |
| | | btn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(attr.key, ""); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btn.IsSelected = false; |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | | |
| | | } |
| | | |
| | | index++; |
| | | } |
| | | |
| | | dialog.Show(); |
| | | } |
| | | |
| | | } |
| | | } |