Windows Phone - C# - First Time Run [duplicate] - c#

This question already has answers here:
Is there a "first run" flag in WP7
(3 answers)
Closed 9 years ago.
Is there any way to find out if the application has run for the first time; and if so, how do I access it?

There isn't a built in feature for this (that I know of), but you could use this bit of code. Is there a "first run" flag in WP7
Essentially you just want to use IsolatedStorage and write something there such as a boolean and check that each time the app is ran.

I had to do this on iPhone and Android to display a "Please rate us.." dialog on the first run. A simple solution for both cases, and Windows Phone as well, is to write out a file on the first run. Check for it when the app starts, if it's not there, you know it's the first run.

Related

How to get a WPF app to open another app if it exists [duplicate]

This question already has answers here:
Check if an executable exists in the Windows path
(8 answers)
Closed 3 years ago.
I am working on a WPF app, and I would like to include a button that directs it to another app. I would like it to have the following functionality:
If the app is installed on the user's computer, it opens the app for them.
If the app is not yet installed, it sends them to a link where they can download the app.
I know I will need to use Process.Start to open the app, but I am stuck on how to check if the app exists. If anyone could point me in the right direction it would be appreciated!
Two things you can use:
File.Exists(string) - Checks if the file exists.
try-catch - Simply try to open it, and handle any exceptions.
I would probably opt for the first solution...

How I can play audio in C# console application? [duplicate]

This question already has answers here:
How to play a sound in C#, .NET
(7 answers)
Closed 3 years ago.
I would like to know if it possible just play some kind of audio file in C# Console Application.
I don't find any answer on this question.
Many Thanks
In command prompt you can play an audio file by typing it's name from location folder:
c:\my_Music>track1.mp3
This opens the file with the format's associated progam so there will be a pop-up of an external program. Set program by using right-click on a file and choose "Open With".
I've not tested this in a console app. But you should be able to type a String into the console app and then trigger an ENTER press event.
Option 2:
Use SoundPlayer class.
A good tutorial for beginners. Also can check this: Playing sounds on Console.

How can I launch a Windows application ONLY from another application? [duplicate]

This question already has answers here:
C# : Making an exe to not run directly
(4 answers)
Closed 7 years ago.
I want to have a WPF C# program launch a second WPF C# program, and prevent this second program from being launched any other way. Any ideas?
You could pass the 1st application's Process Id as a parameter, and have the 2nd application look up and validate the calling process.
Compile the second program as a dll, make the entry point internal, and have both applicatios share namespaces. Depending on your level of security, you might want to implement some handshake protocol between both applications.

Detect when user writes/deletes file in specific folder [duplicate]

This question already has answers here:
Notification when a file changes?
(3 answers)
Closed 8 years ago.
I have inherited application that, among many other things, has to watch if user writes/deletes text file into specific folder.
Currently, the application uses timer and polls after 5 seconds. I find this ineffective, and wish to improve this part of code.
My question is about existence of the .NET function that monitors changes in directory. Is there such function I can use to detect when a file is written/deleted in a specified folder?
Thank you.
Yes, you have the FileSystemWatcher class. It does exactly what you're looking for
Yes there is. I would suggest you take a look at the FileSystemWatcher class:
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher%28v=vs.110%29.aspx
It's quite easy to set up, and it monitors for Win32 events, so is relatively inexpensive to use.

How do I remove the debug string in the windows emulator? [duplicate]

This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
WP7 RTM Emulator is displaying the framecounter and dx info on the rightside - is this the default?
I want to take a nice screenshot of my app and send to a friend, but I got the silly debug string in the upper right corner. How to I remove it?
Seems to be numbers and shift if using acceleration for instance
Try running it as non-debug as you can:
Use a release build instead of a debug build
Use Ctrl-F5 instead of F5 to launch (so there's no debugger attached)
IIRC, that will prevent the diagnostic information from showing. It's probably that you only need to take one of these steps, but I couldn't tell you which offhand.

Categories