我一直在读Wp8.1(XAML)应用程序是为Windows Phone 8.1创建应用程序的新方法,并且该代码对Windows 8.1桌面应用程序具有高度可重用性.
但是有点担心,因为从联系人(WP8.1 XAML中的ContactManager)执行单个搜索比Silverlight对应的慢.
只需从我的议程中返回所有联系人(240个联系人,包括电子邮件,缩略图等......),我的Lumia 1520需要3秒钟; 与Silverlight代码相同的操作需要0.7秒.
我有点害怕使用WP8.1制作手机应用程序,因为性能对我来说非常重要.使用Lumia 1520的触点,Lumia 535的相同测试分别需要7秒和1.5秒.
是否有关于使用何种项目的推荐?我觉得Silverlight应用程序(显然)专注于Windows Phone并使用所有手机的功能.
我错了?我是否会通过选择Windows手机Silverlight进入弃用之路?
注意:用于执行搜索的代码是MSDN示例中的代码...
WP8.1 XAML(诺基亚Lumia 1520,3秒与缩略图,邮件帐户等获得240个联系人......)
ContactStore agenda = await ContactManager.RequestStoreAsync();
Stopwatch sw = new Stopwatch();
IReadOnlyList<Windows.ApplicationModel.Contacts.Contact> contacts = null;
sw.Start();
contacts = await agenda.FindContactsAsync();
sw.Stop();
txtblock1.Text = sw.ElapsedMilliseconds;
Run Code Online (Sandbox Code Playgroud)
WP Silverlight 8.1(诺基亚Lumia 1520,0.7秒获得240个缩略图,邮件账号等联系人......)
Contacts agenda = new Contacts();
//Stopwatch is declared at class level so its accessible in ListContacts_SearchCompleted Callback
sw.Start();
agenda.SearchCompleted+= ListContacts_SearchCompleted;
agenda.SearchAsync(String.Empty, FilterKind.None, null);
//sw.Stop() and print ElapsedMilliseconds in ListContacts_SearchCompleted callback
Run Code Online (Sandbox Code Playgroud)
我有一个测试类,我试图序列化:
public class Testing
{
private string _name;
private string _firstname = "firstname";
public string _lastname;
private DateTime _datenow = DateTime.Now;
public DateTime _birthdate = DateTime.Now;
public string Name { get { return _name; } set { _name = value; } }
}
Run Code Online (Sandbox Code Playgroud)
我使用自定义JsonConverter来处理测试类的序列化:
public class TestingConverter : JsonConverter
{
private Type[] _types = new Type[] { typeof(Testing)};
/// <summary>
/// Writes the JSON representation of the object.
/// </summary>
/// <param name="writer">The <see cref="JsonWriter"/> to write to.</param> …Run Code Online (Sandbox Code Playgroud)