小编asi*_*tis的帖子

WP SilverLight 8.1 vs WP 8.1(XAML)的优点和缺点

我一直在读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)

编辑:在论坛中创建的帖子有关此https://social.msdn.microsoft.com/forums/windowsdesktop/en-us/1e0accaf-b2f8-4d68-b5ec-dc6af6351633/findcontactsasync-takes-long-time?referrer=http: //social.msdn.microsoft.com/forums/windowsdesktop/en-us/1e0accaf-b2f8-4d68-b5ec-dc6af6351633/findcontactsasync-takes-long-time?referrer=http://social.msdn.microsoft.com/论坛/ windowsdesktop/EN-US/1e0accaf-b2f8-4d68-b5ec-dc6af6351633/findcontactsasync通吃长时间?论坛= …

c# silverlight xaml windows-phone-8.1

15
推荐指数
1
解决办法
797
查看次数

发生时在Windows Phone中的System.Windows.ni.dll中发生类型为"'System.Reflection.TargetInvocationException'的未处理异常

我正在创建一个用于获取,创建,更新和删除数据并显示数据的WP8应用程序Web Service.
现在的问题是我的应用程序通过抛出崩溃

在Windows Phone中的System.Windows.ni.dll中出现类型为"'System.Reflection.TargetInvocationException'的未处理异常

在此输入图像描述

这个例外没有堆栈跟踪,我坚持这个问题几个小时.我注意到,只要比正常更频繁地调用服务,就会发生此异常,但我没有得到实际原因.

知道
1.这有什么类型的例外真的很有帮助?
2.这会发生什么情况?
3.由于这个例外,我们如何处理应用程序崩溃?

c# windows-phone-7 windows-phone-8

12
推荐指数
1
解决办法
6万
查看次数

如何在Windows Phone 8.1/Windows 8.1中为http客户端请求操作设置超时

如何将Timeout属性设置为Windows.Web.Http.HttpClientoperation.我使用的代码示例如下.

public HttpClient httpClient;
public CancellationTokenSource cts;

public void SendRequest(addressUri,postrequestbody)
{
    HttpHelper.CreateHttpClient(ref httpClient);
    cts = new CancellationTokenSource();
    HttpRequestMessage msg = 
        new HttpRequestMessage(new HttpMethod("POST"), 
                               new Uri(addressUri));
    msg.Content = new HttpStringContent(postrequestbody);
    msg.Content.Headers.ContentType = 
        new HttpMediaTypeHeaderValue("application/json");
    HttpResponseMessage response = 
        await httpClient.SendRequestAsync(msg).AsTask();

    if (response.StatusCode == HttpStatusCode.Ok)
    {
    }
}
Run Code Online (Sandbox Code Playgroud)

c# httpclient windows-8.1 windows-phone-8.1 win-universal-app

12
推荐指数
1
解决办法
5887
查看次数

如何在Windows 8中显示宽度可变的Gridview项目?

我的GridView项目的大小first item size.我该如何改变这种行为?

如何根据内容显示GridView items变量Width


在此输入图像描述

我想展示第一个,但我得到第二个.
有什么建议吗?

c# gridview windows-8 windows-runtime winrt-xaml

6
推荐指数
1
解决办法
7343
查看次数

弹出窗口时如何设置动画?

我创建了一个Popup Style在我的Windows 8.1应用程序中使用.我申请PopupThemeTransition了它的ChildTransitions财产.

<Style x:Key="AnimatedPopupStyle" TargetType="Popup">
    <Setter Property="IsLightDismissEnabled" Value="False"/>
    <Setter Property="ChildTransitions">
        <Setter.Value>
            <TransitionCollection>
                <PopupThemeTransition/>
            </TransitionCollection>
        </Setter.Value>
    </Setter>
</Style>
Run Code Online (Sandbox Code Playgroud)

我的问题是它在打开时动画而在关闭时没有动画.如何处理隐藏内容的动画?我想创建自定义弹出控件吗?

注:我知道PopInThemeAnimation&PopOutThemeAnimation是存在的.但是不知道如何在这种情况下使用它?

xaml popup windows-8 winrt-xaml windows-8.1

6
推荐指数
1
解决办法
4511
查看次数

应用程序崩溃,而不会在Windows Phone 8.1 xaml中抛出任何异常

