using System;
|
using System.Collections.Generic;
|
using System.Text;
|
|
namespace Shared.Phone.UserCenter.Safety
|
{
|
/// <summary>
|
/// 胁迫密码设置的菜单界面★
|
/// </summary>
|
public class CoercePasswordMainForm : UserCenterCommonForm
|
{
|
/// <summary>
|
/// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
/// </summary>
|
public void ShowForm()
|
{
|
//设置头部信息
|
base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uCoercePasswordSettion));
|
|
//初始化中部信息
|
this.InitMiddleFrame();
|
}
|
|
/// <summary>
|
/// 初始化中部信息
|
/// </summary>
|
public void InitMiddleFrame()
|
{
|
bodyFrameLayout.RemoveAll();
|
|
//密码设置
|
string text = Language.StringByID(R.MyInternationalizationString.uPasswordSettion);
|
var rowPsw = new OnlyCenterViewRow(text);
|
//将图标控件适配为【点号】控件
|
rowPsw.ChangedIconInPointMode();
|
bodyFrameLayout.AddChidren(rowPsw);
|
rowPsw.InitControl();
|
//点号图片有点特殊,需要调整偏移量
|
rowPsw.btnName.X -= ControlCommonResourse.PointXXLeft;
|
|
//添加向右的图标
|
rowPsw.AddRightIconControl();
|
//状态
|
var btnStatuPsw = new RowSecondRightTextView();
|
rowPsw.AddChidren(btnStatuPsw);
|
|
rowPsw.MouseUpEvent += (sender, e) =>
|
{
|
var form = new EdtiorCoercePasswordForm();
|
this.AddForm(form, btnStatuPsw.TextColor != UserCenterColor.Current.Green);
|
};
|
|
//联系人设置
|
text = Language.StringByID(R.MyInternationalizationString.uContactSettion);
|
var rowContact = new OnlyCenterViewRow(text);
|
rowContact.Y = rowPsw.Bottom;
|
//将图标控件适配为【点号】控件
|
rowContact.ChangedIconInPointMode();
|
bodyFrameLayout.AddChidren(rowContact);
|
rowContact.InitControl();
|
//点号图片有点特殊,需要调整偏移量
|
rowContact.btnName.X -= ControlCommonResourse.PointXXLeft;
|
|
//添加向右的图标
|
rowContact.AddRightIconControl();
|
//状态
|
var btnStaturowContact = new RowSecondRightTextView();
|
rowContact.AddChidren(btnStaturowContact);
|
|
rowContact.MouseUpEvent += (sender, e) =>
|
{
|
var form = new CoerceContactSettionForm();
|
this.AddForm(form, btnStaturowContact.Tag);
|
};
|
|
//设置行的状态
|
this.SetRowStatu(btnStatuPsw, btnStaturowContact);
|
}
|
|
/// <summary>
|
/// 设置行的状态
|
/// </summary>
|
/// <param name="btnStatuPsw"></param>
|
/// <param name="btnStaturowContact"></param>
|
private async void SetRowStatu(RowSecondRightTextView btnStatuPsw, RowSecondRightTextView btnStaturowContact)
|
{
|
//开启进度条
|
this.ShowProgressBar();
|
|
//判断是否设置有胁迫密码
|
var listData = await Common.LocalSafeguard.Current.GetAllUserPassword();
|
bool isEsixt = false;
|
if (listData != null)
|
{
|
foreach (var data in listData)
|
{
|
if (data.UserId == 5)
|
{
|
isEsixt = true;
|
break;
|
}
|
}
|
}
|
else
|
{
|
//关闭进度条
|
this.CloseProgressBar(ShowReLoadMode.YES);
|
return;
|
}
|
|
if (isEsixt == true)
|
{
|
Application.RunOnMainThread(() =>
|
{
|
//已设置
|
btnStatuPsw.TextID = R.MyInternationalizationString.uAlreadySettion;
|
btnStatuPsw.TextColor = UserCenterColor.Current.Green;
|
});
|
}
|
else
|
{
|
Application.RunOnMainThread(() =>
|
{
|
//未设置
|
btnStatuPsw.TextID = R.MyInternationalizationString.uNotHadSettion;
|
btnStatuPsw.TextColor = UserCenterColor.Current.Gray;
|
});
|
}
|
|
//获取联系方式
|
var result = await Common.LocalSafeguard.Current.GetCoercePhoneNumber();
|
if (result == null || result.Actions.Count == 0 || result.Actions[0].PushTarget.Count == 0)
|
{
|
Application.RunOnMainThread(() =>
|
{
|
//未设置
|
btnStaturowContact.TextID = R.MyInternationalizationString.uNotHadSettion;
|
btnStaturowContact.TextColor = UserCenterColor.Current.Gray;
|
var data = new List<ZigBee.Device.Safeguard.PushTargetInfo>();
|
btnStaturowContact.Tag = data;
|
});
|
}
|
else
|
{
|
Application.RunOnMainThread(() =>
|
{
|
//已设置
|
btnStaturowContact.TextID = R.MyInternationalizationString.uAlreadySettion;
|
btnStaturowContact.TextColor = UserCenterColor.Current.Green;
|
btnStaturowContact.Tag = result.Actions[0].PushTarget;
|
});
|
}
|
|
//关闭进度条
|
this.CloseProgressBar();
|
}
|
}
|
}
|