HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2019-09-30 404cdc88627f942df7944af04ee05b9d527752d6
ZigbeeApp/Shared/Phone/UserCenter/HdlBackup/HdlAutoBackupSettionForm.cs
@@ -7,134 +7,135 @@
    /// <summary>
    /// 自动备份的设置界面
    /// </summary>
    public class HdlAutoBackupSettionForm : UserCenterCommonForm
    public class HdlAutoBackupSettionForm : EditorCommonForm
    {
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
        public void ShowForm()
        {
            //设置标题信息
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
        public void ShowForm()
        {
            //设置标题信息
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAutoBackupSettion));
            //初始化中部控件
            this.InitMiddleFrame();
            //初始化中部控件
            //this.InitMiddleFrame();
        }
        /// <summary>
        /// 初始化中部控件
        /// </summary>
        private void InitMiddleFrame()
        {
            bodyFrameLayout.RemoveAll();
        ///// <summary>
        ///// 初始化中部控件
        ///// </summary>
        //private void InitMiddleFrame()
        //{
        //    //清空bodyFrame
        //    this.ClearBodyFrame();
            //信息行
            var msgRow = new FrameLayout();
            msgRow.Y = Application.GetRealHeight(40);
            msgRow.Height = ControlCommonResourse.NormalControlHeight;
            bodyFrameLayout.AddChidren(msgRow);
        //    //信息行
        //    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 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);
        //    //立即备份(推荐)
        //    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");
            };
        //    statuBackupRow.AddRightArrow();
        //    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);
        //    //暂不提醒
        //    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();
            };
        //    statuNextRow.AddRightArrow();
        //    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);
        //    //不再提示
        //    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");
            };
        }
        //    statuNotRow.AddRightArrow();
        //    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 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);
        ///// <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);
        //        return;
        //    }
        //    //数据成功上传到服务器
        //    string msg2 = Language.StringByID(R.MyInternationalizationString.uSynchronizeDataToServiceSuccessMsg);
        //    this.ShowMassage(msg2);
            Application.RunOnMainThread(() =>
            {
                this.CloseForm();
            });
        }
        //    Application.RunOnMainThread(() =>
        //    {
        //        this.CloseForm();
        //    });
        //}
        /// <summary>
        /// 执行不再提示
        /// </summary>
        public void DoNotPrompted()
        {
            HdlAutoBackupLogic.SaveBackupNotPrompted(true);
            this.CloseForm();
        }
        ///// <summary>
        ///// 执行不再提示
        ///// </summary>
        //public void DoNotPrompted()
        //{
        //    HdlAutoBackupLogic.SaveBackupNotPrompted(true);
        //    this.CloseForm();
        //}
    }
}