我正在创建一个Windows Phone 8.1 xaml应用程序.我使用SlideView:类似Facebook的Windows Phone面板.但是,每当我通过按钮单击导航到新页面时应用程序崩溃,该按钮单击放置在幻灯片视图中.从外部按钮导航成功.

糟糕的是,它不会抛出任何类型的异常或细节.即使它没有在应用程序UnhandledException事件中击中.

    public App()
    {
        this.InitializeComponent();          
        this.UnhandledException += App_UnhandledException;
    }

    void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
    {
       //not throwing exception here
    }
Run Code Online (Sandbox Code Playgroud)

我想知道,什么时候会发生这种情况?如何获取结果应用程序崩溃的异常详细信息?如果我能够得到确切的问题,我可以解决问题.

请给我解决方案.我的样本在这里

c# xaml windows-phone-8.1 win-universal-app

6
推荐指数
1
解决办法
1993
查看次数

如何从具有多个路径的svg图像创建appbar按钮PathIcon?

我在视图中创建窗口8.1应用程序应用程序栏按钮.

我试图从这个svg图像路径创建appbar按钮图像.

 <AppBarButton  AutomationProperties.Name="Label" RequestedTheme="Default"  Label="print Label"  Command="{Binding ButtonCommand}" CommandParameter="print label">
         <AppBarButton.Icon>
              <PathIcon Data="M13.5,14.25v-5h13v5h-2v-2.5h13v2.5H13.5z"/>
         </AppBarButton.Icon>
 </AppBarButton>
Run Code Online (Sandbox Code Playgroud)

下面是svg imageText format

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
 width="40px" height="40px" viewBox="0 0 40 40" enable-background="new 0 0 40 40" xml:space="preserve">
<g>
<g>
    <path fill="#FFFFFF" d="M26.508,14.365h-0.12l-13.14-0.021c-0.581,0-1.051-0.476-1.049-1.056c0-0.58,0.469-1.052,1.05-1.052
        l13.141,0.008c0.582,0,1.053,0.482,1.053,1.062c-0.002,0.578-0.473,1.06-1.053,1.06"/>
    <path fill="#FFFFFF" d="M21.198,11.71h0.066l-2.89-0.108c-0.389-0.002-0.702-0.364-0.7-0.752s0.274-0.72,0.702-0.724l2.891-0.005
        c0.389,0.004,0.701,0.41,0.699,0.799c-0.001,0.385-0.312,0.79-0.699,0.79"/>
    <g>
        <g>
            <path fill="#FFFFFF" …
Run Code Online (Sandbox Code Playgroud)

c# xaml microsoft-metro windows-8 windows-8.1

5
推荐指数
1
解决办法
2005
查看次数

如何在Windows 8.1中捕获高分辨率视频并从中捕获照片.尝试时我有一个UI跳跃效果

我的相机捕捉应用程序我习惯使用在视图中实现的相机拍摄连续照片CaptureElement.当它持续捕捉照片时,UI来回移动似乎是一种跳跃效果.这是我面临的问题.

使用的代码如下

var cameras = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);
MediaCaptureInitializationSettings settings=new MediaCaptureInitializationSettings { VideoDeviceId = cameras[0].Id, StreamingCaptureMode = StreamingCaptureMode.Video };
var_mediaCapture = new MediaCapture();
await _mediaCapture.InitializeAsync(settings);
if (null != videoCapture) videoCapture.Source = _mediaCapture;
            await _mediaCapture.StartPreviewAsync();
Run Code Online (Sandbox Code Playgroud)

设置高分辨率

