| | |
| | | { |
| | | public partial class RollingShutterPage |
| | | { |
| | | bool inControl = false; |
| | | |
| | | /// <summary> |
| | | /// 更新窗帘 |
| | | /// </summary> |
| | |
| | | bodyView.btnCurtainClose.IsSelected = true; |
| | | bodyView.btnCurtainStop.IsSelected = false; |
| | | } |
| | | if ((DateTime.Now - uCurtain.refreshTime).TotalMilliseconds > 300) |
| | | if ((DateTime.Now - uCurtain.refreshTime).TotalMilliseconds > 300 && !bodyView.inControl) |
| | | { |
| | | bodyView.controlBar.Progress = bodyView.curtainSeekBar.Progress = Convert.ToInt32(uCurtain.percent); |
| | | } |
| | | |
| | | |
| | | } |
| | | }); |
| | | } |
| | |
| | | Control.SendWriteCommand(curtain, d); |
| | | }; |
| | | |
| | | DateTime delayTime = DateTime.MinValue; |
| | | |
| | | btnMinusSignIcon.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | delayTime = DateTime.MinValue; |
| | | //Control.Send(CommandType_A.write, curtain); |
| | | curtain.percent--; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("percent", curtain.percent.ToString()); |
| | |
| | | |
| | | btnPlusSgnIcon.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | delayTime = DateTime.MinValue; |
| | | //Control.Send(CommandType_A.write, curtain); |
| | | curtain.percent++; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("percent", curtain.percent.ToString()); |
| | | Control.SendWriteCommand(curtain, d); |
| | | }; |
| | | |
| | | curtainSeekBar.OnProgressChangedEvent = (sender, e) => |
| | | curtainSeekBar.OnStartTrackingTouchEvent = (sender, e) => |
| | | { |
| | | controlBar.Progress = curtainSeekBar.Progress; |
| | | inControl = true; |
| | | }; |
| | | curtainSeekBar.OnStopTrackingTouchEvent = (sender, e) => |
| | | { |
| | | inControl = false; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | if ((DateTime.Now - delayTime).TotalMilliseconds > 300) |
| | | { |
| | | delayTime = DateTime.Now; |
| | | curtain.percent = e; |
| | | //Control.Send(CommandType_A.write, curtain); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("percent", curtain.percent.ToString()); |
| | | Control.SendWriteCommand(curtain, d); |
| | | curtain.refreshTime = DateTime.Now; |
| | | } |
| | | curtain.percent = e; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("percent", curtain.percent.ToString()); |
| | | Control.SendWriteCommand(curtain, d); |
| | | curtain.refreshTime = DateTime.Now; |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | | |
| | | controlBar.OnProgressChangedEvent = (sender, e) => |
| | | controlBar.OnStartTrackingTouchEvent = (sender, e) => |
| | | { |
| | | curtainSeekBar.Progress = controlBar.Progress; |
| | | inControl = true; |
| | | }; |
| | | controlBar.OnStopTrackingTouchEvent = (sender, e) => |
| | | { |
| | | inControl = false; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | MainPage.Log(delayTime.ToLongTimeString()); |
| | | if ((DateTime.Now - delayTime).TotalMilliseconds > 300) |
| | | { |
| | | delayTime = DateTime.Now; |
| | | curtain.percent = e; |
| | | //Control.Send(CommandType_A.write, curtain); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("percent", curtain.percent.ToString()); |
| | | Control.SendWriteCommand(curtain, d); |
| | | curtain.refreshTime = DateTime.Now; |
| | | } |
| | | curtain.percent = e; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("percent", curtain.percent.ToString()); |
| | | Control.SendWriteCommand(curtain, d); |
| | | curtain.refreshTime = DateTime.Now; |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | | |
| | | } |
| | | } |
| | | } |