Quantcast
Channel: Building Windows Store apps with C# or VB (archived) forum
Viewing all 7782 articles
Browse latest View live

Get a List of DMR Devices

$
0
0

I am trying to get a list of devices that are audio rendering devices. The property that I want to filter by does not have a canonical name. Its: {78C34FC8-104A-4ACA-9EA4-524D52996E57},97

Here is what I am trying to do.

string[] properties = { "System.ItemNameDisplay", "System.Devices.ModelName", "System.Devices.Connected", "System.Devices.IsNetworkConnected","{78C34FC8-104A-4ACA-9EA4-524D52996E57} 97"};
            string deviceSelector = "\"{78C34FC8-104A-4ACA-9EA4-524D52996E57} 97\":=\"Multimedia.DMR\"";
            //string deviceSelector = Windows.Media.Devices.MediaDevice.GetAudioRenderSelector();
            //string deviceSelector = "System.Devices.InterfaceClassGuid:=\"{8660e926-ff3d-580c-959e-8b8af44d7cde}\" AND System.Devices.InterfaceEnabled:=System.StructuredQueryType.Boolean#True";
            //string deviceSelector = "System.Devices.PrimaryCategory:=Multimedia.DMR";

            var pnpobjects = await PnpObject.FindAllAsync(PnpObjectType.DeviceContainer, properties, deviceSelector);

Without the filter the PKEY_DeviceDisplay_PrimaryCategory has the value I am looking for: "Multimedia.DMR". How do I structure the filter property without the canonical name of the property?

Thanks for your help.


Overriding implict style breaks ThemeResource references?

$
0
0

In a Windows 8.1 store app, when I define an implicit style, say for a TextBox, the light/dark theme changes I make to built-in ThemeResources seem to be ignored.

For instance,

  1. I've set up a ThemeResource file for the Default (Dark) theme, and set the color of TextBoxBackgroundThemeBrush to Lime. 
  2. I then copied the default TextBox template to two different resource dictionary files and made a change to the border color and width (for visual cues).  The files are identical except for defining an x:Key in the "explicit" theme file.
  3. The three XAML files (my theme resource dictionary and the two style files are added to App.xaml as MergedDictionaries.
  4. I added two textboxes to a vanilla page - one has the explicit style applied, one relies on the implicit style... the result is below:

Note that the Implicit Style has lost the Lime background, even though it refers to {ThemeResource TextBoxBackgroundThemeBrush} just like the explicit style.


Free App - Money or Not?

$
0
0
I have one more question :) ... If I submit an app and set it to be free with no ads , am I getting some money or not ? I am new here :D

Data Binding

$
0
0

I have GET request f in the ASP.NET Web API  value controller's which return image or image in byte[] format

here is code

 
public Image Get()       
{           
  Image _image = Image.FromFile("file address");  return _image;         
}

OR

public byte[] Get()       
{           
   Image _image = Image.FromFile("file address");   byte[] _imageByte = ImageToByteArraybyMemoryStream(image);   return _imageByte;       
}       


 private byte[] ImageToByteArraybyMemoryStream(Image _image)   {           
   MemoryStream ms = new MemoryStream();     _image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);   return ms.ToArray();     
}

and in the client side which is windows store universal app i could not convert byte[] to Image

 
private async void _Click(object sender, RoutedEventArgs e) 
 {           
  Uri datauri = new
  Uri("http://localhost:63606/Api/ControllerName");           var client = new HttpClient();     
  var datafile = await client.GetStringAsync(datauri); 
 byte[] patern = JsonConvert.DeserializeObject<byte[]>(datafile);   

??????       
}


Can I stop my app quitting if the user locks their computer?

$
0
0

Part of my app has a long-running activity in it. I've observed that if I lock the screen on my computer (Win+L) then, after a while, the app stops running. My app survives that and the resuming but the problem is that there isn't really a good reason why it couldn't carry on running and processing the long-running activity ... except for the fact that the OS killed the app.

Is there a setting or similar that I can use to stop my app being told to quit?

