using System;
using Shared;
namespace HDL_ON.UI
{
public partial class AppUnlockSettingsPage
{
void LoadEventList()
{
LoadEvent_OptionChange();
LoadEvent_InitOptionState();
}
///
/// 加载密码选项事件
///
void LoadEvent_OptionChange()
{
EventHandler< MouseEventArgs> eventHandler1 = (sender, e) => {
btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = true;
btnStartupBg.IsSelected = btnStartupSelectionIcon.IsSelected = btnStartupSelectionTip.IsSelected = false;
btnSecurityBg.IsSelected = btnSecuritySelectionIcon.IsSelected = btnSecuritySelectionTip.IsSelected = false;
btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = false;
btnTipMsg.TextID = StringId.UnprotectedTipMsg;
btnTipMsg.Visible = true;
MainPage.LoginUser.appUnlock = new System.Collections.Generic.List();
MainPage.LoginUser.SaveUserInfo();
};
btnUnprotectedBg.MouseUpEventHandler = eventHandler1;
btnUnprotectedSelectionIcon.MouseUpEventHandler = eventHandler1;
btnUnprotectedSelectionTip.MouseUpEventHandler = eventHandler1;
EventHandler eventHandler2 = (sender, e) => {
btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = false;
btnStartupBg.IsSelected = btnStartupSelectionIcon.IsSelected = btnStartupSelectionTip.IsSelected = true;
btnTipMsg.Text = Language.StringByID(StringId.AtStartupTipMsg);
btnTipMsg.Visible = true;
if (!MainPage.LoginUser.appUnlock.Contains("1"))
{
MainPage.LoginUser.appUnlock.Add("1");
MainPage.LoginUser.SaveUserInfo();
}
};
btnStartupBg.MouseUpEventHandler = eventHandler2;
btnStartupSelectionIcon.MouseUpEventHandler = eventHandler2;
btnStartupSelectionTip.MouseUpEventHandler = eventHandler2;
EventHandler eventHandler3 = (sender, e) => {
btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = false;
btnSecurityBg.IsSelected = btnSecuritySelectionIcon.IsSelected = btnSecuritySelectionTip.IsSelected = true;
btnTipMsg.Text = Language.StringByID(StringId.DefenseAndUndefenseTipMsg);
btnTipMsg.Visible = true;
if (!MainPage.LoginUser.appUnlock.Contains("2"))
{
MainPage.LoginUser.appUnlock.Add("2");
MainPage.LoginUser.SaveUserInfo();
}
};
btnSecurityBg.MouseUpEventHandler = eventHandler3;
btnSecuritySelectionIcon.MouseUpEventHandler = eventHandler3;
btnSecuritySelectionTip.MouseUpEventHandler = eventHandler3;
EventHandler eventHandler4 = (sender, e) => {
btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = false;
btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = true;
btnTipMsg.Text = Language.StringByID(StringId.RemoteUnlockingTipMsg);
btnTipMsg.Visible = true;
if (!MainPage.LoginUser.appUnlock.Contains("3"))
{
MainPage.LoginUser.appUnlock.Add("3");
MainPage.LoginUser.SaveUserInfo();
}
};
btnDoorlockBg.MouseUpEventHandler = eventHandler4;
btnDoorlockSelectionIcon.MouseUpEventHandler = eventHandler4;
btnDoorlockSelectionTip.MouseUpEventHandler = eventHandler4;
}
///
/// 加载用户密码选项状态
///
void LoadEvent_InitOptionState()
{
if (MainPage.LoginUser.appUnlock.Count == 0)
{
btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = true;
}
else
{
if (MainPage.LoginUser.appUnlock.Contains("1"))
{
btnStartupBg.IsSelected = btnStartupSelectionIcon.IsSelected = btnStartupSelectionTip.IsSelected = true;
}
if (MainPage.LoginUser.appUnlock.Contains("2"))
{
btnSecurityBg.IsSelected = btnSecuritySelectionIcon.IsSelected = btnSecuritySelectionTip.IsSelected = true;
}
if (MainPage.LoginUser.appUnlock.Contains("3"))
{
btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = true;
}
}
}
///
/// 密码设置跳转事件列表
///
void LoadEvet_SkipEventList()
{
btnPasswordUnlockTitle.MouseUpEventHandler = (sender, e) =>
{
var page = new AppUnlockPasswordSettingPage(MainPage.LoginUser.appUnlockPasswrod);
MainPage.BasePageView.AddChidren(page);
page.LoadPage();
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
};
}
}
}