using System;
|
using System.Collections.Generic;
|
using System.Text;
|
|
namespace Shared.Phone.UserCenter.HdlBackup
|
{
|
/// <summary>
|
/// 自动备份的设置界面
|
/// </summary>
|
public class HdlAutoBackupSettionForm : UserCenterCommonForm
|
{
|
/// <summary>
|
/// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
/// </summary>
|
public void ShowForm()
|
{
|
//设置标题信息
|
base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAutoBackupSettion));
|
|
//初始化中部控件
|
this.InitMiddleFrame();
|
}
|
|
/// <summary>
|
/// 初始化中部控件
|
/// </summary>
|
private void InitMiddleFrame()
|
{
|
bodyFrameLayout.RemoveAll();
|
|
//信息行
|
var msgRow = new FrameLayout();
|
msgRow.Y = Application.GetRealHeight(40);
|
msgRow.Height = ControlCommonResourse.NormalControlHeight;
|
bodyFrameLayout.AddChidren(msgRow);
|
|
//检测到数据更新,是否需要备份
|
var btnMsg = new RowCenterView(false);
|
btnMsg.TextID = R.MyInternationalizationString.uIsHadNotBackupDataOnScan;
|
msgRow.AddChidren(btnMsg);
|
|
//立即备份(推荐)
|
var statuBackupRow = new StatuRowLayout();
|
statuBackupRow.Y = msgRow.Bottom;
|
bodyFrameLayout.AddChidren(statuBackupRow);
|
var btnBackup = new RowCenterView(false);
|
string txtValue = Language.StringByID(R.MyInternationalizationString.uImmediatelyBackup);
|
txtValue += " (" + Language.StringByID(R.MyInternationalizationString.uRecommendation) + ")";
|
btnBackup.Text = txtValue;
|
statuBackupRow.AddChidren(btnBackup);
|
|
statuBackupRow.AddRightIconControl();
|
statuBackupRow.MouseUpEvent += (sender, e) =>
|
{
|
//确认是否上传数据到服务器?
|
string msg = Language.StringByID(R.MyInternationalizationString.uSynchronizeDataToServiceMsg);
|
this.ShowConfirmMsg(msg, "UpLoadBackupInfo");
|
};
|
|
//暂不提醒
|
var statuNextRow = new StatuRowLayout();
|
statuNextRow.Y = statuBackupRow.Bottom;
|
bodyFrameLayout.AddChidren(statuNextRow);
|
var btnNext = new RowCenterView(false);
|
btnNext.TextID = R.MyInternationalizationString.uTemporaryStopRemind;
|
statuNextRow.AddChidren(btnNext);
|
|
statuNextRow.AddRightIconControl();
|
statuNextRow.MouseUpEvent += (sender, e) =>
|
{
|
HdlAutoBackupLogic.SaveBackupNotPrompted(false, 3);
|
this.CloseForm();
|
};
|
|
//不再提示
|
var statuNotRow = new StatuRowLayout();
|
statuNotRow.Y = statuNextRow.Bottom;
|
bodyFrameLayout.AddChidren(statuNotRow);
|
var btnNotReminder = new RowCenterView(false);
|
btnNotReminder.TextID = R.MyInternationalizationString.uNotPrompted;
|
statuNotRow.AddChidren(btnNotReminder);
|
|
statuNotRow.AddRightIconControl();
|
statuNotRow.MouseUpEvent += (sender, e) =>
|
{
|
//确认不再提示?
|
string msg = Language.StringByID(R.MyInternationalizationString.uConfirmNotPrompted);
|
this.ShowConfirmMsg(msg, "DoNotPrompted");
|
};
|
}
|
|
/// <summary>
|
/// 上传数据
|
/// </summary>
|
public void UpLoadBackupInfo()
|
{
|
//回避界面卡死问题
|
new System.Threading.Thread(() =>
|
{
|
//上传数据
|
this.UpLoadBackupInfoAsync();
|
})
|
{ IsBackground = true }.Start();
|
|
}
|
|
/// <summary>
|
/// 上传数据
|
/// </summary>
|
public async void UpLoadBackupInfoAsync()
|
{
|
int result = await HdlAutoBackupLogic.DoUpLoadAutoBackupData();
|
if (result == -1)
|
{
|
//文件上传失败
|
string msg = Language.StringByID(R.MyInternationalizationString.uFileUpLoadFail);
|
this.ShowErrorMsg(msg);
|
|
return;
|
}
|
//数据成功上传到服务器
|
string msg2 = Language.StringByID(R.MyInternationalizationString.uSynchronizeDataToServiceSuccessMsg);
|
this.ShowTip(msg2);
|
|
Application.RunOnMainThread(() =>
|
{
|
this.CloseForm();
|
});
|
}
|
|
/// <summary>
|
/// 执行不再提示
|
/// </summary>
|
public void DoNotPrompted()
|
{
|
HdlAutoBackupLogic.SaveBackupNotPrompted(true);
|
this.CloseForm();
|
}
|
}
|
}
|