I can't switch over to using a background task because they aren't allowed to do enough work. The long-running activity would being a *really* long running activity then :-(

I just need to find a way of stopping the app from quitting, if possible.

Thanks.

How to encode MultipartFormDataContent to UTF-8

$
0
0

Hello,

I need to convert MultiPartFormDataContent to UTF-8 Format, but didn't find any way to do that, below is my code

  MultipartFormDataContent form = new MultipartFormDataContent();

 if (fileStream != null)
  form.Add(new StreamContent(fileStream), "somestring", fileName);

When I pass filename as "MyFile.txt" it works Perfectly, but when I pass something like this as filename "Bayern München.txt" it converts to garbage value like this "=?utf-8?B?QmF5ZXJuIE3DvG5jaGVuLnR4dA==?=";

Is there anything missing in the code?

Thanks in advance.

Phone Call API

$
0
0

hi

i want to know there is any API to get incoming call like TrueCaller app do

i want to create app when phone ringing my app active and turn camera flash on and of (SOS)

Playing Encrypted Video File with MediaElement

$
0
0

My Windows Store app has an encryption / decryption option that lets people store all their data files (which include images and movies) encrypted in their project folder for potential copying over the Internet, to cloud services, etc. (Trust me, this is necessary, and no, BitLocker, SSL, etc. are insufficient).

To play videos, the app uses MediaElement. I'd like to be able to set the MediaElement source to a stream that decrypts the file on demand. With desktop apps, I would just use a CryptoStream, but Windows Store apps don't appear to support CryptoStream. 

Can anyone suggest an efficient way to do this?

Other options that come to mind (each with significant disadvantages)-

- Decrypt the whole file to a temporary location, then source MediaElement with the temp file - obviously bad if the app or device crashes before the temp file is deleted though, and not particularly efficient.

- Create a custom media stream source that decrypts the data frame by frame, sample by sample, and feeds it to the MediaElement; problem with this is that my encryption function would likewise have to scramble the video and audio data sample by sample, rather than encrypt the whole file once, meaning lots of C++/DirectX nastiness or dealing with media transcoding which I've not had good experiences with (maybe they've fixed it, but earlier this year I found the whole transcoding system to be riddled with memory leak problems and wound up having to write everything in C++ with DirectX)

- Write a custom CrytpoStream that implements IRandomAccessStream? I honestly wouldn't know where to begin though.

Any other ideas appreciated. Thanks!

Peter


show Rate window if ...

$
0
0

hi

i have this code for get rate :

await Launcher.LaunchUriAsync(new Uri("ms-windows-store:reviewapp?appid=" + CurrentApp.AppId));

how can i do show this message if user is not rate before this to my app?

(sorry my english is not good )

tanx


Amir Ameri

Drag and Drop files from other places to universal apps(windows store)

$
0
0

Hi,

Is there a possiblity to drag and drop a file from windows desktop or from other windows store app to my application. I tried searching samples, but it says about dragging an image with in the solution.

The best example is drag and drop files into recycle bin. Is there a way possible for modern app(instead of recycle bin), or give an user similar experince as the same.

If not windows8/windows8.1,could we expect in windows 10.

I believe if it is not possible with XAML/c#, the same holds good for HTML5/JS



Thanks & Regards Tejaswi Chandrapatla

Windows Phone 8.1 xaml, c# ComboBox does not display selection when first item is selected from full page list.

$
0
0
I have 3 comboboxes on a xaml page and most of the time when I select the first item on the full page list displayed when the number of items are > 5, the screen returns to the combobox and the box is blank. The combobox.SelectedItem is valued but it does not display.  This does not happen every time and I have seen this using the emulator and my windows 8.1 phone.  If I select any other item in the list they always display but when I go back and select the first item the box is blank.  Does anyone know what I could be doing that is causing this?

BackgroundDownloader completion missed

$
0
0

Hi

I am wondering if it is possible to miss a BackgroundDownloader completion in this scenario:

- A Backgroundownloader is started
- The Application is suspended as the download is just finishing
- Application cannot handle the end of download because it has already called SuspendingDeferral.Complete
- The aplication is then Terminated

