联系Windows应用商店应用中的软件目录Web服务 [英] Contacting software catalog web service in windows store app

查看:79
本文介绍了联系Windows应用商店应用中的软件目录Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨大家好!



我正在尝试创建一个metro应用程序,用户可以通过软件目录下载可用的应用程序。在阅读了几篇文章之后,我发现了这篇TechNet文章,或多或少地给了我这样做的代码:



http://blogs.technet.com/b /configmgrteam/archive/2012/09/19/extending-the-application-catalog-in-system-center-2012-configuration-manager.aspx [ ^ ]



代码:

Hi Guys!

I am trying to create a metro application where the user can download applications that are available to them via the software catalog. After reading a few articles I came across this TechNet article that more or less gives me the code to do this:

http://blogs.technet.com/b/configmgrteam/archive/2012/09/19/extending-the-application-catalog-in-system-center-2012-configuration-manager.aspx[^]

Code:

public MainWindow()
        {
            InitializeComponent();

            string url = "https://SERVERNAME/CMApplicationCatalog/ApplicationViewService.asmx";

            BasicHttpBinding binding = new BasicHttpBinding();
            binding.Security.Mode = BasicHttpSecurityMode.Transport;
            binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;

            ApplicationCatalogService.ApplicationViewServiceSoapClient sc = new ApplicationViewServiceSoapClient(binding,new EndpointAddress(url));
            int total = 0;
            AppDetailView[] apps = sc.GetApplications(
                ApplicationProperty.Name,
                null,
                ApplicationProperty.Name,
                "",
                20,
                0,
                true,
                ApplicationClassicDisplayName.PackageProgramName,
                false,
                null,
                out total);

            foreach (var item in apps)
            {
                MessageBox.Show(item.Name);
            }
        }





此代码适用于我使用WPF或控制台应用程序,但由于某种原因(即时通讯)假设性能原因)只有.GetApplicationsAsync方法可用。我已经玩过这种异步方法,但没有回复 - 有没有人对此有任何经验?



我假设由于流动性,只有异步方法可用地铁应用程序?

虽然我可以导航到该URL并在WPF代码中使用它,但我也收到Web服务没有回复的错误...



谢谢。



This code will work for me using WPF or console applications but for some reason (im assuming performance reasons) only the ".GetApplicationsAsync" method is available. I have played around with this async method but am getting no reply - has anyone had any experience with this?

I assume only the async method is available due to the fluidity of metro apps?
I'm also getting an error that the web service isn't replying although I can navigate to that url and use it in WPF code...

Thank you.

推荐答案

纠正你所描述的方法应该都是异步的,以保持Win8应用程序的移动。 />
您是否可能没有在应用程序包清单中选择正确的功能来访问Internet?

此外,请务必使用await关键字您(最终)获得您期望的返回值。
Correct that methods like the one you're describing should all be async in order to keep the Win8 app moving.
Is it possible that you don't have the correct capabilities selected in your app's package manifest to give you internet access?
Also, be sure to use the "await" keyword so that you (eventually) get the return value(s) you're expecting.


这篇关于联系Windows应用商店应用中的软件目录Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