From a1b0ab7044100daaa7e0f1da2d2ca45e38098963 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期一, 29 三月 2021 09:13:25 +0800
Subject: [PATCH] 2021-3-29-2
---
HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWeepRobotPage.cs | 427 ++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 338 insertions(+), 89 deletions(-)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWeepRobotPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWeepRobotPage.cs
index 4ebf58c..2368509 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWeepRobotPage.cs
+++ b/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);
};
//鍒濆鍖栦腑闂寸殑閭d釜鍥惧儚鎺у埗鎺т欢
@@ -122,25 +117,28 @@
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");
- //鎺у埗浜嬩欢(涓嶆敮鎸丒nable鍜孌isable,閮藉綊涓篗id)
- ImageControl.ControlEvent += (select) =>
+ //鎺у埗浜嬩欢(鍙湁enable,Mid,left,right,up,down銆� enable:鎵嬫寚鏉惧紑鏂瑰悜閿悗瑙﹀彂)
+ ImageControl.NotRecoverControlEvent += (select) =>
{
-
+ //鍙戦�佹帶鍒舵柟鍚戝懡浠�
+ this.SendDirectionControlComand(select);
};
//鍚稿姏璋冭妭
this.btnSuctionIcon = new IconViewControl(28);
btnSuctionIcon.Y = ImageControl.Bottom + Application.GetRealHeight(64);
- btnSuctionIcon.X = Application.GetRealWidth(33);
+ //btnSuctionIcon.X = Application.GetRealWidth(33);
btnSuctionIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobot/Suction.png";
btnSuctionIcon.SelectedImagePath = "FunctionIcon/Electrical/WeepRobot/SuctionSelect.png";
FrameWhiteCentet1.AddChidren(btnSuctionIcon);
btnSuctionIcon.ButtonClickEvent += (sender, e) =>
{
+ //鏄剧ず鍚稿姏璋冭妭閫夋嫨鐣岄潰
+ this.ShowSuctionSelectView();
};
this.btnSuctionView = new NormalViewControl(80, 54, true);
btnSuctionView.Y = btnSuctionIcon.Bottom + Application.GetRealHeight(10);
- btnSuctionView.X = btnSuctionIcon.X - (Application.GetRealWidth(80) - btnSuctionIcon.Width) / 2;
+ //btnSuctionView.X = btnSuctionIcon.X - (Application.GetRealWidth(80) - btnSuctionIcon.Width) / 2;
btnSuctionView.TextAlignment = TextAlignment.TopCenter;
btnSuctionView.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
btnSuctionView.Text = Language.StringByID(StringId.SuctionAdjustment);
@@ -149,13 +147,15 @@
//鍏呯數鍥炬爣
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);
+ //btnChargeIcon.X = btnSuctionIcon.Right + Application.GetRealWidth(50);
+ btnChargeIcon.Gravity = Gravity.CenterHorizontal;
FrameWhiteCentet1.AddChidren(btnChargeIcon);
btnChargeIcon.ButtonClickEvent += (sender, e) =>
{
+ //鍙戦�佸厖鐢靛懡浠�
+ this.SendComand("mode", "chargego");
};
var btnChargeView = new NormalViewControl(80, 18, true);
btnChargeView.Y = btnSuctionView.Y;
@@ -165,15 +165,22 @@
btnChargeView.TextID = StringId.Charge;
FrameWhiteCentet1.AddChidren(btnChargeView);
+ //2021.03.09 鑸嶅純鎺夐潤闊冲姛鑳�
+ btnSuctionIcon.X = btnChargeIcon.X - btnSuctionIcon.IconSize - Application.GetRealWidth(50);
+ btnSuctionView.X = btnSuctionIcon.X - (Application.GetRealWidth(80) - btnSuctionIcon.Width) / 2;
+
//澹伴煶鍥炬爣
this.btnVoiceIcon = new IconViewControl(28);
btnVoiceIcon.Y = btnSuctionIcon.Y;
btnVoiceIcon.X = btnChargeIcon.Right + Application.GetRealWidth(50);
btnVoiceIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobot/Voice.png";
btnVoiceIcon.SelectedImagePath = "FunctionIcon/Electrical/WeepRobot/VoiceSelect.png";
- FrameWhiteCentet1.AddChidren(btnVoiceIcon);
+ btnVoiceIcon.IsSelected = true;
+ //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;
@@ -181,16 +188,19 @@
btnVoiceView.TextAlignment = TextAlignment.TopCenter;
btnVoiceView.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
btnVoiceView.TextID = StringId.Mute;
- FrameWhiteCentet1.AddChidren(btnVoiceView);
+ //FrameWhiteCentet1.AddChidren(btnVoiceView);
//娓呮壂妯″紡鍥炬爣
this.btnModeIcon = new IconViewControl(28);
btnModeIcon.Y = btnSuctionIcon.Y;
- btnModeIcon.X = btnVoiceIcon.Right + Application.GetRealWidth(50);
+ //btnModeIcon.X = btnVoiceIcon.Right + Application.GetRealWidth(50);
+ btnModeIcon.X = btnChargeIcon.Right + Application.GetRealWidth(50);
btnModeIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobot/Clean.png";
FrameWhiteCentet1.AddChidren(btnModeIcon);
btnModeIcon.ButtonClickEvent += (sender, e) =>
{
+ //鏄剧ず娓呮壂妯″紡閫夋嫨
+ this.ShowCleanModeSelectView();
};
this.btnModeView = new NormalViewControl(80, 54, true);
btnModeView.Y = btnSuctionView.Y;
@@ -216,31 +226,161 @@
btnTitleName.TextID = StringId.WeepRobot;
FrameWhiteCentet2.AddChidren(btnTitleName);
+ //2021.03.09 鑸嶅純鑰楁潗绠$悊
//鑰楁潗绠$悊
- var rowManment = new FrameRowControl();
- rowManment.Height = Application.GetRealHeight(50);
- rowManment.Width = FrameWhiteCentet2.Width;
- rowManment.Y = Application.GetRealHeight(75);
- FrameWhiteCentet2.AddChidren(rowManment);
- rowManment.AddLeftCaption(Language.StringByID(StringId.ConsumablesManagement), 200);
- rowManment.AddBottomLine();
- rowManment.AddRightArrow();
- rowManment.ButtonClickEvent += (sender, e) =>
- {
- };
+ //var rowManment = new FrameRowControl();
+ //rowManment.Height = Application.GetRealHeight(50);
+ //rowManment.Width = FrameWhiteCentet2.Width;
+ //rowManment.Y = Application.GetRealHeight(75);
+ //FrameWhiteCentet2.AddChidren(rowManment);
+ //rowManment.AddLeftCaption(Language.StringByID(StringId.ConsumablesManagement), 200);
+ //rowManment.AddBottomLine();
+ //rowManment.AddRightArrow();
+ //rowManment.ButtonClickEvent += (sender, e) =>
+ //{
+ // var form = new TuyaWeepRobotConsumablesMagPage();
+ // form.AddForm(this.device, this.weepRobotData);
+ //};
//鍘嗗彶璁板綍
var rowHistory = new FrameRowControl();
rowHistory.Height = Application.GetRealHeight(50);
rowHistory.Width = FrameWhiteCentet2.Width;
- rowHistory.Y = rowManment.Bottom;
+ //rowHistory.Y = rowManment.Bottom;
+ rowHistory.Y = Application.GetRealHeight(75);
FrameWhiteCentet2.AddChidren(rowHistory);
rowHistory.AddLeftCaption(Language.StringByID(StringId.HistoryLog), 200);
rowHistory.AddBottomLine();
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 == "quiet", () =>
+ {
+ 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 == "strong", () =>
+ {
+ 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();
+
+ //2021.03.09 鑸嶅純闅忔満娓呮壂
+ //鑿滃崟鎺т欢(娓呮壂妯″紡)
+ //var menuContr = new DialogTitleMenuControl(4, Language.StringByID(StringId.CleanMode));
+ var menuContr = new DialogTitleMenuControl(3, Language.StringByID(StringId.CleanMode));
+ menuContr.X = Application.GetRealWidth(210);
+ menuContr.Y = Application.GetRealHeight(197);
+ menuContr.Width = Application.GetRealWidth(160);
+ //menuContr.Height = Application.GetRealHeight(243);
+ menuContr.Height = Application.GetRealHeight(203);
+ dialogBody.AddChidren(menuContr);
+
+ //鑷姩娓呮壂
+ var iconPath = this.weepRobotData.Mode == "smart" ? "FunctionIcon/Electrical/WeepRobot/AutoModeSelect.png" : "FunctionIcon/Electrical/WeepRobot/AutoMode.png";
+ menuContr.AddRowMenu(Language.StringByID(StringId.AutoClean), iconPath, this.weepRobotData.Mode == "smart", () =>
+ {
+ frameBack.Close();
+ //鍙戦�佹ā寮忓懡浠�
+ this.SendComand("mode", "smart");
+ });
+
+ //闅忔満娓呮壂
+ //iconPath = this.weepRobotData.Mode == "random" ? "FunctionIcon/Electrical/WeepRobot/FixedPointModeSelect.png" : "FunctionIcon/Electrical/WeepRobot/FixedPointMode.png";
+ //menuContr.AddRowMenu(Language.StringByID(StringId.RandomClean), iconPath, this.weepRobotData.Mode == "random", () =>
+ //{
+ // frameBack.Close();
+ // //鍙戦�佹ā寮忓懡浠�
+ // this.SendComand("mode", "random");
+ //});
+
+ //铻烘棆娓呮壂
+ iconPath = this.weepRobotData.Mode == "spiral" ? "FunctionIcon/Electrical/WeepRobot/AreaModeSelect.png" : "FunctionIcon/Electrical/WeepRobot/AreaMode.png";
+ menuContr.AddRowMenu(Language.StringByID(StringId.SpiralClean), 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 +407,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 +476,92 @@
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 = true;
+ this.btnSuctionIcon.CanClick = true;
+ //澹伴煶涓嶅彲鐢�
+ //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 = false;
+ this.btnSuctionIcon.CanClick = false;
+ //澹伴煶鍙敤
+ //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;
+ }
+ //2021.03.09 鑸嶅純闅忔満娓呮壂
+ //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.RandomClean;
+ //}
+ 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.SpiralClean;
+ }
+ 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
@@ -325,41 +573,42 @@
/// </summary>
private void RefreshNowDeviceStatuMemory(Function i_LocalDevice)
{
- foreach (var data in i_LocalDevice.attributes)
+ for (int i = 0; i < i_LocalDevice.attributes.Count; i++)
{
+ var data = i_LocalDevice.attributes[i];
//寮�鍏�
- if (data.key == "on_off") { this.weepRobotData.Open = data.realValue.ToLower() == "on"; }
+ if (data.key == "on_off") { this.weepRobotData.Cleaning = data.state.ToLower() == "on"; }
//瀵绘壘鏈哄櫒
- else if (data.key == "seek") { this.weepRobotData.SearchRobot = data.realValue.ToLower() == "true"; }
+ else if (data.key == "seek") { this.weepRobotData.SearchRobot = data.state.ToLower() == "true"; }
//杈瑰埛閲嶇疆
- else if (data.key == "reset_edge_brush") { this.weepRobotData.ResetEdgeBrush = data.realValue.ToLower() == "true"; }
+ else if (data.key == "reset_edge_brush") { this.weepRobotData.ResetEdgeBrush = data.state.ToLower() == "true"; }
//婊氬埛閲嶇疆
- else if (data.key == "reset_roll_brush") { this.weepRobotData.ResetRollBrush = data.realValue.ToLower() == "true"; }
+ else if (data.key == "reset_roll_brush") { this.weepRobotData.ResetRollBrush = data.state.ToLower() == "true"; }
//婊ょ綉閲嶇疆
- else if (data.key == "reset_filter") { this.weepRobotData.ResetFilter = data.realValue.ToLower() == "true"; }
+ else if (data.key == "reset_filter") { this.weepRobotData.ResetFilter = data.state.ToLower() == "true"; }
//鍚稿姏閫夋嫨
- else if (data.key == "suction") { this.weepRobotData.Suction = data.realValue; }
+ else if (data.key == "suction") { this.weepRobotData.Suction = data.state; }
//宸ヤ綔妯″紡
- else if (data.key == "mode") { this.weepRobotData.Mode = data.realValue; }
+ else if (data.key == "mode") { this.weepRobotData.Mode = data.state; }
//娓呮壂鏂瑰悜
- else if (data.key == "direction_control") { this.weepRobotData.DirectionControl = data.realValue; }
+ else if (data.key == "direction_control") { this.weepRobotData.DirectionControl = data.state; }
//澹伴煶寮�鍏�
- else if (data.key == "voice_switch") { this.weepRobotData.VoiceSwitch = data.realValue.ToLower() == "true"; }
+ else if (data.key == "voice_switch") { this.weepRobotData.VoiceSwitch = data.state.ToLower() == "true"; }
//娓呮壂闈㈢Н
else if (data.key == "clean_area")
{
- var value = data.realValue;
+ var value = data.state;
if (value != string.Empty)
{
this.weepRobotData.CleanArea = Convert.ToInt32(value);
}
}
//娓呮壂璁板綍
- else if (data.key == "clean_record") { this.weepRobotData.CleanRecord = data.realValue; }
+ else if (data.key == "clean_record") { this.weepRobotData.CleanRecord = data.state; }
//杈瑰埛瀵垮懡
else if (data.key == "edge_brush")
{
- var value = data.realValue;
+ var value = data.state;
if (value != string.Empty)
{
this.weepRobotData.EdgeBrush = Convert.ToInt32(value);
@@ -368,7 +617,7 @@
//婊氬埛瀵垮懡
else if (data.key == "roll_brush")
{
- var value = data.realValue;
+ var value = data.state;
if (value != string.Empty)
{
this.weepRobotData.RollBrush = Convert.ToInt32(value);
@@ -377,7 +626,7 @@
//婊ょ綉瀵垮懡
else if (data.key == "filter")
{
- var value = data.realValue;
+ var value = data.state;
if (value != string.Empty)
{
this.weepRobotData.Filter = Convert.ToInt32(value);
@@ -386,7 +635,7 @@
//娓呮壂鏃堕棿
else if (data.key == "clean_time")
{
- var value = data.realValue;
+ var value = data.state;
if (value != string.Empty)
{
this.weepRobotData.CleanTime = Convert.ToInt32(value);
@@ -395,7 +644,7 @@
//鍓╀綑鐢甸噺
else if (data.key == "electricity_left")
{
- var value = data.realValue;
+ var value = data.state;
if (value != string.Empty)
{
this.weepRobotData.ElectricityLeft = Convert.ToInt32(value);
@@ -411,12 +660,12 @@
/// <summary>
/// 鎵湴鏈哄櫒浜虹殑鏁版嵁
/// </summary>
- private class WeepRobotData
+ public class WeepRobotData
{
/// <summary>
- /// 鏄惁鎵撳紑
+ /// 鏄惁澶勪簬娓呮壂涓�
/// </summary>
- public bool Open = true;
+ public bool Cleaning = false;
/// <summary>
/// 瀵绘壘鏈哄櫒
/// </summary>
@@ -438,7 +687,7 @@
/// </summary>
public string Suction = string.Empty;
/// <summary>
- /// 宸ヤ綔妯″紡(random:鑷姩娓呮壂 smart:瀹氱偣娓呮壂 wall_follow:娌垮娓呮壂 spiral:鍖哄煙娓呮壂 chargego:鍏呯數)
+ /// 宸ヤ綔妯″紡(smart:鑷姩娓呮壂 random:闅忔満娓呮壂 wall_follow:娌垮娓呮壂 spiral:铻烘棆娓呮壂 chargego:鍏呯數)
/// </summary>
public string Mode = string.Empty;
/// <summary>
@@ -470,7 +719,7 @@
/// </summary>
public int Filter = 0;
/// <summary>
- /// 娓呮壂鏃堕棿(0-432000)
+ /// 娓呮壂鏃堕棿(0-432000) 鍗曚綅涓哄垎閽�
/// </summary>
public int CleanTime = 0;
/// <summary>
--
Gitblit v1.8.0