| | |
| | | using HDL_ON.DriverLayer; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using HDL_ON.UI.Music; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | public partial class FunctionControlZone |
| | | { |
| | | // /// <summary> |
| | | // /// 更新开关状态 |
| | | // /// </summary> |
| | | // /// <param name="upfunc"></param> |
| | | // public static void UpdataOnOffState(Function upfunc) |
| | | // { |
| | | // if(bodyDiv!= null) |
| | | // { |
| | | // Application.RunOnMainThread(() => { |
| | | // if(bodyDiv.Tag.ToString() == upfunc.sid) |
| | | // { |
| | | // for (var o = 0; o < bodyDiv.ChildrenCount; o++) |
| | | // { |
| | | // if (bodyDiv.GetChildren(o).GetType() == typeof(Button)) |
| | | // { |
| | | // var btn = bodyDiv.GetChildren(o) as Button; |
| | | // if (btn.Tag != null) |
| | | // { |
| | | // if (btn.Tag.ToString() == upfunc.sid + "_Switch")// + "_DimmerBar") |
| | | // { |
| | | // btn.IsSelected = upfunc.trait_on_off.curValue.ToString() == "on"; |
| | | // } |
| | | // } |
| | | // } |
| | | // else if (bodyDiv.GetChildren(o).GetType() == typeof(DiyImageSeekBar)) |
| | | // { |
| | | // var btn = bodyDiv.GetChildren(o) as DiyImageSeekBar; |
| | | // if (btn.Tag != null) |
| | | // { |
| | | // if (btn.Tag.ToString() == upfunc.sid + "_DimmerBar") |
| | | // { |
| | | // btn.Progress = Convert.ToInt32(upfunc.GetAttrState(FunctionAttributeKey.Brightness)); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | // } |
| | | // }); |
| | | // } |
| | | // } |
| | | /// <summary> |
| | | /// 更新在线状态 |
| | | /// </summary> |
| | |
| | | } |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | |
| | | if(SPK.NotStatusSpkList.Contains( function.spk )) |
| | | { |
| | | new System.Threading.Thread(() => { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => { |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | }); |
| | | }) { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | |
| | | #endregion |
| | | |
| | | |
| | | /// <summary> |
| | | /// 加载晾衣架控制事件 |
| | | /// </summary> |
| | | void LoadEvent_ControlClothesHanger(Function function, Button btnUp, Button btnDown) |
| | | { |
| | | btnUp.MouseDownEventHandler = (sender, e) => |
| | | { |
| | | btnUp.IsSelected = true; |
| | | }; |
| | | btnUp.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (!function.isOnline())//离线不允许操作 |
| | | { |
| | | new Tip() |
| | | { |
| | | CloseTime = 1, |
| | | Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | Direction = AMPopTipDirection.None, |
| | | }.Show(MainPage.BaseView); |
| | | return; |
| | | } |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnUp.IsSelected = false; |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | function.SetAttrState(FunctionAttributeKey.Position, "up"); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.Position, "up"); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }; |
| | | |
| | | btnDown.MouseDownEventHandler = (sender, e) => |
| | | { |
| | | btnDown.IsSelected = true; |
| | | }; |
| | | btnDown.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (!function.isOnline())//离线不允许操作 |
| | | { |
| | | new Tip() |
| | | { |
| | | CloseTime = 1, |
| | | Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | Direction = AMPopTipDirection.None, |
| | | }.Show(MainPage.BaseView); |
| | | return; |
| | | } |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnDown.IsSelected = false; |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | function.SetAttrState(FunctionAttributeKey.Position, "down"); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.Position, "down"); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }; |
| | | } |
| | | |
| | | |
| | | #region 空调事件 |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 音乐控制事件列表 |
| | | /// </summary> |
| | | /// <param name="btnStop"></param> |
| | | /// <param name="btnOpen"></param> |
| | | /// <param name="btnClose"></param> |
| | | /// <param name="curtain"></param> |
| | | void LoadEvent_ControlMusic(Button btnPlay,Button btnNext,Button btnPrev, Function a31player) |
| | | { |
| | | if (a31player == null) |
| | | return; |
| | | ///上一曲点击事件 |
| | | btnPrev.MouseDownEventHandler = (sender, e) => |
| | | { |
| | | btnPrev.IsSelected = true; |
| | | a31player.SetAttrState("song_step", "up"); |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | dic.Add("song_step", "up"); |
| | | SendMethod.Current.SendControlCommand(a31player, dic); |
| | | }; |
| | | btnPrev.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnPrev.IsSelected = false; |
| | | }; |
| | | ///暂停/播放点击事件 |
| | | btnPlay.MouseDownEventHandler = (sender, e) => |
| | | { |
| | | string status = "off"; |
| | | if (btnPlay.IsSelected) |
| | | { |
| | | btnPlay.IsSelected = false; |
| | | status = "off"; |
| | | } |
| | | else |
| | | { |
| | | btnPlay.IsSelected = true; |
| | | status = "on"; |
| | | } |
| | | a31player.SetAttrState("on_off", status); |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | dic.Add("on_off", status); |
| | | SendMethod.Current.SendControlCommand(a31player, dic); |
| | | }; |
| | | ///下一曲点击事件 |
| | | btnNext.MouseDownEventHandler = (sender, e) => |
| | | { |
| | | btnNext.IsSelected = true; |
| | | a31player.SetAttrState("song_step", "down"); |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | dic.Add("song_step", "down"); |
| | | SendMethod.Current.SendControlCommand(a31player, dic); |
| | | }; |
| | | btnNext.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnNext.IsSelected = false; |
| | | }; |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 控制界面跳转 |
| | | /// </summary> |
| | | void LoadEvent_DivSkipEvent() |
| | | { |
| | | //if (function.spk == SPK.GroupControl) |
| | | //{ |
| | | // EventHandler<MouseEventArgs> handler = (sender, e) => { |
| | | // var dialog = new GroupControlPage(FunctionList.List.groupControls.Find((obj) => obj.sid == function.sid)); |
| | | // dialog.ShowDialog(); |
| | | // }; |
| | | // this.MouseUpEventHandler = handler; |
| | | // btnName.MouseUpEventHandler = handler; |
| | | // btnFromFloor.MouseUpEventHandler = handler; |
| | | // return; |
| | | //} |
| | | var eventHandler = new PublicAssmebly().LoadEvent_SkipFunctionControlPage(function, btnCollectionIcon, btnName, btnFromFloor, UI2.FuntionControlView.VideoDoorLock.CommonMethod.Comerom.room,this.action); |
| | | var eventHandler = new PublicAssmebly().LoadEvent_SkipFunctionControlPage(function, btnCollectionIcon, btnName, btnFromFloor, this.action); |
| | | this.MouseUpEventHandler = eventHandler; |
| | | btnName.MouseUpEventHandler = eventHandler; |
| | | btnFromFloor.MouseUpEventHandler = eventHandler; |