HDL-ON_Android/Assets/Language.ini | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL-ON_iOS/Resources/Language.ini | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/Common/R.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/HDL_ON.projitems | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/UI/UI0-Stan/Controls/BaseControl/ButtonCtrBase.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/UI/UI0-Stan/Controls/CompoundControls/BatteryPersentControl.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/UI/UI0-Stan/Controls/CompoundControls/DirectionImageControl.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaFanPage.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWeepRobotConsumablesMagPage.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWeepRobotHistoryPage.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWeepRobotPage.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
HDL-ON_Android/Assets/Language.ini
@@ -1080,6 +1080,21 @@ 1032=清扫模式 1033=耗材管理 1034=历史记录 1035=自动清扫 1036=定点清扫 1037=沿墙清扫 1038=区域清扫 1039=总清洁面积 1040=总清洁时间 1041=边刷剩余寿命 1042=滚刷剩余寿命 1043=滤网剩余寿命 1044=重置边刷 1045=重置滚刷 1046=重置滤网 1047=是否重置边刷 1048=是否重置滚刷 1049=是否重置滤网 5000=音乐 5001=组合 HDL-ON_iOS/Resources/Language.ini
@@ -103,7 +103,7 @@ 102=Uunassigned 103=Delete the room or not? 104=Transition time 105=Indoor temp. 105=Indoor temp. 106=AC 107=Video intercom 108=Sensor @@ -390,9 +390,6 @@ 405=Cozy 406=Meeting 407=Reading 408=Comfirm 409=Function brand 410=You haven't added any platform devices yet 5000=Music 5001=Group @@ -605,7 +602,7 @@ 9049=Incorrect password for many times, the account number is locked! 9050=Verify the face ID 9051=Fail to save the user's face ID ' 9052=The push notification of registration is available. 9053=The push notification of registration is abnormal. 9054=Numeric password verification @@ -1047,10 +1044,6 @@ 406=会客 407=阅读 408=确认添加 409=功能品牌 410=你当前还未添加任何平台设备 411=其他平台设备均由第三方服务商提供支持 412=添加 1000=室内湿度 1001=童锁 @@ -1087,6 +1080,21 @@ 1032=清扫模式 1033=耗材管理 1034=历史记录 1035=自动清扫 1036=定点清扫 1037=沿墙清扫 1038=区域清扫 1039=总清洁面积 1040=总清洁时间 1041=边刷剩余寿命 1042=滚刷剩余寿命 1043=滤网剩余寿命 1044=重置边刷 1045=重置滚刷 1046=重置滤网 1047=是否重置边刷 1048=是否重置滚刷 1049=是否重置滤网 5000=音乐 5001=组合 @@ -1261,9 +1269,6 @@ 7120=防拆功能 7121=在线 7122=不在线 9000=请使用新的手机账号登录APP 9001=请使用新的邮箱账号登录APP HDL_ON/Common/R.cs
@@ -510,7 +510,7 @@ /// </summary> public const int SuctionAdjustment = 1025; /// <summary> ///吸力1档 /// 吸力1档 /// </summary> public const int SuctionOneGear = 1026; /// <summary> @@ -545,6 +545,67 @@ /// 历史记录 /// </summary> public const int HistoryLog = 1034; /// <summary> /// 自动清扫 /// </summary> public const int AutoClean = 1035; /// <summary> /// 定点清扫 /// </summary> public const int FixedPointClean = 1036; /// <summary> /// 沿墙清扫 /// </summary> public const int WallClean = 1037; /// <summary> /// 区域清扫 /// </summary> public const int AreaClean = 1038; /// <summary> /// 总清洁面积 /// </summary> public const int TotalCleanArea = 1039; /// <summary> /// 总清洁时间 /// </summary> public const int TotalCleaningTime = 1040; /// <summary> /// 边刷剩余寿命 /// </summary> public const int RemainingLifeOfSideBrush = 1041; /// <summary> /// 滚刷剩余寿命 /// </summary> public const int RemainingLifeOfRollerBrush = 1042; /// <summary> /// 滤网剩余寿命 /// </summary> public const int RemainingLifeOfFilterScreen = 1043; /// <summary> /// 重置边刷 /// </summary> public const int ResetSideBrush = 1044; /// <summary> /// 重置滚刷 /// </summary> public const int ResetRollerBrush = 1045; /// <summary> /// 重置滤网 /// </summary> public const int ResetFilterScreen = 1046; /// <summary> /// 是否重置边刷 /// </summary> public const int ResetSideBrushMsg = 1047; /// <summary> /// 是否重置滚刷 /// </summary> public const int ResetRollerBrushMsg = 1048; /// <summary> /// 是否重置滤网 /// </summary> public const int ResetFilterScreenMsg = 1049; public const int a31Music = 5000; HDL_ON/HDL_ON.projitems
@@ -327,6 +327,9 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Stan\Controls\CompoundControls\SeekBarImageControl.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Stan\Controls\CompoundControls\FanGearSeekBarControl.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Stan\Controls\CompoundControls\ProgressBar.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Stan\Controls\CompoundControls\BatteryPersentControl.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Electrical\TuyaWeepRobotConsumablesMagPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Electrical\TuyaWeepRobotHistoryPage.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)UI\" /> HDL_ON/UI/UI0-Stan/Controls/BaseControl/ButtonCtrBase.csold mode 100644 new mode 100755
@@ -74,6 +74,54 @@ } } /// <summary> /// 选中状态(重写底层属性) /// </summary> public new bool IsSelected { get { return base.IsSelected; } set { //只有状态不一样,才变更 if (base.IsSelected != value) { base.IsSelected = value; } } } /// <summary> /// 非选中状态的背景图路径(重写底层属性) /// </summary> public new string UnSelectedImagePath { get { return base.UnSelectedImagePath; } set { //只有图片不一样,才变更 if (base.UnSelectedImagePath != value) { base.UnSelectedImagePath = value; } } } /// <summary> /// 选中状态的背景图路径(重写底层属性) /// </summary> public new string SelectedImagePath { get { return base.SelectedImagePath; } set { //只有图片不一样,才变更 if (base.SelectedImagePath != value) { base.SelectedImagePath = value; } } } #endregion #region ■ 初始化_____________________________ HDL_ON/UI/UI0-Stan/Controls/CompoundControls/BatteryPersentControl.cs
New file @@ -0,0 +1,97 @@ using Shared; using HDL_ON.UI.CSS; using System; using System.Collections.Generic; using System.Text; namespace HDL_ON.Stan { /// <summary> /// 电池百分比控件 /// </summary> public class BatteryPersentControl : NormalFrameLayout { #region ■ 变量声明___________________________ /// <summary> /// 电池百分比显示的值 /// </summary> private NormalViewControl btnBatteryView = null; /// <summary> /// 进度条 /// </summary> private NormalViewControl btnProgress = null; #endregion #region ■ 初始化_____________________________ /// <summary> /// 电池百分比控件 /// </summary> public BatteryPersentControl() { //以图片的计算方法计算高度 this.Height = this.GetPictrueRealSize(25); this.Width = this.GetPictrueRealSize(24) + Application.GetRealWidth(30 + 4); } /// <summary> /// 初始化控件 /// </summary> public void InitControl() { var btnIcon = new IconViewControl(24); btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobot/Battery.png"; this.AddChidren(btnIcon); //电池百分比 this.btnBatteryView = new NormalViewControl(30, 16, true); btnBatteryView.X = btnIcon.Right + Application.GetRealWidth(4); btnBatteryView.Y = btnIcon.Y + (btnIcon.Height - Application.GetRealHeight(16)) / 2; btnBatteryView.TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel; btnBatteryView.TextColor = CSS_Color.PromptingColor1; this.AddChidren(btnBatteryView); //进度条控件 this.btnProgress = new NormalViewControl(this.GetPictrueRealSize(15), this.GetPictrueRealSize(8), false); btnProgress.X = this.GetPictrueRealSize(4); btnProgress.Gravity = Gravity.CenterVertical; btnProgress.BackgroundColor = CSS_Color.PromptingColor1; this.AddChidren(btnProgress); } #endregion #region ■ 一般方法___________________________ /// <summary> /// 百分比值 /// </summary> /// <param name="i_value"></param> public void SetValue(decimal i_value) { int myWidth = (int)((i_value / 100) * this.GetPictrueRealSize(15)); this.btnBatteryView.Text = i_value + "%"; this.btnProgress.Width = myWidth; if (i_value <= 20) { if (this.btnProgress.BackgroundColor == CSS_Color.PromptingColor1) { //变红色 this.btnProgress.BackgroundColor = 0xfff62f48; } } else { if (this.btnProgress.BackgroundColor == 0xfff62f48) { //变红色 this.btnProgress.BackgroundColor = CSS_Color.PromptingColor1; } } } #endregion } } HDL_ON/UI/UI0-Stan/Controls/CompoundControls/DirectionImageControl.cs
@@ -14,13 +14,13 @@ #region ■ 变量声明___________________________ /// <summary> /// 控制事件(不支持Enable和Disable,都归为Mid) /// 点击后自动还原状态的控制事件(只有Mid,left,right,up,down) /// </summary> public Action<DirectionEnum> ControlEvent = null; public Action<DirectionEnum> AutoRecoverControlEvent = null; /// <summary> /// 是否使用点击特效,一旦设置为true,则点击之后,会自动还原回Enable状态 /// 点击后不会还原状态的控制事件(只有enable,Mid,left,right,up,down。 enable:手指松开方向键后触发) /// </summary> public bool UseClickStau = false; public Action<DirectionEnum> NotRecoverControlEvent = null; /// <summary> /// 能否控制方向 /// </summary> @@ -75,7 +75,8 @@ //开启等待线程(不允许狂点) this.StartWaitThread(); this.ControlEvent?.Invoke(DirectionEnum.Mid); this.AutoRecoverControlEvent?.Invoke(DirectionEnum.Mid); this.NotRecoverControlEvent?.Invoke(DirectionEnum.Mid); }; //上按钮 @@ -161,7 +162,7 @@ //不能控制方向 this.CanDirection = false; } else if (direction == DirectionEnum.Enable) else { //能够控制方向 this.CanDirection = true; @@ -191,19 +192,21 @@ } //如果使用特效的话 if (this.UseClickStau == true) if (this.AutoRecoverControlEvent != null) { //切换图片 this.SetDirectionImage(direction); //开启等待线程(不允许狂点) this.StartWaitThread(); this.AutoRecoverControlEvent?.Invoke(direction); } else { //切换图片 this.SetDirectionImage(DirectionEnum.Enable); this.NotRecoverControlEvent?.Invoke(DirectionEnum.Enable); } this.ControlEvent?.Invoke(direction); } /// <summary> @@ -213,12 +216,13 @@ private void DirectionDownClickEvent(DirectionEnum direction) { //如果不使用特效的话 if (this.CanClick == false || this.CanDirection == false || this.UseClickStau == true) if (this.CanClick == false || this.CanDirection == false || this.NotRecoverControlEvent == null) { return; } //切换图片 this.SetDirectionImage(direction); this.NotRecoverControlEvent?.Invoke(direction); } #endregion @@ -237,7 +241,7 @@ this.CanClick = true; //如果不使用特效的话 if (this.UseClickStau == false) if (this.NotRecoverControlEvent != null) { return; } HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaFanPage.cs
@@ -78,6 +78,8 @@ seekBarContr.MinValue = 1; seekBarContr.MaxValue = 15; FrameWhiteCentet1.AddChidren(seekBarContr); seekBarContr.Progress = this.fanData.SpeedLevel; this.btnNowGear.Text = this.fanData.SpeedLevel + Language.StringByID(StringId.Gear); //开关图标 this.btnSwitch = new IconViewControl(40); @@ -94,14 +96,10 @@ //刷新界面状态 this.RefreshFormStatu(false); int oldProgressValue = fanData.SpeedLevel; int nowProgressValue = fanData.SpeedLevel; //档 var strView = Language.StringByID(StringId.Gear); seekBarContr.ProgressChangedEvent += (div, value) => { nowProgressValue = value; this.btnNowGear.Text = value + strView; //滑动中 if (div == 0) { this.fanData.IsProgressing = true; } @@ -110,28 +108,10 @@ { this.fanData.IsProgressing = false; this.fanData.ProgressEndTime = DateTime.Now; //发送风速命令 this.SendSpeedComand(value); } }; HdlThreadLogic.Current.RunThread(() => { while (this.Parent != null) { if (nowProgressValue != oldProgressValue) { //发送风速命令 this.SendSpeedComand(nowProgressValue); oldProgressValue = nowProgressValue; } System.Threading.Thread.Sleep(1000); } //界面关闭时 if (nowProgressValue != oldProgressValue) { //发送风速命令 this.SendSpeedComand(nowProgressValue); } }); } #endregion HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWeepRobotConsumablesMagPage.cs
New file @@ -0,0 +1,123 @@ using Shared; using HDL_ON.Stan; using System; using System.Collections.Generic; using System.Text; using HDL_ON.Entity; using HDL_ON.DriverLayer; namespace HDL_ON.UI { /// <summary> /// 涂鸦扫地机器人耗材管理界面 /// </summary> public class TuyaWeepRobotConsumablesMagPage: EditorCommonForm { #region ■ 初始化_____________________________ /// <summary> /// 画面显示(底层会固定调用此方法,借以完成画面创建) /// </summary> /// <param name="i_device">设备对象</param> /// <param name="robotData">扫地机器人数据</param> public void ShowForm(Function i_device, TuyaWeepRobotPage.WeepRobotData robotData) { base.SetTitleText(Language.StringByID(StringId.ConsumablesManagement)); //边刷 this.InitBrushControl(i_device, robotData.EdgeBrush, robotData.ResetEdgeBrush, Language.StringByID(StringId.RemainingLifeOfSideBrush), Language.StringByID(StringId.ResetSideBrush), Language.StringByID(StringId.ResetSideBrushMsg), "reset_edge_brush"); //滚刷 this.InitBrushControl(i_device, robotData.RollBrush, robotData.ResetRollBrush, Language.StringByID(StringId.RemainingLifeOfRollerBrush), Language.StringByID(StringId.ResetRollerBrush), Language.StringByID(StringId.ResetRollerBrushMsg), "reset_roll_brush"); //滤网 this.InitBrushControl(i_device, robotData.Filter, robotData.ResetFilter, Language.StringByID(StringId.RemainingLifeOfFilterScreen), Language.StringByID(StringId.ResetFilterScreen), Language.StringByID(StringId.ResetFilterScreenMsg), "reset_filter"); } /// <summary> /// 初始化边刷控件 /// </summary> /// <param name="i_device">设备对象</param> /// <param name="i_brushValue">边刷寿命</param> /// <param name="i_brushStatu">边刷状态</param> private void InitBrushControl(Function i_device, int i_brushValue, bool i_brushStatu, string i_brushText, string i_resetText, string i_resetMsg, string i_comand) { var myView = bodyFrameLayout.GetChildren(bodyFrameLayout.ChildrenCount - 1); var frameBack = new NormalFrameLayout(); frameBack.Y = myView == null ? Application.GetRealHeight(12) : myView.Bottom + Application.GetRealHeight(12); frameBack.Width = Application.GetRealWidth(343); frameBack.Height = Application.GetRealHeight(100); frameBack.Radius = (uint)Application.GetRealWidth(12); frameBack.BackgroundColor = CSS.CSS_Color.MainBackgroundColor; frameBack.Gravity = Gravity.CenterHorizontal; bodyFrameLayout.AddChidren(frameBack); var row1 = new FrameRowControl(); row1.Height = Application.GetRealHeight(50); row1.Width = Application.GetRealWidth(343); frameBack.AddChidren(row1); //边刷剩余寿命 var btnbrushText = row1.AddLeftCaption(i_brushText, 200); btnbrushText.TextColor = CSS.CSS_Color.FirstLevelTitleColor; //寿命值 row1.AddMostRightView(i_brushValue + "%", 80); row1.AddBottomLine(); var row2 = new FrameRowControl(); row2.Y = row1.Bottom; row2.Height = Application.GetRealHeight(50); row2.Width = Application.GetRealWidth(343); frameBack.AddChidren(row2); //重置边刷 var btnResetText = row2.AddLeftCaption(i_resetText, 200); btnResetText.TextColor = CSS.CSS_Color.FirstLevelTitleColor; //开关 var btnSwitch = row2.AddMostRightSwitchIcon(); btnSwitch.IsSelected = i_brushStatu; btnSwitch.ButtonClickEvent += (sender, e) => { if (btnSwitch.IsSelected == true) { //取消的话直接取消 btnSwitch.CanClick = false; btnSwitch.IsSelected = !btnSwitch.IsSelected; HdlThreadLogic.Current.RunThread(() => { var dic = new Dictionary<string, string>(); dic.Add(i_comand, "false"); Control.Ins.SendWriteCommand(i_device, dic, true); btnSwitch.CanClick = true; }, ShowErrorMode.NO); } else { //开启需要确认 this.ShowMassage(ShowMsgType.Confirm, i_resetMsg, () => { btnSwitch.IsSelected = !btnSwitch.IsSelected; HdlThreadLogic.Current.RunThread(() => { var dic = new Dictionary<string, string>(); dic.Add(i_comand, "true"); Control.Ins.SendWriteCommand(i_device, dic, true); }, ShowErrorMode.NO); }); } }; } #endregion } } HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWeepRobotHistoryPage.cs
New file @@ -0,0 +1,50 @@ using Shared; using HDL_ON.Stan; using System; using System.Collections.Generic; using System.Text; namespace HDL_ON.UI { /// <summary> /// 涂鸦扫地机器人历史记录 /// </summary> public class TuyaWeepRobotHistoryPage : EditorCommonForm { #region ■ 初始化_____________________________ /// <summary> /// 画面显示(底层会固定调用此方法,借以完成画面创建) /// </summary> /// <param name="robotData">扫地机器人数据</param> public void ShowForm(TuyaWeepRobotPage.WeepRobotData robotData) { base.SetTitleText(Language.StringByID(StringId.HistoryLog)); var frameBack = new NormalFrameLayout(); frameBack.BackgroundColor = CSS.CSS_Color.MainBackgroundColor; frameBack.Height = Application.GetRealHeight(50) * 2; bodyFrameLayout.AddChidren(frameBack); //总清洁面积 var rowArea = new FrameRowControl(); rowArea.Height = Application.GetRealHeight(50); frameBack.AddChidren(rowArea); var btnCaption = rowArea.AddLeftCaption(Language.StringByID(StringId.TotalCleanArea), 200); btnCaption.TextColor = CSS.CSS_Color.FirstLevelTitleColor; rowArea.AddMostRightView(robotData.CleanArea + "m²", 100); rowArea.AddBottomLine(); //总清洁时间 var rowTime = new FrameRowControl(); rowTime.Height = Application.GetRealHeight(50); rowTime.Y = rowArea.Bottom; frameBack.AddChidren(rowTime); btnCaption = rowTime.AddLeftCaption(Language.StringByID(StringId.TotalCleaningTime), 200); btnCaption.TextColor = CSS.CSS_Color.FirstLevelTitleColor; rowTime.AddMostRightView((robotData.CleanTime / 60) + "min", 100); } #endregion } } HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWeepRobotPage.cs
@@ -17,13 +17,9 @@ #region ■ 变量声明___________________________ /// <summary> /// 电池图标 /// 电池控件 /// </summary> private IconViewControl btnBatteryIcon = null; /// <summary> /// 电池百分比控件 /// </summary> private NormalViewControl btnBatteryView = null; private BatteryPersentControl btnBattery = null; /// <summary> /// 吸力调节图标 /// </summary> @@ -60,6 +56,14 @@ /// 扫地机器人数据 /// </summary> private WeepRobotData weepRobotData = new WeepRobotData(); /// <summary> /// 是否在控制方向中 /// </summary> private bool directionControling = false; /// <summary> /// 方向控制结束时间 /// </summary> private DateTime directionFinishTime = DateTime.Now.AddDays(-1); #endregion @@ -90,25 +94,16 @@ /// </summary> private void InitFrameWhiteContent1() { //电池图标 this.btnBatteryIcon = new IconViewControl(24); btnBatteryIcon.X = base.btnRoomName.Right + Application.GetRealWidth(24); btnBatteryIcon.Y = base.btnRoomName.Y - (btnBatteryIcon.IconSize - base.btnRoomName.Height) / 2; btnBatteryIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobot/Battery.png"; FrameWhiteCentet1.AddChidren(btnBatteryIcon); //电池百分比 this.btnBatteryView = new NormalViewControl(30, 16, true); btnBatteryView.X = btnBatteryIcon.Right + Application.GetRealWidth(4); btnBatteryView.Y = btnBatteryIcon.Y + (btnBatteryIcon.Height - Application.GetRealHeight(16)) / 2; btnBatteryView.Text = this.weepRobotData.ElectricityLeft + "%"; btnBatteryView.TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel; btnBatteryView.TextColor = CSS_Color.PromptingColor1; FrameWhiteCentet1.AddChidren(btnBatteryView); //电池控件 this.btnBattery = new BatteryPersentControl(); btnBattery.X = base.btnRoomName.Right + Application.GetRealWidth(24); FrameWhiteCentet1.AddChidren(btnBattery); btnBattery.Y = base.btnRoomName.Y - (btnBattery.Height - base.btnRoomName.Height) / 2; btnBattery.InitControl(); //配置变更事件 base.SettionFinishEvent += () => { btnBatteryIcon.X = base.btnRoomName.Right + Application.GetRealWidth(24); btnBatteryView.X = btnBatteryIcon.Right + Application.GetRealWidth(4); btnBattery.X = base.btnRoomName.Right + Application.GetRealWidth(24); }; //初始化中间的那个图像控制控件 @@ -122,10 +117,11 @@ ImageControl.InitControl("FunctionIcon/Electrical/WeepRobot/ControlEnable.png", "FunctionIcon/Electrical/WeepRobot/ControlDisable.png", "FunctionIcon/Electrical/WeepRobot/ControlUp.png", "FunctionIcon/Electrical/WeepRobot/ControlDown.png", "FunctionIcon/Electrical/WeepRobot/ControlLeft.png", "FunctionIcon/Electrical/WeepRobot/ControlRight.png"); //控制事件(不支持Enable和Disable,都归为Mid) ImageControl.ControlEvent += (select) => //控制事件(只有enable,Mid,left,right,up,down。 enable:手指松开方向键后触发) ImageControl.NotRecoverControlEvent += (select) => { //发送控制方向命令 this.SendDirectionControlComand(select); }; //吸力调节 @@ -137,6 +133,8 @@ FrameWhiteCentet1.AddChidren(btnSuctionIcon); btnSuctionIcon.ButtonClickEvent += (sender, e) => { //显示吸力调节选择界面 this.ShowSuctionSelectView(); }; this.btnSuctionView = new NormalViewControl(80, 54, true); btnSuctionView.Y = btnSuctionIcon.Bottom + Application.GetRealHeight(10); @@ -149,13 +147,14 @@ //充电图标 this.btnChargeIcon = new IconViewControl(28); btnChargeIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobot/Charge.png"; btnChargeIcon.SelectedImagePath = "FunctionIcon/Electrical/WeepRobot/ChargeSelect.png"; btnChargeIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobot/ChargeSelect.png"; btnChargeIcon.Y = btnSuctionIcon.Y; btnChargeIcon.X = btnSuctionIcon.Right + Application.GetRealWidth(50); FrameWhiteCentet1.AddChidren(btnChargeIcon); btnChargeIcon.ButtonClickEvent += (sender, e) => { //发送充电命令 this.SendComand("mode", "chargego"); }; var btnChargeView = new NormalViewControl(80, 18, true); btnChargeView.Y = btnSuctionView.Y; @@ -174,6 +173,8 @@ FrameWhiteCentet1.AddChidren(btnVoiceIcon); btnVoiceIcon.ButtonClickEvent += (sender, e) => { //发送静音命令 this.SendComand("voice_switch", this.weepRobotData.VoiceSwitch == true ? "false" : "true"); }; this.btnVoiceView = new NormalViewControl(80, 18, true); btnVoiceView.Y = btnSuctionView.Y; @@ -191,6 +192,8 @@ FrameWhiteCentet1.AddChidren(btnModeIcon); btnModeIcon.ButtonClickEvent += (sender, e) => { //显示清扫模式选择 this.ShowCleanModeSelectView(); }; this.btnModeView = new NormalViewControl(80, 54, true); btnModeView.Y = btnSuctionView.Y; @@ -227,6 +230,8 @@ rowManment.AddRightArrow(); rowManment.ButtonClickEvent += (sender, e) => { var form = new TuyaWeepRobotConsumablesMagPage(); form.AddForm(this.device, this.weepRobotData); }; //历史记录 @@ -240,7 +245,130 @@ rowHistory.AddRightArrow(); rowHistory.ButtonClickEvent += (sender, e) => { var form = new TuyaWeepRobotHistoryPage(); form.AddForm(this.weepRobotData); }; } #endregion #region ■ 吸力调节选择_______________________ /// <summary> /// 显示吸力调节选择界面 /// </summary> private void ShowSuctionSelectView() { //整个灰色界面 var frameBack = new Dialog(); var dialogBody = new NormalFrameLayout(); frameBack.AddChidren(dialogBody); dialogBody.ButtonClickEvent = (sender, e) => { frameBack.Close(); }; frameBack.Show(); //菜单控件(吸力调节) var menuContr = new DialogTitleMenuControl(3, Language.StringByID(StringId.SuctionAdjustment)); menuContr.X = Application.GetRealWidth(5); menuContr.Y = Application.GetRealHeight(241); menuContr.Width = Application.GetRealWidth(160); menuContr.Height = Application.GetRealHeight(200); dialogBody.AddChidren(menuContr); //吸力1档 var iconPath = this.weepRobotData.Suction == "quiet" ? "FunctionIcon/Electrical/WeepRobot/SuctionSelect.png" : "FunctionIcon/Electrical/WeepRobot/Suction.png"; menuContr.AddRowMenu(Language.StringByID(StringId.SuctionOneGear), iconPath, this.weepRobotData.Suction == "strong", () => { frameBack.Close(); //发送吸力命令 this.SendComand("suction", "quiet"); }); //吸力2档 iconPath = this.weepRobotData.Suction == "normal" ? "FunctionIcon/Electrical/WeepRobot/SuctionSelect.png" : "FunctionIcon/Electrical/WeepRobot/Suction.png"; menuContr.AddRowMenu(Language.StringByID(StringId.SuctionTwoGear), iconPath, this.weepRobotData.Suction == "normal", () => { frameBack.Close(); //发送吸力命令 this.SendComand("suction", "normal"); }); //吸力3档 iconPath = this.weepRobotData.Suction == "strong" ? "FunctionIcon/Electrical/WeepRobot/SuctionSelect.png" : "FunctionIcon/Electrical/WeepRobot/Suction.png"; menuContr.AddRowMenu(Language.StringByID(StringId.SuctionThreeGear), iconPath, this.weepRobotData.Suction == "quiet", () => { frameBack.Close(); //发送吸力命令 this.SendComand("suction", "strong"); }); } #endregion #region ■ 清扫模式选择_______________________ /// <summary> /// 显示清扫模式选择界面 /// </summary> private void ShowCleanModeSelectView() { //整个灰色界面 var frameBack = new Dialog(); var dialogBody = new NormalFrameLayout(); frameBack.AddChidren(dialogBody); dialogBody.ButtonClickEvent = (sender, e) => { frameBack.Close(); }; frameBack.Show(); //菜单控件(清扫模式) var menuContr = new DialogTitleMenuControl(4, Language.StringByID(StringId.CleanMode)); menuContr.X = Application.GetRealWidth(210); menuContr.Y = Application.GetRealHeight(197); menuContr.Width = Application.GetRealWidth(160); menuContr.Height = Application.GetRealHeight(243); dialogBody.AddChidren(menuContr); //自动清扫 var iconPath = this.weepRobotData.Mode == "random" ? "FunctionIcon/Electrical/WeepRobot/AutoModeSelect.png" : "FunctionIcon/Electrical/WeepRobot/AutoMode.png"; menuContr.AddRowMenu(Language.StringByID(StringId.AutoClean), iconPath, this.weepRobotData.Mode == "random", () => { frameBack.Close(); //发送模式命令 this.SendComand("mode", "random"); }); //定点清扫 iconPath = this.weepRobotData.Mode == "smart" ? "FunctionIcon/Electrical/WeepRobot/FixedPointModeSelect.png" : "FunctionIcon/Electrical/WeepRobot/FixedPointMode.png"; menuContr.AddRowMenu(Language.StringByID(StringId.FixedPointClean), iconPath, this.weepRobotData.Mode == "smart", () => { frameBack.Close(); //发送模式命令 this.SendComand("mode", "smart"); }); //区域清扫 iconPath = this.weepRobotData.Mode == "spiral" ? "FunctionIcon/Electrical/WeepRobot/AreaModeSelect.png" : "FunctionIcon/Electrical/WeepRobot/AreaMode.png"; menuContr.AddRowMenu(Language.StringByID(StringId.AreaClean), iconPath, this.weepRobotData.Mode == "spiral", () => { frameBack.Close(); //发送模式命令 this.SendComand("mode", "spiral"); }); //沿墙清扫 iconPath = this.weepRobotData.Mode == "wall_follow" ? "FunctionIcon/Electrical/WeepRobot/WallModeSelect.png" : "FunctionIcon/Electrical/WeepRobot/WallMode.png"; menuContr.AddRowMenu(Language.StringByID(StringId.WallClean), iconPath, this.weepRobotData.Mode == "wall_follow", () => { frameBack.Close(); //发送模式命令 this.SendComand("mode", "wall_follow"); }); } #endregion @@ -267,23 +395,60 @@ #region ■ 发送各种命令_______________________ /// <summary> /// 发送开关命令 /// 发送控制方向命令 /// </summary> private void SendSwitchComand() /// <param name="direction">只有enable,Mid,left,right,up,down。 enable:手指松开方向键后触发</param> private void SendDirectionControlComand(DirectionEnum direction) { //this.btnSwitch.CanClick = false; if (direction == DirectionEnum.Mid) { //发送开关命令 this.SendComand(FunctionAttributeKey.OnOff, this.weepRobotData.Cleaning == true ? "off" : "on"); } else if (direction == DirectionEnum.Enable) { //停 this.directionControling = false; this.directionFinishTime = DateTime.Now; this.SendComand("direction_control", "stop"); } else if (direction == DirectionEnum.Left) { //左 this.directionControling = true; this.SendComand("direction_control", "turn_left"); } else if (direction == DirectionEnum.Right) { //右 this.directionControling = true; this.SendComand("direction_control", "turn_right"); } else if (direction == DirectionEnum.Up) { //上 this.directionControling = true; this.SendComand("direction_control", "forward"); } else if (direction == DirectionEnum.Down) { //下 this.directionControling = true; this.SendComand("direction_control", "backward"); } } //string statu = this.btnSwitch.IsSelected == true ? "off" : "on"; //HdlThreadLogic.Current.RunThread(() => //{ // var dic = new Dictionary<string, string>(); // dic.Add(FunctionAttributeKey.OnOff, statu); // Control.Ins.SendWriteCommand(this.device, dic, true); // HdlThreadLogic.Current.RunMain(() => // { // this.btnSwitch.CanClick = true; // }); //}); /// <summary> /// 发送命令 /// </summary> private void SendComand(string key, string i_value) { HdlThreadLogic.Current.RunThread(() => { var dic = new Dictionary<string, string>(); dic.Add(key, i_value); Control.Ins.SendWriteCommand(this.device, dic, true); }, ShowErrorMode.NO); } #endregion @@ -299,21 +464,91 @@ if (this.weepRobotData.VoiceSwitch == true) { //需要切换图标 if (this.btnVoiceIcon.UnSelectedImagePath != "FunctionIcon/Electrical/WeepRobot/Mute.png") { this.btnVoiceIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobot/Mute.png"; this.btnVoiceIcon.SelectedImagePath = "FunctionIcon/Electrical/WeepRobot/MuteSelect.png"; } this.btnVoiceIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobot/Mute.png"; this.btnVoiceIcon.SelectedImagePath = "FunctionIcon/Electrical/WeepRobot/MuteSelect.png"; } else { //需要切换图标 if (this.btnVoiceIcon.UnSelectedImagePath != "FunctionIcon/Electrical/WeepRobot/Voice.png") this.btnVoiceIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobot/Voice.png"; this.btnVoiceIcon.SelectedImagePath = "FunctionIcon/Electrical/WeepRobot/VoiceSelect.png"; } //如果是清扫状态 if (this.weepRobotData.Cleaning == true) { //吸力调节不可用 this.btnSuctionIcon.IsSelected = false; this.btnSuctionIcon.CanClick = false; //声音不可用 this.btnVoiceIcon.IsSelected = false; this.btnVoiceIcon.CanClick = false; //清扫模式不可用 this.btnModeIcon.IsSelected = false; this.btnModeIcon.CanClick = false; //方向按键不可用 if (this.directionControling == false && (DateTime.Now - this.directionFinishTime).TotalSeconds >= 2) { this.btnVoiceIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobot/Voice.png"; this.btnVoiceIcon.SelectedImagePath = "FunctionIcon/Electrical/WeepRobot/VoiceSelect.png"; //在手动控制方向的过程中,不允许变更图片,并且结束之后,2秒内不接受任何反馈 this.ImageControl.SetDirectionImage(DirectionEnum.Disable); } } else { //吸力调节可用 this.btnSuctionIcon.IsSelected = true; this.btnSuctionIcon.CanClick = true; //声音可用 this.btnVoiceIcon.IsSelected = true; this.btnVoiceIcon.CanClick = true; //清扫模式可用 this.btnModeIcon.IsSelected = true; this.btnModeIcon.CanClick = true; //变更控制控件的图片 if (this.directionControling == false && (DateTime.Now - this.directionFinishTime).TotalSeconds >= 2) { //在手动控制方向的过程中,不允许变更图片,并且结束之后,2秒内不接受任何反馈 this.ImageControl.SetDirectionImage(DirectionEnum.Enable); } } //清扫模式 if (this.weepRobotData.Mode == "random") { //自动清扫 this.btnModeIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobot/AutoMode.png"; this.btnModeIcon.SelectedImagePath = "FunctionIcon/Electrical/WeepRobot/AutoModeSelect.png"; this.btnModeView.TextID = StringId.AutoClean; } else if (this.weepRobotData.Mode == "smart") { //定点清扫 this.btnModeIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobot/FixedPointMode.png"; this.btnModeIcon.SelectedImagePath = "FunctionIcon/Electrical/WeepRobot/FixedPointModeSelect.png"; this.btnModeView.TextID = StringId.FixedPointClean; } else if (this.weepRobotData.Mode == "wall_follow") { //沿墙清扫 this.btnModeIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobot/WallMode.png"; this.btnModeIcon.SelectedImagePath = "FunctionIcon/Electrical/WeepRobot/WallModeSelect.png"; this.btnModeView.TextID = StringId.WallClean; } else if (this.weepRobotData.Mode == "spiral") { //区域清扫 this.btnModeIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobot/AreaMode.png"; this.btnModeIcon.SelectedImagePath = "FunctionIcon/Electrical/WeepRobot/AreaModeSelect.png"; this.btnModeView.TextID = StringId.AreaClean; } else { //清扫模式 this.btnModeIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobot/Clean.png"; this.btnModeIcon.SelectedImagePath = "FunctionIcon/Electrical/WeepRobot/CleanSelect.png"; this.btnModeView.TextID = StringId.CleanMode; } //电池电量 this.btnBattery.SetValue(this.weepRobotData.ElectricityLeft); } #endregion @@ -328,7 +563,7 @@ foreach (var data in i_LocalDevice.attributes) { //开关 if (data.key == "on_off") { this.weepRobotData.Open = data.realValue.ToLower() == "on"; } if (data.key == "on_off") { this.weepRobotData.Cleaning = data.realValue.ToLower() == "on"; } //寻找机器 else if (data.key == "seek") { this.weepRobotData.SearchRobot = data.realValue.ToLower() == "true"; } //边刷重置 @@ -411,12 +646,12 @@ /// <summary> /// 扫地机器人的数据 /// </summary> private class WeepRobotData public class WeepRobotData { /// <summary> /// 是否打开 /// 是否处于清扫中 /// </summary> public bool Open = true; public bool Cleaning = true; /// <summary> /// 寻找机器 /// </summary>