using System;
|
using System.Collections.Generic;
|
using Shared.SimpleControl.Phone.Music;
|
using SmartHome;
|
|
namespace Shared.SimpleControl.Phone
|
{
|
public class HelpView : FrameLayout
|
{
|
public HelpView ()
|
{
|
BackgroundColor = SkinStyle.Current.MainColor;
|
}
|
|
public void ShowPage()
|
{
|
#region 标题
|
var topView = new FrameLayout () {
|
Y = Application.GetRealHeight (36),
|
Height = Application.GetRealHeight (90),
|
Width = Application.GetRealWidth (640),
|
};
|
AddChidren (topView);
|
|
var title = new Button () {
|
TextAlignment = TextAlignment.Center,
|
TextID = R.MyInternationalizationString.Help,
|
TextColor = SkinStyle.Current.TextColor1,
|
TextSize = 19,
|
};
|
topView.AddChidren (title);
|
|
title.MouseLongEventHandler += (sd, ds) => {
|
//#if DEBUG
|
try {
|
////2020-01-15 长按显示当前住宅ID
|
//new Alert ("", UserConfig.Instance.CurrentRegion.Id, "close").Show ();
|
|
//2020-04-23 长按启用 Remote DEBUG Tip
|
SmartHome.MqttCommon.IfDEBUG = !SmartHome.MqttCommon.IfDEBUG;
|
string mes = "Remote DEBUG Tip" + (SmartHome.MqttCommon.IfDEBUG ? "Open" : "Close");
|
new Alert ("", mes, "close").Show ();
|
|
|
} catch { }
|
//#endif
|
|
};
|
|
|
var back = new Button () {
|
Height = Application.GetRealHeight (100),
|
Width = Application.GetRealWidth (85),
|
UnSelectedImagePath = "Item/Back.png",
|
SelectedImagePath = "Item/BackSelected.png",
|
};
|
topView.AddChidren (back);
|
back.MouseUpEventHandler += (sender, e) => {
|
(Parent as PageLayout).PageIndex -= 1;
|
};
|
|
var logo = new Button () {
|
Width = Application.GetRealWidth (154),
|
Height = Application.GetRealHeight (90),
|
X = Application.GetRealWidth (486),
|
UnSelectedImagePath = MainPage.LogoString,
|
};
|
topView.AddChidren (logo);
|
#endregion
|
|
var msgView = new FrameLayout () {
|
Y = Application.GetRealHeight(126),
|
Height = Application.GetRealHeight(320),
|
BackgroundColor = SkinStyle.Current.ViewColor,
|
};
|
AddChidren (msgView);
|
|
var btnTitle = new Button () {
|
X =Application.GetRealWidth(30),
|
Y = Application.GetRealHeight(0),
|
Width = Application.GetRealWidth(500),
|
Height = Application.GetRealHeight(80),
|
TextColor = SkinStyle.Current.TextColor1,
|
Text = "Contact Details",
|
TextSize = 18,
|
TextAlignment = TextAlignment.CenterLeft,
|
};
|
msgView.AddChidren (btnTitle);
|
|
btnTitle.MouseLongEventHandler += (sd, ds) => {
|
//#if DEBUG
|
try {
|
////2020-06-10 长按显示当前住宅ID
|
new Alert ("", UserConfig.Instance.CurrentRegion.Id, "close").Show ();
|
} catch { }
|
//#endif
|
|
};
|
|
var btnPhone = new Button () {
|
X = Application.GetRealWidth(30),
|
Y = btnTitle.Bottom,
|
Width = Application.GetRealWidth(500),
|
Height = Application.GetRealHeight(60),
|
TextColor = SkinStyle.Current.TextColor1,
|
Text = "Toll Free No.",
|
TextAlignment = TextAlignment.CenterLeft,
|
};
|
msgView.AddChidren (btnPhone);
|
var btnPhone1 = new Button () {
|
X = Application.GetRealWidth (100),
|
Y = btnPhone.Bottom,
|
Width = Application.GetRealWidth (500),
|
Height = Application.GetRealHeight (40),
|
TextColor = SkinStyle.Current.TextColor1,
|
Text = "1800 11 0303,1800 103 1313",
|
TextAlignment = TextAlignment.CenterLeft,
|
};
|
msgView.AddChidren (btnPhone1);
|
|
var btnMail = new Button () {
|
X =Application.GetRealWidth(30),
|
Y = btnPhone1.Bottom + Application.GetRealHeight (10),
|
Width = Application.GetRealWidth(500),
|
Height = Application.GetRealHeight(50),
|
TextColor = SkinStyle.Current.TextColor1,
|
Text = "E-mail ID:",
|
TextAlignment = TextAlignment.CenterLeft,
|
};
|
msgView.AddChidren (btnMail);
|
|
btnMail.MouseUpEventHandler += (e, e2) => {
|
#if DEBUG
|
GetDeviceList ();
|
var ud = new UniversalDevice () { LoopID = 1, SubnetID = 1, DeviceID = 100, ActionType = 2, Name = "通用开关", obj1 = 1, TargetType = 0 };
|
ud.SendBytes = new List<byte> () { 1, 0 };
|
//IO.FileUtils.SaveEquipmentMessage (ud, ud.LoopID.ToString ());
|
|
//var ud2 = new UniversalDevice () { LoopID = 2, SubnetID = 1, DeviceID = 100, ActionType = 2, Name = "通用开关2", obj1 = 1, TargetType = 0 };
|
//ud2.SendBytes = new List<byte> () { 2, 255 };
|
//IO.FileUtils.SaveEquipmentMessage (ud2, ud2.LoopID.ToString ());
|
#endif
|
|
};
|
|
var btnMail2 = new Button () {
|
X = Application.GetRealWidth (100),
|
Y = btnMail.Bottom,
|
Width = Application.GetRealWidth (500),
|
Height = Application.GetRealHeight (50),
|
TextColor = SkinStyle.Current.TextColor1,
|
Text = "customercare@havells.com",
|
TextAlignment = TextAlignment.CenterLeft,
|
};
|
msgView.AddChidren (btnMail2);
|
|
btnMail2.MouseUpEventHandler += (e, e2) => {
|
#if DEBUG
|
upload ();
|
#endif
|
|
};
|
|
var btnFAQ = new Button () {
|
Height = Application.GetRealHeight(100),
|
Y = msgView.Bottom + Application.GetRealHeight(20),
|
TextColor = SkinStyle.Current.TextColor1,
|
//Padding = new Padding(0,300,0,0),
|
Text = "FAQ",
|
TextSize = 18,
|
BackgroundColor = SkinStyle.Current.ViewColor
|
};
|
AddChidren (btnFAQ);
|
|
btnFAQ.MouseUpEventHandler += (e,e2) =>{
|
#if DEBUG
|
|
UploadSecneList ();
|
//upload ();
|
|
#endif
|
|
};
|
|
|
var btnLine = new Button () {
|
Y = btnFAQ.Bottom,
|
BackgroundColor = SkinStyle.Current.Black50Transparent,
|
Height = 1,
|
};
|
AddChidren (btnLine);
|
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
void upload ()
|
{
|
|
MainPage.Loading.Start (Language.StringByID (R.MyInternationalizationString.load));
|
System.Threading.Tasks.Task.Run (() => {
|
try {
|
var RES = HDLLinkUtlis.Current.UploadOidAndSidList ();
|
Application.RunOnMainThread (() => {
|
if (RES) {
|
Utlis.ShowTip ("上传成功");
|
} else {
|
Utlis.ShowTip ("上传失败");
|
}
|
});
|
} catch {
|
MainPage.FailureToServer ();
|
} finally {
|
Application.RunOnMainThread (() => {
|
MainPage.Loading.Hide ();
|
});
|
}
|
});
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
void UploadSecneList ()
|
{
|
|
MainPage.Loading.Start (Language.StringByID (R.MyInternationalizationString.load));
|
System.Threading.Tasks.Task.Run (() => {
|
try {
|
var RES = HDLLinkUtlis.Current.UploadSecneList ();
|
Application.RunOnMainThread (() => {
|
if (RES) {
|
Utlis.ShowTip ("上传成功");
|
} else {
|
Utlis.ShowTip ("上传失败");
|
}
|
});
|
} catch {
|
MainPage.FailureToServer ();
|
} finally {
|
Application.RunOnMainThread (() => {
|
MainPage.Loading.Hide ();
|
});
|
}
|
});
|
}
|
|
|
|
/// <summary>
|
///
|
/// </summary>
|
void GetDeviceList ()
|
{
|
MainPage.Loading.Start (Language.StringByID (R.MyInternationalizationString.load));
|
System.Threading.Tasks.Task.Run (() => {
|
try {
|
var deviceResult = HttpServerRequest.Current.GetDeviceList ();
|
|
if (deviceResult.Code == StateCode.SUCCESS) {
|
var deviceList = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieFunctionRes> (deviceResult.Data.ToString ());
|
CommonConfig.Current.FunctionList = deviceList.list;
|
CommonConfig.Current.Save ();
|
|
Utlis.WriteLine ("deviceList Count" + deviceList.list.Count);
|
} else {
|
Utlis.ShowTip ("设备列表");
|
}
|
|
//Application.RunOnMainThread (() => {
|
|
//});
|
} catch {
|
MainPage.FailureToServer ();
|
} finally {
|
Application.RunOnMainThread (() => {
|
MainPage.Loading.Hide ();
|
});
|
}
|
});
|
}
|
|
}
|
}
|