windows-phone-7.1

Margin on ItemsControl of virtualizing ListBox not working properly

送分小仙女□ 提交于 2019-12-10 02:52:22
问题 I have a problem with a class which extends ListBox in Windows Phone 7 Silverlight. The idea is to have a full ScrollViewer (black, e.g. fills the whole phone screen) and that the ItemsPresenter (red) has a margin (green). This is used to have a margin around the whole list but the scroll bars begin in the top right edge and end in the bottom right edge of the dark rectangle: The problem is, that the ScrollViewer can't scroll to the very end, it cuts 50 pixels off of the last element in the

What is the right way to get Unique Identifier of windows phone 7?

笑着哭i 提交于 2019-12-09 21:53:43
问题 Currently i am using the following methods. I am not sure if this is the correct way to identify each unique phone (doesn't need to have same sim card). For android there is a imei phone public static String GetDeviceUniqueID() { object DeviceUniqueID; byte[] DeviceIDbyte = null; if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out DeviceUniqueID)) DeviceIDbyte = (byte[])DeviceUniqueID; string DeviceID = Convert.ToBase64String(DeviceIDbyte); return DeviceID; } 回答1: Yes , it is the

Saving a WriteableBitmap

无人久伴 提交于 2019-12-09 19:56:26
问题 "mai" is the grid name that contains the image, text and small image. I was following a blog post about being able add to your image by making it a WriteableBitmap (with a UIelment). try { WriteableBitmap wbm = new WriteableBitmap(mai, null); MediaLibrary ml = new MediaLibrary(); Stream stream = new MemoryStream(); wbm.SaveJpeg(stream, wbm.PixelWidth, wbm.PixelHeight, 0, 100); ml.SavePicture("mai.jpg", stream); MessageBox.Show("Picture Saved..."); } catch (Exception ex) { MessageBox.Show(ex

Associate file extension with app in wp7.1

折月煮酒 提交于 2019-12-09 03:08:27
问题 Is it possible to associate a particular file extension with my app in wp7.1? I would like to allow the users of my app to email files of a particular type to each other and then when they click on the attached email file it would launch my app so it could process the file and add it to isolated storage. 回答1: No, it's not. You need a "special permission" from Microsoft to do it, that's how Adobe was allowed to do it. But there's no part of the official released SDK that allows for it. 来源:

JSON Can't be Deserialized to Object, Needs Array?

我的未来我决定 提交于 2019-12-09 01:06:03
问题 I am trying to take the incoming JSON items and bind them to listbox items but I am told by visual studio that I need to do an Array and not Object? I've never had to do this... Anyone know how? My RootObject: public class RootObject { public string url { get; set; } public string display { get; set; } public List<string> genetics { get; set; } public List<string> price { get; set; } public List<string> brandMaker { get; set; } public string form { get; set; } public string dosornos { get;

Generating QR code on Windows Phone 7.1 using ZXing 2.0 C# Port

扶醉桌前 提交于 2019-12-08 21:02:33
I'm having trouble generating a QR code on mango 7.1 with ZXing 2.0. It should be pretty straight forward, but it's not working. The code: QRCodeWriter writer = new QRCodeWriter(); var bMatrix = writer.encode("Hey dude, QR FTW!", BarcodeFormat.QR_CODE, 25, 25); var asBitmap = bMatrix.ToBitmap(); image1.Source = asBitmap; image1 comes from the xaml. bMatrix seems to contain the data that I need, but image1 never shows a thing. So I managed to do a workaround. I'm not sure if my original code didnt work due to a bug in the ZXing C# port or if I did something wrong. Anyhow, here is what I did to

Start/Stop DispatcherTimer from a different thread

笑着哭i 提交于 2019-12-08 19:16:38
问题 Here is my code.. public DispatcherTimer tmr = new DispatcherTimer(); void somefunction (parameters){ if (something) tmr.Start(); if (something else) tmr.Stop(); } My problem is that I can't access the Start/Stop methods of the tmr object from the second function since it runs on a different thread!!! Can somebody please help me?? I am struck wih this problem for almost 3 days! :( 回答1: You need to Invoke it via Dispatcher (for marshaling the call from another thread) like so Deployment

How to get the latest char written in textbox?

 ̄綄美尐妖づ 提交于 2019-12-08 16:53:21
问题 I want to know how to get the latest char written in TextBox. It does not mean the last of the string. For instance, I write this : This i a test. But I forgot 's', so I move my finger to the 'i' and I add the 's' : This is a test. So, how can I get the 's' ? I want to get it in char or string, but I don't know how to do... I hope it is clear. 回答1: If you want to get the last written character, then subscribe TextBox to the KeyDown event: C#: textBox.KeyDown += textBox_KeyDown; XAML: <TextBox

Xap packaging failed. Object reference not set to an instance of an object

安稳与你 提交于 2019-12-08 14:26:04
问题 I'm getting this error message on my PC when I try to build my Windows Phone app: Xap packaging failed. Object reference not set to an instance of an object I'm using Dropbox. On my laptop, It works perfectly fine and I can debug etc...On my PC however, I can't. I tried many things such as: Delete obj/Debug Folder Check for files which are missing on the Solution Explorer So far, nothing has helped. Any idea how I can fix this? 回答1: You should check, in every folder of your project, for

More accurate estimating guitar pitch frequency based on FFT(already) result

别等时光非礼了梦想. 提交于 2019-12-08 12:54:59
问题 I have used FFT algorithm to detect frequency of the sound(guitar pitch) and it works great when I play sinosoidal sound from the computer it will estimate it perfectly but it is not so perfect when i use guitar. How to better estimate the pitch frequency? double[] spectrum = FourierTransform.Spectrum(ref sampleBuffer);//spectrum contains data from FFT double frequency = indexOfMax(spectrum) * 16000 / 500; //sampling rate/FFT size //indexOfMax just finds the index of the maximum element in