| | |
| | | } |
| | | if ((DateTime.Now - uCurtain.refreshTime).TotalMilliseconds > 300) |
| | | { |
| | | bodyView.controlBar.Progress = bodyView.curtainSeekBar.Progress = Convert.ToInt32(uCurtain.openLevel); |
| | | bodyView.controlBar.Progress = bodyView.curtainSeekBar.Progress = Convert.ToInt32(uCurtain.percent); |
| | | } |
| | | |
| | | |
| | |
| | | LoadCollectionEvent(); |
| | | |
| | | //回退刷新信息事件 |
| | | actionRefresh = () => { |
| | | actionRefresh = () => |
| | | { |
| | | btnFunctionName.Text = btnFunctionName_Out.Text = curtain.name; |
| | | btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = curtain.GetRoomListName(); |
| | | }; |
| | |
| | | /// </summary> |
| | | void LoadCollectionEvent() |
| | | { |
| | | btnCollection.MouseUpEventHandler += (sender, e) => { |
| | | btnCollection.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | btnCollection.IsSelected = curtain.collection = btnCollection_Out.IsSelected = !btnCollection.IsSelected; |
| | | curtain.SaveFunctionData(); |
| | | }; |
| | |
| | | /// </summary> |
| | | void LoadEvent_ControlEvent() |
| | | { |
| | | btnCurtainClose.MouseUpEventHandler = (sender, e) => { |
| | | btnCurtainClose.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnCurtainClose.IsSelected = true; |
| | | btnCurtainStop.IsSelected = false; |
| | | btnCurtainOpen.IsSelected = false; |
| | | curtain.trait_on_off.value = "off"; |
| | | curtain.openLevel = 0; |
| | | curtain.percent = 0; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("on_off", curtain.trait_on_off.value.ToString()); |
| | | Control.SendWriteCommand(curtain, d); |
| | | }; |
| | | |
| | | btnCurtainStop.MouseDownEventHandler = (sender, e) => { |
| | | btnCurtainStop.MouseDownEventHandler = (sender, e) => |
| | | { |
| | | btnCurtainStop.IsSelected = true; |
| | | btnCurtainClose.IsSelected = false; |
| | | btnCurtainOpen.IsSelected = false; |
| | | }; |
| | | btnCurtainStop.MouseUpEventHandler = (sender, e) => { |
| | | btnCurtainStop.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnCurtainOpen.IsSelected = true; |
| | | btnCurtainClose.IsSelected = false; |
| | | btnCurtainStop.IsSelected = false; |
| | | curtain.trait_on_off.value = "stop"; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("on_off", curtain.trait_on_off.value.ToString()); |
| | | Control.SendWriteCommand(curtain,d); |
| | | Control.SendWriteCommand(curtain, d); |
| | | }; |
| | | |
| | | btnCurtainOpen.MouseUpEventHandler = (sender, e) => { |
| | | btnCurtainOpen.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnCurtainOpen.IsSelected = true; |
| | | btnCurtainClose.IsSelected = false; |
| | | btnCurtainStop.IsSelected = false; |
| | | curtain.trait_on_off.value = "on"; |
| | | curtain.openLevel = 100; |
| | | curtain.percent = 100; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("on_off", curtain.trait_on_off.value.ToString()); |
| | | Control.SendWriteCommand(curtain, d); |
| | |
| | | |
| | | DateTime delayTime = DateTime.MinValue; |
| | | |
| | | btnMinusSignIcon.MouseLongEventHandler = (sender, e) => { |
| | | //if (curtain.openLevel > 1) |
| | | //{ |
| | | // curtain.openLevel--; |
| | | // controlBar.Progress = curtainSeekBar.Progress = curtain.openLevel; |
| | | // delayTime = DateTime.Now; |
| | | // new System.Threading.Thread(() => { |
| | | // while (delayTime != DateTime.MaxValue) |
| | | // { |
| | | // System.Threading.Thread.Sleep(100); |
| | | // if ((DateTime.Now - delayTime).TotalSeconds > 1) |
| | | // { |
| | | // if (curtain.openLevel < 1) |
| | | // { |
| | | // break; |
| | | // } |
| | | // curtain.openLevel--; |
| | | // Application.RunOnMainThread(() => { |
| | | // controlBar.Progress = curtain.openLevel; |
| | | // }); |
| | | // } |
| | | // } |
| | | // }) |
| | | // { IsBackground = true }.Start(); |
| | | //} |
| | | }; |
| | | btnMinusSignIcon.MouseUpEventHandler = (sender, e) => { |
| | | btnMinusSignIcon.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | delayTime = DateTime.MinValue; |
| | | curtain.openLevel--; |
| | | controlBar.Progress = curtain.openLevel; |
| | | curtain.percent--; |
| | | controlBar.Progress = curtain.percent; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("openLevel", curtain.openLevel.ToString()); |
| | | d.Add("percent", curtain.percent.ToString()); |
| | | Control.SendWriteCommand(curtain, d); |
| | | //Control.Send(CommandType_A.write, curtain); |
| | | }; |
| | | |
| | | btnPlusSgnIcon.MouseLongEventHandler = (sender, e) => { |
| | | //if (curtain.openLevel > 1) |
| | | //{ |
| | | // curtain.openLevel++; |
| | | // controlBar.Progress = curtainSeekBar.Progress = curtain.openLevel; |
| | | // delayTime = DateTime.Now; |
| | | // new System.Threading.Thread(() => { |
| | | // while (delayTime != DateTime.MaxValue) |
| | | // { |
| | | // System.Threading.Thread.Sleep(100); |
| | | // if ((DateTime.Now - delayTime).TotalSeconds > 1) |
| | | // { |
| | | // if (curtain.openLevel > 99) |
| | | // { |
| | | // break; |
| | | // } |
| | | // curtain.openLevel++; |
| | | // Application.RunOnMainThread(() => { |
| | | // controlBar.Progress = curtain.openLevel; |
| | | // }); |
| | | // } |
| | | // } |
| | | // }) |
| | | // { IsBackground = true }.Start(); |
| | | //} |
| | | }; |
| | | btnPlusSgnIcon.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | delayTime = DateTime.MinValue; |
| | | curtain.openLevel++; |
| | | controlBar.Progress = curtain.openLevel; |
| | | curtain.percent++; |
| | | controlBar.Progress = curtain.percent; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("openLevel", curtain.openLevel.ToString()); |
| | | d.Add("percent", curtain.percent.ToString()); |
| | | Control.SendWriteCommand(curtain, d); |
| | | }; |
| | | |
| | |
| | | if ((DateTime.Now - delayTime).TotalMilliseconds > 300) |
| | | { |
| | | delayTime = DateTime.Now; |
| | | curtain.openLevel = e; |
| | | curtain.percent = e; |
| | | curtain.refreshTime = DateTime.Now; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("openLevel", curtain.openLevel.ToString()); |
| | | d.Add("percent", curtain.percent.ToString()); |
| | | Control.SendWriteCommand(curtain, d); |
| | | } |
| | | }) |
| | |
| | | if ((DateTime.Now - delayTime).TotalMilliseconds > 300) |
| | | { |
| | | delayTime = DateTime.Now; |
| | | curtain.openLevel = e; |
| | | curtain.percent = e; |
| | | curtain.refreshTime = DateTime.Now; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("openLevel", curtain.openLevel.ToString()); |
| | | d.Add("percent", curtain.percent.ToString()); |
| | | Control.SendWriteCommand(curtain, d); |
| | | } |
| | | }) |