Tag: windows phone 8

从Windows Phone 8中的URL获取JSON字符串

所以我试图在Windows Phone 8应用程序中从Url获​​取Json字符串。 我只需要调用一个返回此字符串的callbackurl,这就是它,但不知怎的,我已经被困在这几天了,我只是不明白该怎么做 我有一个urlparser类,包含2个方法: public void ParseJsonUrl(string url) { Uri uri = new Uri(url); WebClient webClient = new WebClient(); webClient.DownloadStringCompleted += webClient_DownloadStringCompleted; webClient.DownloadStringAsync(uri); } void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { var jsonData = JsonConvert.DeserializeObject(e.Result); Debug.WriteLine(jsonData.parameter1); } 现在我只是想显示我的Json字符串中包含的一个参数,当然我的方法会在我开始工作后执行其他操作 我在urlparser.cs文件的开头有一个名为“parameters”的类,看起来像 public class parameter { public string parameter1 { get; set; } public string parameter2 { get; […]

不向Web服务发送数据

这是我发送数据的代码。 有一个字符串strJson我想将字符串数据发送到我已集成的服务引用。 ServiceReference3.Service1Client client = new ServiceReference3.Service1Client(); client.GetOrderAsync(strJson); 它抛出以下exception:类型的exception System.ServiceModel.ni.dll中发生’System.ServiceModel.CommunicationException’但未在用户代码中处理 exception地点:它打开reference.cs,并在此代码中抛出exception。 System.ServiceModel.ni.dll中出现“System.ServiceModel.FaultException”类型的exception,但未在用户代码中处理 public bool EndGetOrder(System.IAsyncResult result) { object[] _args = new object[0]; bool _result=((bool)(base.EndInvoke(“GetOrder”, _args, result)));//At this line exception occurs return _result; }

错误:GenerateWinPRTManifest

我试图创建一个新的monogame windows phone 8项目,当我试图运行它时,我收到了这个错误: Error 1 The “GenerateWinPRTManifest” task failed unexpectedly. System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value) at Microsoft.Silverlight.Build.Tasks.GenerateWinPRTManifest.CCIHarvestRegistrationInformation(ProcessWinmd processWinmd, Dictionary`2 inprocServers) at Microsoft.Silverlight.Build.Tasks.GenerateWinPRTManifest.UpdateWinmdRegistration() at Microsoft.Silverlight.Build.Tasks.GenerateWinPRTManifest.ExecuteImplementation() at Microsoft.Silverlight.Build.Tasks.GenerateWinPRTManifest.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext() MonoGameWP8

以编程方式将焦点设置为Windows Phone中的TextBox

在Windows Phone应用程序中,我有一个TextBox和一个Button 。 用户将一些文本写入TextBox并点击Button,TextBox中的文本将添加到列表中。 点击按钮后,TextBox失去焦点。 我想要做的是在点击按钮后将焦点设置回TextBox,这样用户就可以继续编写另一个文本,而无需点击TextBox。 我尝试在Button处理程序中调用TextBox的Focus()方法,但这不起作用。 是否还有另一种方法可以做到这一点?

不返回正确的post方法结果

我正在尝试使用php / my sql在windows phone 8登录function中创建一个应用程序 我有以下PHP脚本: 在我的windows phone c#click事件中我写了以下内容: private void btnLogin_Click(System.Object sender, System.Windows.RoutedEventArgs e) { Uri uri = new Uri(url, UriKind.Absolute); StringBuilder postData = new StringBuilder(); postData.AppendFormat(“{0}={1}”, “email”, HttpUtility.UrlEncode(“Test@test.com”)); postData.AppendFormat(“&{0}={1}”, “pwd1”, HttpUtility.UrlEncode(“password”)); WebClient client = default(WebClient); client = new WebClient(); client.Headers[HttpRequestHeader.ContentType] = “application/x-www-form-urlencoded”; client.Headers[HttpRequestHeader.ContentLength] = postData.Length.ToString(); client.UploadStringCompleted += client_UploadStringCompleted; client.UploadProgressChanged += client_UploadProgressChanged; client.UploadStringAsync(uri, […]

获取DIV内的链接

我希望能够从这个div中获得第一个链接。 <— This one text Tweet it! 我试过这个代码,但它不起作用 HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(source); var div = doc.DocumentNode.SelectSingleNode(“//div[@id=’first-tweet-wrapper’]”); if (div != null) { var links = div.Descendants(“a”) .Select(a => a.InnerText) .ToList(); }

变换路径/折线对应于地图缩放/移动动作

我正在使用MapLayer和MapOverlay在Map中创建自己的路径/折线,GPS捕获的所有点都存储在一个结构中,以便我可以访问它们。 随时。 现在,我希望路径在用户操纵地图的同时进行变换(缩放和地图重新定位),因此路径仍然连接相同的点。 到目前为止,我的方法非常耗费CPU并且看起来非常糟糕 GeocoordinateList _coordinates; MapLayer pointsLayer; private void MyMap_ZoomLevelChanged(object sender, MapZoomLevelChangedEventArgs e) { repositionPoints(); // This is done other way but for the sake of brevity } private void repositionPathPoints() { try { Polyline path = (Polyline)pointsLayer.First(TrackPath).Content; // retrieves MapOverlay corresponding to line path.Points.Clear(); path.Points = new PointCollection(); foreach (Geocoordinate coord in _coordinates) […]

使用Windows Phone 8发送SOAP请求

我有一个SOAP 1.1或1.2服务,我想用它来查询Windows Phone 8应用程序中的一些数据。 问题是,我对如何做到这一点没有丝毫的想法。 SOAP请求已经提供,我根本就不知道如何使用它。 我已经尝试过添加一个WebService但是我在黑暗中摸索,因为SOAP请求是从第三方提供的,很少或没有文档,很少或根本没有可能得到任何一个。 我已粘贴在下面的SOAP请求中。 我需要有关如何使用它的基本分步说明并从中得到某种响应。 POST /RTPIService.asmx HTTP/1.1 Host: rtpi.sample.servers.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: “http://testsite.com/GetRealTimeStopData” int boolean

Windows Phone 8:本地化不起作用

我已将我的应用程序从WP7(我没有本地化问题)移动到WP8。 现在,无论手机设置如何,都只显示英语。 我的设置是(摘自http://www.geekchamp.com/articles/localizing-a-windows-phone-app-step-by-step ): 资源文件夹内容 AppResources.en-US.resx [英文] AppResources.pl-PL.resx [波兰语] AppResources.resx [英文] WMAppManifest.xml: 手机设置:

什么是AgHost.BackgroundTask作为Windows Phone Silverlight 8.1中的后台任务?

当我创建一个新的Windows Phone SIlverlight 8.1应用程序时,清单中有一个后台任务: 它是什么? 删除是否安全? 我能找到的唯一参考不是很有用http://msdn.microsoft.com/en-us/library/windowsphone/develop/dn642084.aspx