wxr
2020-03-05 0bdc0a135dbe31761b53f432ed34f347f0a4e36b
HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPage.cs
@@ -82,7 +82,13 @@
                });
            btnEditName.MouseUpEventHandler += (sender, e) => {
                LoadEditFunctionNameView();
                //创建回调事件
                Action<string> callBackAction = (name) =>
                {
                    function.name = name;
                    DB_ResidenceData.residenceData.SaveResidenceData();
                };
                new PublicAssmebly().LoadDialog_EditParater(StringId.ChangeName, function.name, callBackAction);
            };
@@ -221,128 +227,6 @@
        }
        void LoadEditFunctionNameView()
        {
            Dialog dialog = new Dialog()
            {
                BackgroundColor = 0x99000000,
            };
            FrameLayout dialogView = new FrameLayout()
            {
                Gravity = Gravity.Center,
                Width = Application.GetRealWidth(270),
                Height = Application.GetRealHeight(172),
                BackgroundColor = CSS.CSS_Color.MainBackgroundColor,
                BorderColor = 0x00000000,
                BorderWidth = 0,
                Radius = (uint)Application.GetMinRealAverage(10),
            };
            dialog.AddChidren(dialogView);
            Button btnTitle = new Button()
            {
                Y = Application.GetRealHeight(10),
                Height = Application.GetRealHeight(42),
                TextColor = CSS.CSS_Color.MainColor,
                TextSize = CSS.CSS_FontSize.SubheadingFontSize,
                TextAlignment = TextAlignment.Center,
                IsBold = true,
                TextID = StringId.ChangeName,
            };
            dialogView.AddChidren(btnTitle);
            FrameLayout editView = new FrameLayout()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = btnTitle.Bottom + Application.GetRealHeight(6),
                Width = Application.GetRealWidth(222),
                Height = Application.GetRealHeight(44),
                BackgroundColor = CSS.CSS_Color.BackgroundColor,
                BorderColor = 0x00000000,
                BorderWidth = 0,
                Radius = (uint)Application.GetMinRealAverage(4),
            };
            dialogView.AddChidren(editView);
            EditText etName = new EditText()
            {
                X = Application.GetRealWidth(12),
                Width = Application.GetRealWidth(182),
                Text = function.name,
                TextColor = CSS.CSS_Color.FirstLevelTitleColor,
                TextSize = CSS.CSS_FontSize.TextFontSize,
            };
            editView.AddChidren(etName);
            Button btnLine = new Button()
            {
                Y = Application.GetRealHeight(128),
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS.CSS_Color.DividingLineColor,
            };
            dialogView.AddChidren(btnLine);
            Button btnCancel = new Button()
            {
                Y = btnLine.Bottom,
                Width = Application.GetRealWidth(134),
                Height = Application.GetRealHeight(43),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS.CSS_Color.TextualColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                SelectedTextColor = CSS_Color.MainBackgroundColor,
                SelectedBackgroundColor = CSS_Color.MainColor,
                TextID = StringId.Cancel,
            };
            dialogView.AddChidren(btnCancel);
            Button btnBottomLine = new Button()
            {
                X = btnCancel.Right,
                Y = btnLine.Bottom,
                Height = Application.GetRealHeight(43),
                Width = Application.GetRealWidth(1),
                BackgroundColor = CSS_Color.DividingLineColor,
            };
            dialogView.AddChidren(btnBottomLine);
            Button btnConfirm = new Button()
            {
                X = btnBottomLine.Right,
                Y = btnLine.Bottom,
                Width = Application.GetRealWidth(135),
                Height = Application.GetRealHeight(43),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS.CSS_Color.TextualColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                SelectedTextColor = CSS_Color.MainBackgroundColor,
                SelectedBackgroundColor = CSS_Color.MainColor,
                TextID = StringId.Confirm,
            };
            dialogView.AddChidren(btnConfirm);
            dialog.Show();
            btnCancel.MouseDownEventHandler += (sender, e) => {
                btnCancel.IsSelected = true;
            };
            btnCancel.MouseUpEventHandler += (sender, e) => {
                btnCancel.IsSelected = false;
                dialog.Close();
            };
            btnConfirm.MouseDownEventHandler += (sender, e) => {
                btnConfirm.IsSelected = true;
            };
            btnConfirm.MouseUpEventHandler += (sender, e) => {
                btnConfirm.IsSelected = false;
                function.name = etName.Text.Trim();
                DB_ResidenceData.residenceData.SaveResidenceData();
                dialog.Close();
            };
        }
    }
}