using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using Shared;
|
using Shared.SimpleControl;
|
using Shared.SimpleControl.R;
|
using Shared.SimpleControl.Phone.Music;
|
using Shared.SimpleControl.Phone;
|
using System.Xml;
|
|
namespace SmartHome.UI.SimpleControl.Phone.Music
|
{
|
class A31Tidalhome : FrameLayout
|
{
|
/// <summary>
|
/// 密码
|
/// </summary>
|
EditText password;
|
/// <summary>
|
/// 用户名
|
/// </summary>
|
EditText username;
|
A31MusicModel currentMusiceA31;
|
public void show (A31MusicModel a31)
|
{
|
currentMusiceA31 = a31;
|
AddChidren (new Button {
|
Height = Application.GetRealHeight (36),
|
BackgroundColor = SkinStyle.Current.MainColor,
|
});
|
|
var topFrameLayout = new FrameLayout {
|
Height = Application.GetRealHeight (90),
|
Y = Application.GetRealHeight (36),
|
BackgroundColor = SkinStyle.Current.MainColor,
|
};
|
AddChidren (topFrameLayout);
|
|
var LocallistName = new Button {
|
Text = "TIDAL LOGIN",
|
};
|
topFrameLayout.AddChidren (LocallistName);
|
|
var hdl = new Button {
|
Width = Application.GetRealWidth (154),
|
Height = Application.GetRealHeight (90),
|
X = Application.GetRealWidth (486),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = MainPage.LogoString,
|
};
|
topFrameLayout.AddChidren (hdl);
|
|
var back = new Button {
|
Width = Application.GetRealWidth (82),
|
Height = Application.GetRealHeight (89),
|
X = Application.GetRealWidth (10),
|
Gravity = Gravity.CenterVertical,
|
UnSelectedImagePath = "MusicIcon/HomepageBack.png",
|
};
|
topFrameLayout.AddChidren (back);
|
back.MouseDownEventHandler += (sender, e) => {
|
RemoveFromParent ();
|
};
|
|
var middle = new FrameLayout ();
|
middle.Y = topFrameLayout.Bottom;
|
middle.Height = Application.GetRealHeight (Application.DesignHeight - 130);
|
middle.BackgroundColor = 0xff2F2F2F;
|
AddChidren (middle);
|
|
username = new EditText {
|
Width = Application.GetRealWidth (580),
|
Height = Application.GetRealHeight (80),
|
X = Application.GetRealWidth (30),
|
Y = Application.GetRealHeight (180),
|
TextAlignment = TextAlignment.CenterLeft,
|
BackgroundColor = 0xFF4D4D4D,
|
};
|
middle.AddChidren (username);
|
|
password = new EditText {
|
Width = Application.GetRealWidth (580),
|
Height = Application.GetRealHeight (80),
|
X = Application.GetRealWidth (30),
|
Y = Application.GetRealHeight (300),
|
TextAlignment = TextAlignment.CenterLeft,
|
BackgroundColor = 0xFF4D4D4D,
|
};
|
middle.AddChidren (password);
|
|
Button login = new Button {
|
Width = Application.GetRealWidth (500),
|
Height = Application.GetRealHeight (100),
|
X = Application.GetRealWidth (70),
|
Y = Application.GetRealHeight (460),
|
BackgroundColor = 0xff009999,
|
Text = "Login",
|
TextSize = 18,
|
Radius = (uint)Application.GetRealHeight (16),
|
};
|
login.MouseUpEventHandler += (sender, e) => {
|
login.BackgroundColor = 0xff009999;
|
var dd = ReadRadiohome ("airableqc5", "tidalx", "http://meta.airable.io/view/tidal");
|
};
|
|
login.MouseDownEventHandler += (sender, e) => {
|
login.BackgroundColor = 0xffFE5E00;
|
};
|
|
middle.AddChidren (login);
|
}
|
|
string ReadRadiohome (string userName, string password, string url)
|
{
|
System.IO.StringReader sr = null;
|
Airable airable = null;
|
try {
|
Shared.Net.MyWebClient webClient = new Shared.Net.MyWebClient ();
|
webClient.Headers.Add ("CONTENT-TYPE", "text/xml;charset=\"utf-8\"");
|
|
webClient.Headers.Add ("Authorization", "Basic " + Convert.ToBase64String (Encoding.ASCII.GetBytes (userName + ":" + password)));
|
byte [] recevieBytes = webClient.DownloadData (new Uri (url));
|
var ddd = Encoding.UTF8.GetString (recevieBytes, 0, recevieBytes.Length);
|
sr = new System.IO.StringReader (Encoding.UTF8.GetString (recevieBytes, 0, recevieBytes.Length));
|
|
} catch { } finally {
|
if (sr != null)
|
sr.Close ();
|
}
|
return null;
|
}
|
}
|
}
|