Tag: windows phone

命名空间不能直接包含成员… +类型或命名空间定义,或文件结束预期错误

我正在尝试为Windows Phone编译Sync Framework 4.0的示例代码,但是我在几个文件中遇到了错误。 其中一个文件是: #if SERVER namespace Microsoft.Synchronization.Services #elif CLIENT namespace Microsoft.Synchronization.ClientServices #endif { /// /// Represents the base interface that all offline cacheable object should derive from. /// public interface IOfflineEntity { /// /// Represents the sync and OData metadata used for the entity /// OfflineEntityMetadata ServiceMetadata { get; set; } } } […]

分组LongListSelector:标题出现,项目不出现

C#中的WinPhone 8项目。 我正在尝试填充分组列表。 显示组标题,但项目不显示。 相关代码是: class MyPage { public class Group : IGrouping { public string Title{get;set;} public string[] Items; public string Key { get { return Title; } } public IEnumerator GetEnumerator() { return (Items as IEnumerable).GetEnumerator(); } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return Items.GetEnumerator(); } } private Group[] m_ItemGroups = { new Group(){Title = “A”, […]

将Debug.WriteLine流重定向到文本块

我想将Debug stdout流重定向到文本块。 有一个简单的方法吗? 谢谢。

错误: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

不返回正确的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, […]

如何使Windows Phone应用程序像默认应用程序一样加载更快?

我观察到Windows手机中的People,Calculator.etc等默认应用程序根本不需要时间来加载。 他们甚至没有Splash Screen图像。 我试过在我的应用程序中从项目中排除SplashScreenImage.jpg并在我的手机上运行它,我的应用程序是静态的,只显示文本,但仍然需要时间加载,为什么会这样? 如何让我的应用程序像默认的Windows应用程序一样运行而无需等待时间和SplashScreen图像?

检索位于WP8.1中应用程序的本地文件夹中的StorageFile(video)的缩略图

我正在尝试将ApplicationFile的缩略图放在应用程序的应用程序包(LocalFolder)中。 存储文件是媒体文件,可以是图像(jpg或png)或video(mp4或wmv)。 现在,当我尝试使用StorageFile类的GetThumbnailAsync(ThumbnailMode)方法获取缩略图时,我得到了一个 System.Exception:找不到组件。 错误,如果文件是图像或不在应用程序包内的video,同样的工作正常。 这是我正在使用的代码隐藏 StorageFile file; private async void BtnGetVideo_Click(object sender, RoutedEventArgs e) { StorageFolder folder = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFolderAsync(“Assets\\TestImgs”); file = await folder.GetFileAsync(“SMTest.mp4”); } private async void BtnGetThumb_Click(object sender, RoutedEventArgs e) { if (file != null) { BitmapImage image = new BitmapImage(); image.SetSource(await file.GetThumbnailAsync(ThumbnailMode.VideosView)); ImagePreview.Source = image; } } 这是它的xaml

WPF TextBox被切断了

出于某些奇怪的原因,我添加了大量文本后,嵌入在滚动查看器中的WPF文本框突然被切断,如下图所示。 是否有一些限制或达到的东西,我可以做大或什么? 我没有收到任何错误消息。 这是相关的Xaml: 这是我用来添加文本的C#: main.DispatchInvoke(() => { main.OutBox.Text += newText; main.Scroller.ScrollToVerticalOffset(main.Scroller.ScrollableHeight); main.Scroller.UpdateLayout(); });

Windows Phone XAML中的TimeSpan字符串格式

我正在尝试将XAML StringFormat应用于TimeSpan属性。 注意此问题适用于Windows Phone 。 对于WPF,正确的语法是: Text=”{Binding ElapsedTime,StringFormat={}{0:m\\:ss}}” 对于Silverlight,它需要单引号: Text=”{Binding ElapsedTime,StringFormat='{}{0:m\\:ss}’}” 但对于Windows Phone,无论我尝试过什么,输出总是完整的“00:00:00.0000000”。 StringFormat=’m\\:ss’ StringFormat='{}{0:m\\:ss}’ StringFormat=’m\:ss’ StringFormat=m\\:ss 我是否以某种方式错过了正确的排列,或者在Windows Phone中出于某种原因这是不可能的? 更新 我使用了一种解决方法(下面的答案),但是如果有人知道的话,我仍然会想要解释这种奇怪的东西。 (我说“古怪”,因为StringFormat与DateTime属性完美配合,而不是TimeSpan 。) 更新#2 2010年的一个非常相似的问题 。 也许这只是旧版和/或“紧凑版”.Net的问题。 或者这个答案 ( StringFormat=\{0:h\\:mm\} )是否有效?

c#读取匿名类型列表与foreach发生错误

我需要从这个列表中获取数据,但是当我把我的foreach运行时错误说明列表包含空对象时。 但是如果我删除foreach并在listbox.itemsSource接收列表的行上放置一个断点,我看到我的列表正确加载了所有项目。 var imgs = e.Document.DocumentNode.SelectNodes(@”//img[@src]”) .Select(img => new { Link = img.Attributes[“src”].Value, Title = img.Attributes[“alt”].Value, }).ToList(); listBoxPopular.ItemsSource = imgs; foreach (var item in imgs) { listBoxPopular.Items.Add(new PopularVideos(item.Title, item.Link)); } 类: class PopularVideos { public PopularVideos() { } public PopularVideos(string titulo, string url) { Titulo = titulo; BitmapImage Img = new BitmapImage(new Uri(url)); } public […]