黄学彪
2020-12-17 9f326f4000847e6167d8166fa2f6a66f53cb3734
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
using System;
using System.Collections.Generic;
using System.Text;
 
namespace Shared.Phone.UserCenter.HdlBackup
{
    /// <summary>
    /// 自动备份的界面
    /// </summary>
    public class HdlAutoBackupForm : EditorCommonForm
    {
        #region ■ 变量声明___________________________
 
        #endregion
 
        #region ■ 初始化_____________________________
 
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
        public void ShowForm()
        {
            //初始化中部信息
            this.InitMiddleFrame();
        }
 
        /// <summary>
        /// 初始化中部信息
        /// </summary>
        private void InitMiddleFrame()
        {
            //清空bodyFrame
            this.ClearBodyFrame();
 
            //body占完整个屏幕
            bodyFrameLayout.Y = 0;
            bodyFrameLayout.Height = HdlControlResourse.TopMenuFrameHeight + HdlControlResourse.TopFrameHeight
                + HdlControlResourse.BodyFrameHeight;
 
            var btnPic = new PicViewControl(991, 438, true);
            btnPic.UnSelectedImagePath = "Item/AutoBackup.png";
            btnPic.Y = Application.GetRealHeight(374);
            bodyFrameLayout.AddChidren(btnPic);
 
            //自动备份
            var btnAuto = new NormalViewControl(400, 85, true);
            btnAuto.Y = Application.GetRealHeight(876);
            btnAuto.Gravity = Gravity.CenterHorizontal;
            btnAuto.TextID = R.MyInternationalizationString.uAutoBackup;
            btnAuto.TextSize = 20;
            btnAuto.TextAlignment = TextAlignment.Center;
            bodyFrameLayout.AddChidren(btnAuto);
 
            //检测到数据更新,是否需要备份
            var btnMsg = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false);
            btnMsg.Y = btnAuto.Bottom + Application.GetRealHeight(23);
            btnMsg.TextID = R.MyInternationalizationString.uIsHadNotBackupDataOnScan;
            btnMsg.TextAlignment = TextAlignment.Center;
            btnMsg.TextColor = UserCenterColor.Current.TextGrayColor1;
            bodyFrameLayout.AddChidren(btnMsg);
 
            //立即备份(推荐)
            var frameback = new FrameLayoutStatuControl();
            frameback.UseClickStatu = false;
            frameback.Y = Application.GetRealHeight(1201);
            frameback.Gravity = Gravity.CenterHorizontal;
            frameback.Width = Application.GetRealWidth(746);
            frameback.Height = Application.GetRealHeight(184);
            frameback.BackgroundImagePath = "Item/BottomButtonGround.png";
            bodyFrameLayout.AddChidren(frameback);
            var btnBackup = new NormalViewControl(400, 65, true);
            btnBackup.IsBold = true;
            btnBackup.TextColor = UserCenterColor.Current.White;
            btnBackup.TextSize = 16;
            btnBackup.Y = Application.GetRealHeight(49);
            btnBackup.Gravity = Gravity.CenterHorizontal;
            btnBackup.TextAlignment = TextAlignment.Center;
            btnBackup.Text = Language.StringByID(R.MyInternationalizationString.uImmediatelyBackup) + "(" + Language.StringByID(R.MyInternationalizationString.uRecommendation) + ")";
            frameback.AddChidren(btnBackup, ChidrenBindMode.BindEvent);
            frameback.ButtonClickEvent += (sender, e) =>
            {
                HdlThreadLogic.Current.RunThread(() =>
                {
                    //上传数据
                    this.UpLoadBackupInfo();
                });
            };
 
            //暂不提醒
            var btnRemind = new NormalViewControl(688, 127, true);
            btnRemind.Y = frameback.Bottom + Application.GetRealHeight(52);
            btnRemind.Gravity = Gravity.CenterHorizontal;
            btnRemind.Radius = (uint)Application.GetRealHeight(127) / 2;
            btnRemind.BorderWidth = 1;
            btnRemind.BorderColor = UserCenterColor.Current.TextOrangeColor;
            btnRemind.TextAlignment = TextAlignment.Center;
            btnRemind.TextSize = 16;
            btnRemind.TextColor = UserCenterColor.Current.TextGrayColor3;
            btnRemind.TextID = R.MyInternationalizationString.uTemporaryStopRemind;
            bodyFrameLayout.AddChidren(btnRemind);
            btnRemind.ButtonClickEvent += (sender, e) =>
            {
                //一天之内不再提醒
                HdlBackupLogic.Current.SaveBackupNotPrompted(false, 1);
                this.CloseForm();
            };
        }
 
        #endregion
 
        #region ■ 上传数据___________________________
 
        /// <summary>
        /// 上传数据
        /// </summary>
        private void UpLoadBackupInfo()
        {
            int result = HdlBackupLogic.Current.DoUpLoadAutoBackupDataByHand();
            if (result == -1)
            {
                //文件上传失败
                string msg = Language.StringByID(R.MyInternationalizationString.uFileUpLoadFail);
                this.ShowMassage(ShowMsgType.Error, msg);
 
                return;
            }
            //数据成功上传到服务器
            string msg2 = Language.StringByID(R.MyInternationalizationString.uSynchronizeDataToServiceSuccessMsg);
            this.ShowMassage(ShowMsgType.Tip, msg2);
 
            HdlThreadLogic.Current.RunMain(() =>
            {
                this.CloseForm();
            });
        }
 
        #endregion
    }
}