At restart, the download cannot be re-attached (GetCurrentDownloadsAsync won't provide it as it was finished), it is therefore not possible to know if it was successfully completed.

I am downloading multiple files at once which would increase the probability if it exists.

Regards

Charles


windows 8 store app- authorize exception

$
0
0

Hellow

i am tring to write simple json file localy

in my windows 8 store app

but i get an exception : UnauthorizedAccessException

this is the code:

 internal async static void Save(List<RecipeDataGroup> list)
        {

            string json = JsonConvert.SerializeObject(list);

             var _file = await Package.Current.InstalledLocation.CreateFileAsync("Data\\Recipes2.txt");

            await Windows.Storage.FileIO.WriteTextAsync(_file ,json );



        }
How to solve it ?

m.sh

C# app with webview and Cordova for windows 8.1/10.0

$
0
0

I am building a hybrid application in C# and am including a WebView. This WebView needs to include Cordova. This is port of something we already do in IOS (objective C and Cordova WebView) and Android. The problem is that the latest Cordova for Windows 8.1 and even Windows Phone 8.1 is all based on Windows JavaScript runtime. So I took cordova platform generated code and included in a WebView. The issue I ran into is that Windows JavaScript based store app somehow have access to "Windows" namespace in the browser. In case of a webview the "Windows" namespace is missing in JavaScript. Cordova depends on "Windows" runtime api being present in the browser.  

My guess is that when Windows Javascript based store app is created, Microsoft framework is somehow creating a single WebView with IE and putting in the "Windows" namespace inside it. Is there a way I can add access to the "Windows" namespace inside the a WebView created from C#. In android there is webView.addJavascriptInterface (Windows, "Windows"). 

I know that if the app is Windows JavaScript based, I can add a C# component that can be called from JavaScript. But that is not what I want, I want C# WebView with Cordova. 

Any help is appreciated

 

In App Purchase

$
0
0

Hi there!

Working now on in-App-Purchases (Universal App) and  having a question. 
How can I get the UserId who makes this purchase?

Live Connect User Id could be incorrect because of User could change account in Store.

Thanks everyone in advance!

Xaml control layout is inexplicable

$
0
0

Hi,

I have a button as described here :

<Button x:Name="button1" Width="100" Height="100"><Grid><Rectangle Width="100" Height="100"><Rectangle.Fill><SolidColorBrush Color="Blue" /></Rectangle.Fill></Rectangle></Grid></Button>

But this is what i get back ...

This is not what the code describes as far as I'm concerned. I expect a button that is completely blue from edge to edge. Can someone please point me to the 'invisible code'?

Thanks

Part 1: Create a Hello World App - Cannot change the Style of the TextBlock

$
0
0
I am following this tutorial for creating a Hello World App.



In the To style an element section, I cannot perform step# 6 because System Resource is greyed out for me just like Local Resource is greyed out in the image below step# 6. 

I tried to paste the XAML directly into MainPage.xaml file and rebuilt the project but I get 3 errors. 

<TextBlockText="What's your name?" Style="{ThemeResource BaseTextBlockStyle}"/>



What could be the problem?

ERRORS:


Error1 ThemeResource is not supported in a Windows App project...\documents\visual studio 2012\Projects\HelloWorld\HelloWorld\MainPage.xaml4149 HelloWorld

Error2 The type 'ThemeResource' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built...\documents\visual studio 2012\Projects\HelloWorld\HelloWorld\MainPage.xaml4156 HelloWorld

Error3 Unknown type 'ThemeResource' in XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'..\documents\visual studio 2012\Projects\HelloWorld\HelloWorld\MainPage.xaml4149 HelloWorld

2 player turn based game logic in c# for snake and ladder

$
0
0

Hello programmers,

I am developing a snake and ladder game in xaml and C#.(windows 8.1 app)

my question is:

1) I am unable to think about the solution for player turn, I have build the game logic for single player and its working fine. please provide some solutions or the concept.

2) I have build the same game logic with two different ways, one with nested if else and the next with array which one would be good for performance.

and I also want to know about windows Azure for online score and multi player game service.


Post request for Publishing tweet on Twitter Windows Phone 8.1 using HttpClient

$
0
0
I am trying to implement sharing a link on twitter using Windows Phone 8.1. The only compatible libraries I found are Linq2Twitter and BoxKite.Twitter. But using both these I could not even Authenticate the user. So I got WebAuthentication sample from Microsoft official site. I am able to authenticate the user and get the authorization token and screen name. But I am not able to create the post request for sharing a tweet or link on it. Can somebody provide a snippet?

Setting up Fiddler to capture network traffic from the Unity 3D Editor

$
0
0

http://aka.ms/q1fskv

The blog convers how to configure the Unity 3D Editor and Fiddler so you can capture your network traffic in Fiddler when working in the Unity 3D Editor.


Bret Bentzinger (MSFT) @awehellyeah

Viewing all 7782 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>