int max = 0;
var resolutions = videoController.GetAvailableMediaStreamProperties(MediaStreamType.Photo);
            for (var i = 0; i < resolutions.Count; i++)
            {
                ImageEncodingProperties res = resolutions[i] as ImageEncodingProperties;
                if (null == res) continue;


                if (res.Width * res.Height < max)
                {
                    max = (int)(res.Width * res.Height);
                    _imageEncodingProperties = res; …
Run Code Online (Sandbox Code Playgroud)

c# windows-8 windows-runtime windows-8.1

5
推荐指数
1
解决办法
2069
查看次数

在wpf中安排应用程序操作

我正在尝试使用Media Element创建一个WPF媒体应用程序来运行音频文件.我成功了.但我想安排播放我在一段时间内反复选择的歌曲.每天或每小时等10'钟.

最好的方法是什么?

最初我想考虑使用Timer来做它.但这使我的代码变得复杂,因为我必须以用户设置的不同间隔播放多首歌曲.

最近我去了解Task Scheduler,我运行他们的示例代码[打开记事本],它运行得很好.

  using (TaskService ts = new TaskService())
  {
     // Create a new task definition and assign properties
     TaskDefinition td = ts.NewTask();
     td.RegistrationInfo.Description = "Does something";

     // Create a trigger that will fire the task at this time every other day
     td.Triggers.Add(new DailyTrigger { DaysInterval = 2 });

     // Create an action that will launch Notepad whenever the trigger fires
     td.Actions.Add(new ExecAction("notepad.exe", "c:\\test.log", null));

     // Register the task in the root folder
     ts.RootFolder.RegisterTaskDefinition(@"Test", td); …
Run Code Online (Sandbox Code Playgroud)

c# silverlight wpf scheduled-tasks winforms

4
推荐指数
1
解决办法
1511
查看次数

如何将方形图像掩盖成圆角图像?

因为我想在我的 Image控件上实现圆角面罩我设计了这样的控件

    <Border x:Name="Border1"  CornerRadius="{Binding CornerRadius,Mode=TwoWay}"  >
            <Image  x:Name="ImageSource1" Background="Transparent" >
            </Image>
    </Border> 
<Border x:Name="MaskBorder1"  BorderBrush="White"  CornerRadius="{Binding CornerRadius,Mode=TwoWay}" BorderThickness="3" />
Run Code Online (Sandbox Code Playgroud)

但是我正在接受控制.

在此输入图像描述

有人有想法用边框颜色填补角落吗?

c# xaml windows-phone-8

3
推荐指数
1
解决办法
2921
查看次数

从HRESULT获取异常:在Windows Phone 8.1中发布到服务时为0x80072F0D

当我尝试使用Windows Phone 8.1中的HttpClient将数据发布到API时,我总是遇到Exception from HRESULT: 0x80072F0D异常.在小提琴手,它工作正常.

try
{  
    var requestbody="json data"
    HttpClient httpClient = new HttpClient();
    HttpRequestMessage msg = new HttpRequestMessage(new HttpMethod("POST"), new Uri(addressUri));
    msg.Content = new HttpStringContent(requestbody);
    msg.Content.Headers.ContentType = new HttpMediaTypeHeaderValue("application/json");
    HttpResponseMessage response = await httpClient.SendRequestAsync(msg).AsTask();
}           
catch (Exception ex)
{
    getting **Exception from HRESULT: 0x80072F0D**
}
Run Code Online (Sandbox Code Playgroud)

请告诉我出了什么问题?

--- FYI ----

要获取有关HRESULT代码的其他信息:请遵循此WebErrorStatus枚举

  var exceptionDetail = WebError.GetStatus(ex.GetBaseException().HResult);

  if (exceptionDetail == WebErrorStatus.HostNameNotResolved)
  {
    //
  }
Run Code Online (Sandbox Code Playgroud)

c# httpclient windows-8.1 windows-phone-8.1

3
推荐指数
1
解决办法
4011
查看次数

在 Windows Phone 8.1 中使用 BackgroundExecutionManager.RequestAccessAsync 时未注册类(来自 HRESULT 的异常:0x80040154)

我正在尝试在我的项目中实施后台任务。所以我添加了一个Windows Runtime Component Project并从我的 main 中引用了它Windows Phone 8.1 silverlight project。但是当我调用下面的函数时,我得到了一个异常

“在 mscorlib.ni.dll 中发生了“System.Exception”类型的第一次机会异常。附加信息:未注册类(来自 HRESULT 的异常:0x80040154 (REGDB_E_CLASSNOTREG))”

        // Applications must have lock screen privileges in order to receive raw notifications
        BackgroundAccessStatus backgroundStatus = await BackgroundExecutionManager.RequestAccessAsync();

        // Make sure the user allowed privileges
        if (backgroundStatus != BackgroundAccessStatus.Denied && backgroundStatus != BackgroundAccessStatus.Unspecified)
        {
            OpenChannelAndRegisterTask();
        }
        else
        {
            // This event comes back in a background thread, so we need to move to the UI thread to access any UI …
Run Code Online (Sandbox Code Playgroud)

c# windows-phone-8 windows-phone-8.1

2
推荐指数
1
解决办法
824
查看次数