Tag: windows phone 7

如何在不阻止UI的情况下暂停

我有一个点击事件,一旦点击一个按钮,手机会振动。 这通常很有效,除非有时振动不会停止,直到我完全关闭应用程序。 我想给应用程序一些时间来完成它的振动,然后继续使用方法的其余部分,但我根本不想阻止UI。 我怎么能做到这一点 MainPage.xaml.cs中 void newButton_Click(object sender, EventArgs e) { //Button vibration if (Settings.EnableVibration.Value) //boolean flag to tell whether to vibrate or not { VibrateController.Default.Start(TimeSpan.FromMilliseconds(100)); //place vibration stop here? } this.NavigationService.Navigate(new uri(“/NewPage.xaml”, UriKind.Relate)); } 我已经尝试过VibrationController.Default.Stop(); 但这完全消除了振动。 有没有办法简单地等到振动完成后再导航到新页面,或者做该方法应该执行的其他任何操作? 有关此实施或其他建议的任何建议或建议?

将图像源设置为URI

如果我有一个在线图像的链接,我想将图像源设置为这个uri,我该如何做到最好? 我正在尝试的代码如下所示。 BitmapImage imgSource = new BitmapImage(); imgSource.UriSource = new Uri(movie.B_Poster, UriKind.Relative); Poster.Source = imgSource; 此外,如果我想缓存此图像再次加载它是如何完成的? 谢谢

如何在隔离存储中保存超链接按钮

我有一个超链接按钮列表,在运行时创建 public void SaveBookmark() { Button objButton = new Button(); objButton.Content = “Delete”; objButton.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; objButton.Foreground = new SolidColorBrush((Colors.Black)); objButton.BorderBrush = new SolidColorBrush((Colors.Black)); HyperlinkButton objhyperlinkbtn = new HyperlinkButton(); objhyperlinkbtn.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; objhyperlinkbtn.FontSize = 34; objhyperlinkbtn.Foreground = new SolidColorBrush((Colors.Black)); objhyperlinkbtn.Tag = Index; stackpanel.Children.Add(objhlbBookMark); stackpanel.Children.Add(objButton); } 我想将它保存在独立存储中。 请帮我把它保存在隔离存储中。 我想让用户选择书签,如果用户保存书签然后超链接按钮保存在页面上以查看书签列表

似乎无法从Windows Phone 7中的TouchPanel获得触摸输入

我在Visual Studio中开始了一个新项目,并且一直在尝试使用静态TouchPanel类来获取输入。 我通过EnabledGestures属性启用了“Tap”手势,但是当我点击屏幕时手势没有注册(即TouchPanel.IsGestureAvailable返回false)。 其他东西,如Mouse.GetState()。LeftButton == ButtonState.Pressed永远不会certificate是真的,即使在我以前的项目(基于Microsoft示例项目)中它始终没有任何问题。 任何人都有任何想法,为什么我似乎无法从设备获得任何forms的输入?

WPF网格中的独立宽度

我在WPF中有一个2行2列的网格。 我希望列宽对于每一行都是独立的。 我试过“自动”,但没有成功。 这是一张图片,以便解释: 如何使用网格完成此操作?

Windows Phone上的密钥字符

我想确定用户通过键盘输入的符号。 例如,在Windows窗体中,KeyPressEventArgs具有KeyChar属性,但Windows Phone中的KeyEventArgs没有此属性。 它需要处理这个事件,因为我想处理一些西里尔符号。

防止在全景项目或枢轴项目的最后一项上滚动wp7 c#

我有n个枢轴项。 如何停止从最后一个项目滚动到第一个项目。 任何帮助将不胜感激。

如何在WP 7中使用gif动画图像

我看过这篇文章: 在Silverlight的WP7应用程序中显示GIF 但就我而言? 动画我正在使用弹出窗口。 因此,当应用程序启动时,它会显示一个弹出窗口5秒钟。 在这个弹出窗口中,我想显示一些.gif图像,但它不起作用。 这是我实现的代码: public partial class AnimatedSplashScreen : UserControl { protected Uri ImageSource { get; set; } public AnimatedSplashScreen() { InitializeComponent(); ImageSource = new Uri( “http://sofzh.miximages.com/c%23/Sunflower_as_GIF.gif/200px-Sunflower_as_GIF.gif”, UriKind.Absolute); ImageTools.IO.Decoders.AddDecoder(); } 而xaml代码是: 但结果它不起作用,它显示一个空的背景。 更新:ImageTools.IO.Decoders.AddDecoder(); ImageSource = new Uri(“ http://sofzh.miximages.com/c%23/hisoka_normal.gif ”,UriKind.Absolute); 它仍然无法正常工作

WebClient – 等待文件下载

我正在开发一个函数来返回一个从xml文件生成的集合。 最初,我使用本地xml文件进行测试,但现在我已准备好让应用程序从服务器下载真正的xml文件。 我很难看到如何做到这一点,因为WebClient对象需要被赋予一个OpenReadCompleted事件处理程序 – 我无法从此返回集合数据,并且在此处理程序执行时,原始函数已经结束。 我原来的代码如下: public static ObservableCollection GetNear(GeoCoordinate location) { ObservableCollection Items = new ObservableCollection(); // Load a local XML doc to simulate server response for location XDocument xDoc = XDocument.Load(“SampleRemoteServer/outlet_list.xml”); foreach (XElement outlet in xDoc.Descendants(“outlet”)) { Items.Add(new OutletViewModel() { Name = outlet.Attribute(“name”).Value, Cuisine = outlet.Attribute(“cuisine”).Value }); } return Items; } 如何在此函数中加载文件,运行事件处理程序,然后继续该函数? 唯一可以想到的是添加一个循环来继续检查一个变量,该变量由事件处理程序代码更新……这听起来不是一个好的解决方案。 […]

在Windows Phone 7中设置MediaElement的来源?

我正在尝试在C#中设置媒体元素的来源。 这就是我正在做的事情 XAML部分 C#部分 private void shout_Click(object sender, RoutedEventArgs e) { this.Sound.Source = new Uri(“Sounds/fusrodah.wma”, UriKind.Relative); this.Sound.Play(); } 以上不起作用。 但是,如果我在xaml中手动设置路径它可以工作。 如何在C#中设置MediaElement的源代码?