windows-phone

Compress and save base64 image on Windows Phone 8.1

心已入冬 提交于 2019-12-17 14:20:48
问题 I have implemented the following solution to compress a base 64 image and get back the new base 64 string. It works fine in Windows Phone 8.0 but targeting Windows Phone 8.1 it seems that there are changes in the environment. The WriteableBitmap has no constructor for a BitmapImage and the WriteableBitmap has no function SaveJpeg . I know that SaveJpeg is an extension, is there a way to add this extension to Windows Phone 8.1? Or is there any API which I can use? What do I have to change to

Compress and save base64 image on Windows Phone 8.1

南笙酒味 提交于 2019-12-17 14:20:23
问题 I have implemented the following solution to compress a base 64 image and get back the new base 64 string. It works fine in Windows Phone 8.0 but targeting Windows Phone 8.1 it seems that there are changes in the environment. The WriteableBitmap has no constructor for a BitmapImage and the WriteableBitmap has no function SaveJpeg . I know that SaveJpeg is an extension, is there a way to add this extension to Windows Phone 8.1? Or is there any API which I can use? What do I have to change to

Convert base64 string to image in C# on Windows Phone

半城伤御伤魂 提交于 2019-12-17 14:18:03
问题 I have a base64 string and I want convert that to an image and set the Source of an Image control to the result of that. Normally I would do that using Image.FromStream , similar to this: Image img; byte[] fileBytes = Convert.FromBase64String(imageString); using(MemoryStream ms = new MemoryStream()) { ms.Write(fileBytes, 0, fileBytes.Length); img = Image.FromStream(ms); } However, the Image.FromStream method does not exist on Windows Phone , and a casual search only turns up results that

Convert base64 string to image in C# on Windows Phone

女生的网名这么多〃 提交于 2019-12-17 14:14:52
问题 I have a base64 string and I want convert that to an image and set the Source of an Image control to the result of that. Normally I would do that using Image.FromStream , similar to this: Image img; byte[] fileBytes = Convert.FromBase64String(imageString); using(MemoryStream ms = new MemoryStream()) { ms.Write(fileBytes, 0, fileBytes.Length); img = Image.FromStream(ms); } However, the Image.FromStream method does not exist on Windows Phone , and a casual search only turns up results that

Windows Phone 8.1 Universal App terminates on navigating back from second page?

半腔热情 提交于 2019-12-17 02:33:10
问题 I have 2 pages in my Windows Phone 8.1 Universal App. I navigate from Page1 .xaml to Page2 .xaml by using a button with the click event code: this.Frame.Navigate(typeof(Page2)); When I am on Page2, and I use the hardware back button the app closes without an exception or anything. It just returns to the startscreen. I already tried the following on Page 2 : public Page2() { this.InitializeComponent(); Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed; } void

Error: DEP0001, HRESULT: 0x80073CF9 when deploying UWP app to Phone

孤人 提交于 2019-12-14 04:16:59
问题 Despite the alike existing threads here on SO, my problem is somehow different, I have an application that I made, I deploy it, works fine. I copy the same application solution, make some changes on it to create an other application that have almost the same logic as the first one (can't re-code everything from scratch), deploy it, and I receive this : Severity Code Description Project File Line Suppression State Error Error : DEP0001 : Unexpected Error: Install failed. Please contact your

How to read an audio file from IsolatedStorage?

主宰稳场 提交于 2019-12-14 04:09:01
问题 I have an audio file stored in IsolatedStorage .. I want to access it by calling a method of another class: using (IsolatedStorageFile isolatedStorage = IsolatedStorageFile.GetUserStoreForApplication()) { using (IsolatedStorageFileStream fileStream = isolatedStorage.OpenFile(filePath, FileMode.Open, FileAccess.Read)) { return fileStream; } } now when I call that method this way: var fileStream = Musics.TryGetMusic("DaDaDa.mp3"); musicMediaElement.SetSource(fileStream); musicMediaElement.Play(

BitmapImage missing BeginInit() and EndInit() function?

随声附和 提交于 2019-12-14 03:57:15
问题 As I have discovered, I do not seem to have access to the mentioned functions. I am importing the BitmapImage class from using System.Windows.Media.Imaging; however in the following code: public static void loadCardImage(Card card, ref Image image) { BitmapImage src = new BitmapImage(); src.BeginInit(); <--Cannot find this function src.UriSource = new Uri(card.imageLink, UriKind.Relative); <-- this is fine [..NotFinishedCoding..] } I get a parser error and a build error on the src.BeginInit()

Windows Phone - byte array to BitmapImage converter throws exception

时光总嘲笑我的痴心妄想 提交于 2019-12-14 03:56:27
问题 I have a byte array to a BitmapImage converter and it works fine. For tile support within my app, I create a tile from an image (resize and crop it) and save it into my database as byte array. Now, if I want to display this tile with my converter, it throws an exception: The component cannot be found. (Exception from HRESULT: 0x88982F50) My method for creating the tile: WriteableBitmap bmp = new WriteableBitmap(img); int height = bmp.PixelHeight; int newHeight = 0; int width = bmp.PixelWidth;

Making an image control invert its colors depending on theme

自作多情 提交于 2019-12-14 03:45:38
问题 I'm trying to work out how to have an Image control in my Windows Phone application invert its colors based on the global background setting (either "Dark" or "Light") chosen by the user in Settings->Themes->Background. 回答1: There is no built-in way to invert image colors within the framework. Instead, because of the overhead of doing this on the phone, you should create both versions of the image at design/build time and then choose which version to display from your code by detecting Theme