CrabtreeOn,印度客户定制APP,迁移2.0平台版本
JLChen
2021-03-04 b9499ebd860508e3026193ded9c412075c953b23
Crabtree/SmartHome/UI/SimpleControl/Phone/Warning/WarningList.cs
@@ -1,138 +1,138 @@
using System;
namespace Shared.SimpleControl.Phone
{
    public class WarningList : FrameLayout
    {
        public void ShowWarningListPage ()
        {
            RemoveAll ();
            FrameLayout bodyView = new FrameLayout () {
                BackgroundColor = SkinStyle.Current.MainColor
            };
            AddChidren (bodyView);
            #region 标题
            var topView = new FrameLayout () {
                Y = Application.GetRealHeight (36),
                Height = Application.GetRealHeight (90),
            };
            bodyView.AddChidren (topView);
//using System;
//namespace Shared.SimpleControl.Phone
//{
//    public class WarningList : FrameLayout
//    {
//        public void ShowWarningListPage ()
//        {
//            RemoveAll ();
//            FrameLayout bodyView = new FrameLayout () {
//                BackgroundColor = SkinStyle.Current.MainColor
//            };
//            AddChidren (bodyView);
//            #region 标题
//            var topView = new FrameLayout () {
//                Y = Application.GetRealHeight (36),
//                Height = Application.GetRealHeight (90),
//            };
//            bodyView.AddChidren (topView);
            var title = new Button () {
                TextAlignment = TextAlignment.Center,
                TextID = R.MyInternationalizationString.MessageAlert,
                TextSize = 19,
                TextColor = SkinStyle.Current.TextColor1,
            };
            topView.AddChidren (title);
//            var title = new Button () {
//                TextAlignment = TextAlignment.Center,
//                TextID = R.MyInternationalizationString.MessageAlert,
//                TextSize = 19,
//                TextColor = SkinStyle.Current.TextColor1,
//            };
//            topView.AddChidren (title);
            var logo = new Button () {
                Width = Application.GetRealWidth (154),
                Height = Application.GetRealHeight (90),
                X = Application.GetRealWidth (486),
                UnSelectedImagePath = MainPage.LogoString,
            };
            topView.AddChidren (logo);
            var back = new Button () {
                Height = Application.GetRealHeight (90),
                Width = Application.GetRealWidth (85),
                UnSelectedImagePath = "Item/Back.png",
                SelectedImagePath = "Item/BackSelected.png",
                Gravity = Gravity.CenterVertical,
            };
            topView.AddChidren (back);
            back.MouseUpEventHandler += (sender, e) => {
                (Parent as PageLayout).PageIndex -= 1;
            };
            Button btnNullLine = new Button () {
                Y = Application.GetRealHeight (90) -1,
                Height = 1,
                BackgroundColor = SkinStyle.Current.White20Transparent,
            };
            topView.AddChidren (btnNullLine);
//            var logo = new Button () {
//                Width = Application.GetRealWidth (154),
//                Height = Application.GetRealHeight (90),
//                X = Application.GetRealWidth (486),
//                UnSelectedImagePath = MainPage.LogoString,
//            };
//            topView.AddChidren (logo);
//            var back = new Button () {
//                Height = Application.GetRealHeight (90),
//                Width = Application.GetRealWidth (85),
//                UnSelectedImagePath = "Item/Back.png",
//                SelectedImagePath = "Item/BackSelected.png",
//                Gravity = Gravity.CenterVertical,
//            };
//            topView.AddChidren (back);
//            back.MouseUpEventHandler += (sender, e) => {
//                (Parent as PageLayout).PageIndex -= 1;
//            };
//            Button btnNullLine = new Button () {
//                Y = Application.GetRealHeight (90) -1,
//                Height = 1,
//                BackgroundColor = SkinStyle.Current.White20Transparent,
//            };
//            topView.AddChidren (btnNullLine);
            #endregion
            VerticalScrolViewLayout msgView = new VerticalScrolViewLayout () {
                Y = topView.Bottom,
                Height = Application.GetRealHeight (1136 - 90 - 90 -36),
                BackgroundColor = SkinStyle.Current.ViewColor,
            };
            bodyView.AddChidren (msgView);
            for (int i = RemoteInfo.Current.RemoteInfoList.Count; i > 0;i--){
                //foreach (var msg in RemoteInfo.Current.RemoteInfoList) {
                var msg = RemoteInfo.Current.RemoteInfoList [i-1];
                RowLayout rol = new RowLayout () {
                    Height = Application.GetRealHeight (130),
                };
                msgView.AddChidren (rol);
                Button btnIcon = new Button () {
                    X = Application.GetRealWidth (15),
                    Y = Application.GetRealHeight (10),
                    Width = Application.GetRealWidth (105),
                    Height = Application.GetRealHeight (105),
                    UnSelectedImagePath = "RemoteMsg/RemoteMsg.png",
                    SelectedImagePath = "RemoteMsg/RemoteWarining.png",
                    IsSelected = msg.MsgType == "警报" ? true : false,
                    Enable = false,
                };
                rol.AddChidren (btnIcon);
//            #endregion
//            VerticalScrolViewLayout msgView = new VerticalScrolViewLayout () {
//                Y = topView.Bottom,
//                Height = Application.GetRealHeight (1136 - 90 - 90 -36),
//                BackgroundColor = SkinStyle.Current.ViewColor,
//            };
//            bodyView.AddChidren (msgView);
//            for (int i = RemoteInfo.Current.RemoteInfoList.Count; i > 0;i--){
//                //foreach (var msg in RemoteInfo.Current.RemoteInfoList) {
//                var msg = RemoteInfo.Current.RemoteInfoList [i-1];
//                RowLayout rol = new RowLayout () {
//                    Height = Application.GetRealHeight (130),
//                };
//                msgView.AddChidren (rol);
//                Button btnIcon = new Button () {
//                    X = Application.GetRealWidth (15),
//                    Y = Application.GetRealHeight (10),
//                    Width = Application.GetRealWidth (105),
//                    Height = Application.GetRealHeight (105),
//                    UnSelectedImagePath = "RemoteMsg/RemoteMsg.png",
//                    SelectedImagePath = "RemoteMsg/RemoteWarining.png",
//                    IsSelected = msg.MsgType == "警报" ? true : false,
//                    Enable = false,
//                };
//                rol.AddChidren (btnIcon);
                Button btnMsg = new Button () {
                    X = btnIcon.Right,
                    Width = Application.GetRealWidth(620) - btnIcon.Right,
                    Text = msg.Msg,
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor= SkinStyle.Current.TextColor1,
                };
                rol.AddChidren (btnMsg);
                //var msgTime = msg.MsgTime.ToLocalTime ();
                EditText btnDate = new EditText () {
                    Y = Application.GetRealHeight (100),
                    Width = Application.GetRealWidth (620),
                    TextAlignment = TextAlignment.CenterRight,
                    Height = Application.GetRealHeight (40),
                    Text = msg.MsgTime.ToLocalTime ().ToShortDateString () + " " + msg.MsgTime.ToLocalTime ().ToShortTimeString(),
                    TextColor = SkinStyle.Current.TextColor1
                };
                rol.AddChidren (btnDate);
//                Button btnMsg = new Button () {
//                    X = btnIcon.Right,
//                    Width = Application.GetRealWidth(620) - btnIcon.Right,
//                    Text = msg.Msg,
//                    TextAlignment = TextAlignment.CenterLeft,
//                    TextColor= SkinStyle.Current.TextColor1,
//                };
//                rol.AddChidren (btnMsg);
//                //var msgTime = msg.MsgTime.ToLocalTime ();
//                EditText btnDate = new EditText () {
//                    Y = Application.GetRealHeight (100),
//                    Width = Application.GetRealWidth (620),
//                    TextAlignment = TextAlignment.CenterRight,
//                    Height = Application.GetRealHeight (40),
//                    Text = msg.MsgTime.ToLocalTime ().ToShortDateString () + " " + msg.MsgTime.ToLocalTime ().ToShortTimeString(),
//                    TextColor = SkinStyle.Current.TextColor1
//                };
//                rol.AddChidren (btnDate);
                Button btnDel = new Button () {
                    TextID = R.MyInternationalizationString.Del,
                    BackgroundColor = SkinStyle.Current.DelColor,
                    Tag = msg
                };
                rol.AddRightView (btnDel);
                btnDel.MouseUpEventHandler += (sender, e) => {
                    RemoteInfo.Current.Del ((RemoteInfoMsg)(((Button)sender).Tag));
                    ShowWarningListPage ();
                };
            }
//                Button btnDel = new Button () {
//                    TextID = R.MyInternationalizationString.Del,
//                    BackgroundColor = SkinStyle.Current.DelColor,
//                    Tag = msg
//                };
//                rol.AddRightView (btnDel);
//                btnDel.MouseUpEventHandler += (sender, e) => {
//                    RemoteInfo.Current.Del ((RemoteInfoMsg)(((Button)sender).Tag));
//                    ShowWarningListPage ();
//                };
//            }
            FrameLayout bottomView = new FrameLayout () {
                Y = Application.GetRealHeight (1136 - 90),
                Height = Application.GetRealHeight (90),
                BackgroundColor = SkinStyle.Current.MainColor,
            };
            bodyView.AddChidren (bottomView);
//            FrameLayout bottomView = new FrameLayout () {
//                Y = Application.GetRealHeight (1136 - 90),
//                Height = Application.GetRealHeight (90),
//                BackgroundColor = SkinStyle.Current.MainColor,
//            };
//            bodyView.AddChidren (bottomView);
            Button btnCl = new Button () {
                TextID = R.MyInternationalizationString.ClearInformation,
                TextSize = 14,
                TextColor = SkinStyle.Current.TextColor1,
            };
            bottomView.AddChidren (btnCl);
            btnCl.MouseUpEventHandler += (sender, e) => {
                Alert alert = new Alert ("",
                                        Language.StringByID (R.MyInternationalizationString.ClearInformationTip),
                                        Language.StringByID (R.MyInternationalizationString.Cancel),
                                        Language.StringByID (R.MyInternationalizationString.Confrim));
                alert.Show ();
                alert.ResultEventHandler += (sender1, e1) => {
                    if (e1) {
                        RemoteInfo.Current.CleanAll ();
                        ShowWarningListPage ();
                    }
                };
            };
        }
    }
}
//            Button btnCl = new Button () {
//                TextID = R.MyInternationalizationString.ClearInformation,
//                TextSize = 14,
//                TextColor = SkinStyle.Current.TextColor1,
//            };
//            bottomView.AddChidren (btnCl);
//            btnCl.MouseUpEventHandler += (sender, e) => {
//                Alert alert = new Alert ("",
//                                        Language.StringByID (R.MyInternationalizationString.ClearInformationTip),
//                                        Language.StringByID (R.MyInternationalizationString.Cancel),
//                                        Language.StringByID (R.MyInternationalizationString.Confrim));
//                alert.Show ();
//                alert.ResultEventHandler += (sender1, e1) => {
//                    if (e1) {
//                        RemoteInfo.Current.CleanAll ();
//                        ShowWarningListPage ();
//                    }
//                };
//            };
//        }
//    }
//}