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
|
{
|
//开启需要确认
|
HdlMessageLogic.Current.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
|
}
|
}
|