11 2011 档案
windows phone 程序引用动态库资源
摘要:创建一个Windows phone项目 程序集名称: "WPAsseblyName" ,项目中添加"WPPage.xaml"页面创建一个类库项目 Windows Phone Class Library 程序集名称:"WPCLAsseblyName",项目中添加"WPCLPage.xaml"点击WPPage.xaml页面的Button按钮 导航到 WPCLPage.xaml页面 代码如下:NavigationService.Navigate(new Uri("/WPCLAsseblyName;compone 阅读全文
posted @ 2011-11-29 17:52 Games 阅读(262) 评论(0) 推荐(0)
关于Windows phone 7.1 IsolatedStorageFile问题
摘要:private const string FolderName = "temp1/NewFolder"; void MainPage_Loaded(object sender, RoutedEventArgs e) { using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication()) { file.CreateDirectory(FolderName); string[] array = file.GetDirectoryNames("temp1/"); 阅读全文
posted @ 2011-11-24 17:01 Games 阅读(422) 评论(0) 推荐(0)
关于C#中的弱引用
摘要:一:什么是弱引用 了解弱引用之前,先了解一下什么是强引用 例如 : Object obj=new Object(); 就是一个强引用,内存分配一份空间给用以存储Object数据,这块内存有一个首地址,也就是obj所保存的数据,内存分配的空间中不仅仅保存着Object对象信息,还保存着自己(Object本身)被引用的次数。 当一个对象被强引用的形式创建的时候,本身被引用的次数已经为1. 接着Object o=obj; 这句代码执行之后,obj指向的Object的存储空间已经被引用了2次,所以Object保存的被引用数值为2. 总结:强引用最终导致的结果就是被引用的对象的被引用次数+1; ... 阅读全文
posted @ 2011-11-24 14:21 Games 阅读(8927) 评论(0) 推荐(1)
WP7 读取Properties中的xml文件
摘要:public static string GetManifestAttribute(string elementName, string attributeName) { string ret = null; try { var settings = new XmlReaderSettings { XmlResolver = new XmlXapResolver() }; const string manifestName = "WMAppManifest.xml"; //const string appNodeName = "App"; using ( 阅读全文
posted @ 2011-11-22 17:54 Games 阅读(305) 评论(0) 推荐(0)
WebBrowser加载本地资源
摘要:加载的本地资源有两种情况:一:加载程序集里面的资源信息 1.加载html资源 (1) StreamReader reader=Application.GetResourceStream(New Uri("path",UriKind.Relative).Stream; webBrowser.NavigateToString(reader.ReadToEnd()); (2) 引用命名空间: Microsoft.Xna.Framework; StreamReader reader = new StreamReader(TitleContainer.Open... 阅读全文
posted @ 2011-11-17 15:52 Games 阅读(8276) 评论(0) 推荐(1)
windows phone 中对图片的存储和还原显示
摘要:以下两个方法分别用来完成对图片的存储以及还原显示:一:存储图片 public static string ImageSave(string ISFileName, Image SLImage) { var ISAccErr = "独立存储文件系统访问失败。"; var Rlt = ""; var WBmp = new WriteableBitmap(SLImage.Source as BitmapSource); var Buf = new byte[2 * 4 + WBmp.Pixels.Length * 4]; BitConverter.GetByt 阅读全文
posted @ 2011-11-17 10:28 Games 阅读(331) 评论(0) 推荐(0)
[转载]AutoResetEvent 与 ManualResetEvent
摘要:在.Net多线程编程中,AutoResetEvent和ManualResetEvent这两个类经常用到, 他们的用法很类似,但也有区别。Set方法将信号置为发送状态,Reset方法将信号置为不发送状态,WaitOne等待信号的发送。可以通过构造函数的参数值来决定其初始状态,若为true则非阻塞状态,为false为阻塞状态。如果某个线程调用WaitOne方法,则当信号处于发送状态时,该线程会得到信号, 继续向下执行。其区别就在调用后,AutoResetEvent.WaitOne()每次只允许一个线程进入,当某个线程得到信号后,AutoResetEvent会自动又将信号置为不发送状态,则其他调用W 阅读全文
posted @ 2011-11-15 15:03 Games 阅读(254) 评论(0) 推荐(0)
C# 向PivotItem中添加子控件
摘要:xaml语言:<controls:PivotItemName="SecondPivotItem"Header="Second"> <ListBox x:Name="SecondListBox" Margin="0,0,-12,0" ItemsSource="{Binding Items}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Margin="0,0,0,17" 阅读全文
posted @ 2011-11-14 14:48 Games 阅读(654) 评论(0) 推荐(0)
C#语言使用Windows phone 中的数据数据绑定
摘要:public class Sample{void Initialize(){ListBox PersonListBox = new ListBox();PersonListBox.Width = 480; PersonListBox.Height = 800;PersonListBox.ItemTemplate = GetDatatemplate();PersonListBox.ItemsSource = LoadPerson();}//返回绑定数据的自定义数据模板private DataTemplate GetDatatemplate() { StringBuilder sb = new S 阅读全文
posted @ 2011-11-14 14:09 Games 阅读(280) 评论(0) 推荐(0)
windows phone 中如何调用Dll类库里面的图片资源
摘要:1.首先创建一个普通的Windows phone application项目(UserInterface) 和一个windows phone class library类库(Dll).2.在Dll类库下面添加一个文件夹Imgs,并向其中添加图片资源Hydrangeas.jpg,其Build Action==Embeded Resource(为了让图片资源编译到Dll中),3.接着是在Dll中的cs文件里面引用图片资源,有两种写法: 一: Assembly asssembly = Assembly.GetExecutingAssembly(); Stream stream=asssembl... 阅读全文
posted @ 2011-11-08 23:44 Games 阅读(1000) 评论(0) 推荐(0)