New file |
| | |
| | | using System; |
| | | using HDL_ON.DAL.Server; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | namespace HDL_ON.UI |
| | | { |
| | | public class iot_BindTipPage : FrameLayout |
| | | { |
| | | FrameLayout bodyView; |
| | | |
| | | /// <summary> |
| | | /// 解绑回调 |
| | | /// </summary> |
| | | public Action unboundAction; |
| | | /// <summary> |
| | | /// 绑定回调 |
| | | /// </summary> |
| | | public Action boundAction; |
| | | |
| | | public iot_BindTipPage() |
| | | { |
| | | bodyView = this; |
| | | } |
| | | |
| | | |
| | | public void LoadPage(IntegratedBrand_Iot brand_Iot) |
| | | { |
| | | |
| | | |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.Bind3thIotAccount)).LoadTopView(CSS_Color.MainBackgroundColor); |
| | | |
| | | bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | |
| | | var contentView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | | Height = Application.GetRealHeight(667 - 124) |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | | var btnIcon = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(25), |
| | | Width = Application.GetRealWidth(106), |
| | | Height = Application.GetRealWidth(106), |
| | | UnSelectedImagePath = "Public/Logo.png", |
| | | }; |
| | | contentView.AddChidren(btnIcon); |
| | | |
| | | var btnTipTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Y = Application.GetRealHeight(140), |
| | | Width = Application.GetRealWidth(300), |
| | | Height = Application.GetRealHeight(60), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = 21, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | IsBold = true, |
| | | Text = "关于账号绑定的声明" |
| | | }; |
| | | contentView.AddChidren(btnTipTitle); |
| | | |
| | | var btnTipText = new Button() |
| | | { |
| | | Padding =new Padding(0, Application.GetRealWidth(16), 0, Application.GetRealWidth(16)), |
| | | Y = Application.GetRealHeight(140), |
| | | Height = Application.GetRealHeight(340), |
| | | IsMoreLines = true, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = 14, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = $"账户绑定品牌:{brand_Iot.brandName} (以下简称第三方品牌)" + "\r\n" + "\r\n" + |
| | | "您绑定第三方品牌的账号后,将授权“On Pro”使用您在第三方账号,协同管理设备,On Pro也将自动同步您在第三方品牌中添加的设备。" + "\r\n" + "\r\n" + |
| | | |
| | | "为实现设备控制功能,本应用将从第三方中获取以下数据:" + "\r\n" + "\r\n" + |
| | | |
| | | "1.第三方品牌上添加的部分设备列表,用于在On Pro中进行智能化控制;" + "\r\n" + "\r\n" + |
| | | |
| | | "2.设备及网络信息,包括设备标志符、MAC地址、设备序列号,用于识别当前工作的设备以及进行设备控制功能。" + "\r\n" + "\r\n" + |
| | | |
| | | "如果您不同意我们收集以上信息,将无法管理第三方品牌的设备。" + "\r\n" + "\r\n" + |
| | | |
| | | "如需终止以上信息的收集与处理,您可以在“我的”> “绑定第三方账户”>“解除”" |
| | | }; |
| | | contentView.AddChidren(btnTipText); |
| | | |
| | | |
| | | var optionView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(667 - 80), |
| | | Height = Application.GetRealHeight(90), |
| | | Radius = (uint)Application.GetRealWidth(22), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | bodyView.AddChidren(optionView); |
| | | |
| | | var btnCannel = new Button() |
| | | { |
| | | X = Application.GetRealWidth(17), |
| | | Y = Application.GetRealHeight(14), |
| | | Width = Application.GetRealWidth(164), |
| | | Height = Application.GetRealHeight(44), |
| | | BorderColor = CSS_Color.MainColor, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | BorderWidth = (uint)Application.GetRealWidth(1), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | Text = "返回", |
| | | Radius = (uint)Application.GetRealHeight(22) |
| | | }; |
| | | optionView.AddChidren(btnCannel); |
| | | btnCannel.MouseUpEventHandler = (sender, e) => { |
| | | this.RemoveFromParent(); |
| | | }; |
| | | |
| | | |
| | | var btnComfirm = new Button() |
| | | { |
| | | X = Application.GetRealWidth(196), |
| | | Y = Application.GetRealHeight(14), |
| | | Width = Application.GetRealWidth(164), |
| | | Height = Application.GetRealHeight(44), |
| | | TextAlignment = TextAlignment.Center, |
| | | BackgroundColor= CSS_Color.MainColor, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | Text = "同意授权", |
| | | Radius = (uint)Application.GetRealHeight(22) |
| | | }; |
| | | optionView.AddChidren(btnComfirm); |
| | | |
| | | |
| | | if (!brand_Iot.hasAuthorization) |
| | | { |
| | | btnComfirm.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | |
| | | Action action = () => { |
| | | brand_Iot.hasAuthorization = true; |
| | | boundAction?.Invoke(); |
| | | this.RemoveFromParent(); |
| | | var page = new Iot_BrandFunctionListPage(brand_Iot); |
| | | page.unboundAction = unboundAction; |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | |
| | | var page = new Iot_AuthorizedPage(brand_Iot,action); |
| | | page.LoadView(); |
| | | |
| | | |
| | | |
| | | }; |
| | | } |
| | | else |
| | | { |
| | | btnComfirm.Text = "解除授权"; |
| | | btnComfirm.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | Dialog dialog = new Dialog() |
| | | { |
| | | BackgroundColor = CSS_Color.DialogTransparentColor1, |
| | | }; |
| | | |
| | | FrameLayout contentView = new FrameLayout() |
| | | { |
| | | Gravity = Gravity.Center, |
| | | Width = Application.GetRealWidth(305), |
| | | Height = Application.GetRealHeight(180), |
| | | BackgroundColor = CSS.CSS_Color.MainBackgroundColor, |
| | | BorderColor = 0x00000000, |
| | | BorderWidth = 0, |
| | | Radius = (uint)Application.GetMinRealAverage(10), |
| | | }; |
| | | dialog.AddChidren(contentView); |
| | | |
| | | Button btnMsg = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Height = Application.GetRealHeight(70), |
| | | Y = Application.GetRealHeight(30), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | Padding = new Padding(0,Application.GetRealWidth(16),0,Application.GetRealWidth(16)), |
| | | Text = "撤销授权后,该品牌关联在On Pro中的设备将全部被解绑,相关使用信息合设备值也将失效", |
| | | IsMoreLines = true, |
| | | }; |
| | | contentView.AddChidren(btnMsg); |
| | | |
| | | Button btnLine = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(125), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS.CSS_Color.DividingLineColor, |
| | | }; |
| | | contentView.AddChidren(btnLine); |
| | | |
| | | Button btnConfirm = new Button() |
| | | { |
| | | Y = btnLine.Bottom, |
| | | Height = Application.GetRealHeight(55), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | SelectedTextColor = CSS_Color.MainBackgroundColor, |
| | | SelectedBackgroundColor = CSS_Color.MainColor, |
| | | Text = "确定撤回授权", |
| | | }; |
| | | btnConfirm.SetCornerWithSameRadius(Application.GetMinRealAverage(10), HDLUtils.RectCornerBottomLeft); |
| | | btnConfirm.SetCornerWithSameRadius(Application.GetMinRealAverage(10), HDLUtils.RectCornerBottomRight); |
| | | contentView.AddChidren(btnConfirm); |
| | | |
| | | dialog.Show(); |
| | | |
| | | btnConfirm.MouseDownEventHandler += (sender, e) => |
| | | { |
| | | btnConfirm.IsSelected = true; |
| | | }; |
| | | btnConfirm.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var http = new HttpServerRequest(); |
| | | var waitPage = new Loading(); |
| | | this.AddChidren(waitPage); |
| | | waitPage.Start(""); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | var pack = http.Unbound3tyIotAccount(brand_Iot.companyId); |
| | | if (pack != null) |
| | | { |
| | | if (pack.Code == StateCode.SUCCESS) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnConfirm.IsSelected = false; |
| | | dialog.Close(); |
| | | this.RemoveFromParent(); |
| | | brand_Iot.hasAuthorization = false; |
| | | unboundAction?.Invoke(); |
| | | }); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | dialog.Close(); |
| | | new Alert("", "操作失败", "").Show(); |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | waitPage.Hide(); |
| | | waitPage.RemoveFromParent(); |
| | | }); |
| | | |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | | |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | } |