wxr
2020-09-09 c3e1b733fc45bd9f0b88bfb560cfa87a270b079b
HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs
@@ -37,7 +37,7 @@
                    }
                    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);
                    }
@@ -54,7 +54,8 @@
            LoadCollectionEvent();
            //回退刷新信息事件
            actionRefresh = () => {
            actionRefresh = () =>
            {
                btnFunctionName.Text = btnFunctionName_Out.Text = curtain.name;
                btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = curtain.GetRoomListName();
            };
@@ -64,7 +65,8 @@
        /// </summary>
        void LoadCollectionEvent()
        {
            btnCollection.MouseUpEventHandler += (sender, e) => {
            btnCollection.MouseUpEventHandler += (sender, e) =>
            {
                btnCollection.IsSelected = curtain.collection = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
                curtain.SaveFunctionData();
            };
@@ -75,38 +77,42 @@
        /// </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);
@@ -114,75 +120,24 @@
            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);
            };
@@ -194,10 +149,10 @@
                    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);
                    }
                })
@@ -213,10 +168,10 @@
                    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);
                    }
                })