|
using System;
|
using Shared.IO;
|
using Shared.Net;
|
using System.Text;
|
using System.Collections.Generic;
|
// <summary>
|
// 程序主入口
|
// </summary>
|
//using SystemConfiguration;
|
using System.Net;
|
using System.IO;
|
using Shared.SimpleControl.Phone;
|
namespace Shared.SimpleControl
|
{
|
/// <summary>
|
/// 主页面
|
/// </summary>
|
public static class MainPage
|
{
|
/// <summary>
|
/// 主页面,根界面
|
/// </summary>
|
public static FrameLayout MainFrameLayout { get; internal set; }
|
public static bool Showed;
|
|
static Loading loading;
|
/// <summary>
|
/// 显示加载界面
|
/// </summary>
|
public static Loading Loading {
|
get {
|
if (loading == null) {
|
loading = new Loading ();
|
}
|
return loading;
|
}
|
}
|
|
/// <summary>
|
/// 显示当前界面
|
/// </summary>
|
public static void Show ()
|
{
|
try {
|
Showed = true;
|
if (Shared.Application.IsPad) {
|
Application.DesignWidth = 2048;
|
Application.DesignHeight = 1536;
|
} else {
|
Application.DesignWidth = 640;
|
Application.DesignHeight = 1136;
|
}
|
Shared.BusSocket.Start (6000);
|
CommonPage.InitReceiveEvent ();
|
|
MainFrameLayout = Application.MainPage;
|
MainFrameLayout.AddChidren (Loading);
|
if (Shared.Application.IsPad) {
|
} else {
|
|
var addGatewayDialog = new SystemHomePage ();
|
MainFrameLayout.BackgroundColor = 0xFFF2F3F4;
|
MainFrameLayout.AddChidren (addGatewayDialog);
|
addGatewayDialog.Init ();
|
|
|
Loading.TextColor = 0xFFA9A9A9;
|
Loading.LodingBackgroundColor = SkinStyle.Current.MainColor;
|
}
|
} catch (Exception ex) {
|
Console.WriteLine ("Hdl Error :"+ex.Message);
|
}
|
}
|
|
|
/// <summary>
|
/// 增加rjfi
|
/// </summary>
|
/// <param name="tip">Tip.</param>
|
/// <param name="time">Time.</param>
|
public static void AddTip (string tip, int time = 2000)
|
{
|
if (MainFrameLayout == null) {
|
return;
|
}
|
Application.RunOnMainThread (() => {
|
var button = new TextView {
|
Gravity = Gravity.Center,
|
Width = Application.GetRealWidth (560),
|
Height = Application.GetRealHeight (126),
|
BackgroundColor = SkinStyle.Current.AddTipButtonColor,
|
Radius = 10,
|
IsMoreLines = true,
|
Text = tip,
|
TextSize = 16,
|
};
|
MainFrameLayout.AddChidren (button);
|
button.MouseUpEventHandler += (sender, e) => {
|
button.RemoveFromParent ();
|
};
|
System.Threading.Tasks.Task.Run (() => {
|
System.Threading.Thread.Sleep (time);
|
Application.RunOnMainThread (() => {
|
button.RemoveFromParent ();
|
});
|
});
|
});
|
}
|
|
static DateTime requesTime = DateTime.MinValue;
|
static bool isShowLoading = true;
|
|
|
public static void LoadingStart (string showString = "")
|
{
|
Application.RunOnMainThread (() => {
|
MainPage.Loading.Start (showString);
|
});
|
}
|
|
public static void LoadingHide ()
|
{
|
Application.RunOnMainThread (() => {
|
MainPage.Loading.Hide ();
|
});
|
}
|
}
|
}
|