using System;
|
using System.Collections.Generic;
|
using HDL_ON.UI.UI2.Intelligence.Automation.LogicView;
|
using HDL_ON.UI.UI2.PersonalCenter.PirDevice.View;
|
using Shared;
|
namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice
|
{
|
|
public class SetPir : FrameLayout
|
{
|
public SetPir()
|
{
|
Tag = "PirView";
|
}
|
public void Show()
|
{
|
#region 界面布局
|
this.BackgroundColor = CSS.CSS_Color.viewMiddle;
|
Intelligence.Automation.LogicView.TopView topView = new Intelligence.Automation.LogicView.TopView();
|
this.AddChidren(topView.FLayoutView());
|
topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
|
{
|
RemoveFromParent();
|
};
|
topView.topNameBtn.TextID = StringId.setlogic;
|
FrameLayout viewLayout = new FrameLayout
|
{
|
Y = Application.GetRealHeight(64),
|
Width = Application.GetRealWidth(Intelligence.Automation.LogicView.TextSize.view375),
|
Height = Application.GetRealHeight(Intelligence.Automation.LogicView.TextSize.view667 - 64 - 76),
|
BackgroundColor = CSS.CSS_Color.viewMiddle,
|
};
|
this.AddChidren(viewLayout);
|
///名称
|
FrameLayout50 editNameFLayout = new FrameLayout50();
|
editNameFLayout.btnText.Text = Language.StringByID(StringId.yaokongqimingcheng) + ":";
|
editNameFLayout.btnEditText.Text = Pir.currPir.name;
|
editNameFLayout.btnNextIcon.Height = Application.GetRealWidth(28);
|
editNameFLayout.btnNextIcon.Width = Application.GetRealWidth(28);
|
editNameFLayout.btnNextIcon.UnSelectedImagePath = "LogicIcon/editname.png";
|
viewLayout.AddChidren(editNameFLayout.FLayoutView());
|
/////版本升级
|
//FrameLayout50 banbenshengjiFL = new FrameLayout50();
|
//banbenshengjiFL.btnText.Text = Language.StringByID(StringId.banbenshengji);
|
//banbenshengjiFL.frameLayout.Y = editNameFLayout.frameLayout.Bottom;
|
//viewLayout.AddChidren(banbenshengjiFL.FLayoutView());
|
|
var versions = Pir.currPir.versions.Find((c)=>c.module== "fw_version");
|
if (versions == null)
|
{
|
versions = new Entity.VersionInfo();
|
}
|
///版本号:v1.3.5
|
FrameLayout50 banbenhaoFLayout = new FrameLayout50();
|
banbenhaoFLayout.btnNextIcon.Visible = false;
|
banbenhaoFLayout.btnText.Text = Language.StringByID(StringId.banbenhao) + ":"+ versions.version;
|
banbenhaoFLayout.frameLayout.Y = editNameFLayout.frameLayout.Bottom;// banbenshengjiFL.frameLayout.Bottom;
|
viewLayout.AddChidren(banbenhaoFLayout.FLayoutView());
|
//删除
|
FrameLayout frameLayout = new FrameLayout
|
{
|
Y = Application.GetRealHeight(Intelligence.Automation.LogicView.TextSize.view667 - 50),
|
Height = Application.GetRealHeight(50),
|
BackgroundColor = CSS.CSS_Color.view,
|
Gravity = Gravity.BottomCenter,//置底的属性
|
};
|
this.AddChidren(frameLayout);
|
Button btnDel = new Button
|
{
|
TextSize = Intelligence.Automation.LogicView.TextSize.text16,
|
Width = Application.GetRealWidth(50),
|
Height = Application.GetRealHeight(22),
|
TextColor = CSS.CSS_Color.textRedColor,
|
Gravity = Gravity.Center,
|
TextID = StringId.Del,
|
};
|
frameLayout.AddChidren(btnDel);
|
#endregion
|
#region 界面点击事件
|
//修改名称的点击事件
|
editNameFLayout.btnClick.MouseUpEventHandler += (sender, e) =>
|
{
|
List<string> list = new List<string>();
|
PirMethod method = new PirMethod();
|
method.EditControlName(StringId.editName, list, Pir.currPir.name, (name, dialog) =>
|
{
|
PirMethod.ThreadSend(new Control { deviceId = Pir.currPir.deviceId, name = name }, (responsePackNew) =>
|
{
|
dialog.Close();
|
editNameFLayout.btnEditText.Text = name;
|
Pir.currPir.name = name;
|
|
}, "修改名称", "dialog", null, dialog);
|
|
}, () => { });
|
};
|
//删除红外宝的点击事件
|
EventHandler<MouseEventArgs> delClick = (sender, e) =>
|
{
|
string text = Language.StringByID(StringId.shanchushebei) + Pir.currPir.name + "?";
|
TipPopView tipPopView = new TipPopView();
|
tipPopView.TipBox(StringId.tip, text, (dialog) =>
|
{
|
|
PirMethod.ThreadSend(new Control { deviceId = Pir.currPir.deviceId }, (responsePackNew) =>
|
{
|
var pir = Pir.pirDeviceList.Find((c) => c.deviceId == Pir.currPir.deviceId);
|
if (pir != null)
|
{
|
Pir.pirDeviceList.Remove(Pir.currPir);
|
}
|
dialog.Close();
|
this.RemoveFromParent();
|
PirMethod.RemoveView("PirMain");
|
}, "删除", "dialog", null, dialog);
|
|
}, () =>
|
{
|
}, false);
|
|
|
};
|
btnDel.MouseUpEventHandler += delClick;
|
frameLayout.MouseUpEventHandler += delClick;
|
#endregion
|
|
}
|
/// <summary>
|
/// 移除界面
|
/// </summary>
|
public override void RemoveFromParent()
|
{
|
//刷新PirMain界面
|
PirMethod.RefreshView("PirMain");
|
base.RemoveFromParent();
|
|
}
|
}
|
}
|