windows application setup problem? - c#

I developed a window application and setup for that application, when i click the setup it is open and when i clicked for second and third time and so on it is opening again and again.
please help me in this situation thank u.
I developed the application in C# language.it is running perfectly but when i click the setup again it is opening how can i stop it?

I think this is pretty much the expected behaviour. If you want to make sure that only one instance of your programm is started - which can be pretty challengeing - this is another issue. Pls let us know which language etc. you're using.
This codeguru article might be a good starting point anyways.
ADDITION:
In C# terms you might find this devblogpost interesting.

Related

Is there a way to use Edit And Continue when debugging a Prism application?

we are developing a Prism application and as all modules are loaded using Reflection thru the Bootstrapper we cannot use the "Edit & Continue" feature which certainly increases productivity.
Is there a way to overcome this problem?
Thanks.
I could manage to get Edit and Continue working with Prism! A few days ago i tried Edit and Continue with an Prism-Module and failed. Today i tried it again and what makes the difference is that i first test Edit and Continue with the Main-Project. I debugged the shell-view model and made than some changes in the source and Edit and Continue works as expected. After that i go to a module and surprise Edit and Continue starts working in the prism-modules. Maybe you can reproduce this behavior and report if it works. If not, we can go on and compare our projects to find the difference.
Regards
Christoph

Is there a way to open Windows date and time settings dialog from a WinForms application?

I'm working on an embedded software, where we would like to avoid exposing Windows features and interfaces as much as possible. However, users need the ability to change the system date and time, and perhaps also timezone or daylight saving mode.
I thought I would create our own simple Form for that and I tried digging into Win32 API calls, but realized that it's not a simple way.
So I found that basically the easiest way here would be to invoke the well-known Windows dialog from the software and let users changing stuff there. I couldn't find anything about it so far. Is there any executable for it (such as gpedit.msc for example), or is there any API calls to show that window? If not, or in case of any contras which I didn't take into count, can anyone suggest a better way for this task?
EDIT: Thank you for the timedate.cpl tip, I will try it as soon as I can.
On my desktop version of Windows you can show that dialog by executing timedate.cpl. I've no idea whether or not that will work on your embedded Windows.
Yes there is. Use this code and upon button clicking it will work:
System.Diagnostics.Process.Start("timedate.cpl");
It should work. If you want to open other windows controls you only have to change "timedata.cpl" to the command of your choice.
Good Luck!
Try this:
Process.Start(System.Environment.SystemDirectory + #"\TimeDate.cpl");
But I don't know if it works on your embedded Windows...

Is Application.Restart bad?

I've got a .Net windows form application where a lot of variables are initialized in the Main_Load event and I have a situation where I want my DB re-queried and all vars set to null and re-initialized (basically the form 100% reloaded from the start), but I wrote my Main-Load in such a way (my fault) that it's not that easy to do...
I know I could get exactly what I want by simply calling Application.Restart and it does the trick beautifully, but I'm not sure if this is good programming practice or considered really bad.
Are there any problems that I'm likely to run into by using Application.Restart in this context?
Not friendly to debug, but there's nothing really wrong with it. It is the exact same as terminating the app and starting it again.
You can avoid it by simply creating a new instance of your main form and closing the old one. That however does require you to prevent the program from exiting. Code is here.
It's not that the method doesn't work; rather, many times programmers forget that they've put something in their code that would stop the application from automatically shutting down, or starting up.
Please follow this Thread
You can also do the job with
System.Diagnostics.Process.Start(Application.ExecutablePath);
Application.Exit();
To directly answer the question in the title, yes restarting an application to re-initialize variables is bad practice.
There are cases where restarting an application is usefull (in example self-update), but restarting to mimic a ReInitialize() method is bad in my opinion.
I had problems with this.
I really needed to restart a large Winforms Application, when a user logs off, to ensure all cached (my) data are purged.
Solved my problem by adding the Application.restart() into the Application Shutdown Event.
This works inside the VS environment and when running the EXE
If you want to find that event select your main project properties and from the Application (Side Tab) select View Application Events at the bottom.
My guess is that this works because it is very late on in the closing process. Hope this helps someone and, more importantly, it continues to work.

How to get a value of a RadioButton from a WinForm application that I don't have an API for?

I have a small calculation system that will be installed in multiple PCs. Those PCs have a program installed in them and this program is always open (but minimized).
I need to get the value of a 'RadioButton' in this program but I can't access it!
I've tried to get an API for this application but the company developed it refused to co-operate. I've got a crazy idea, you can refer to my question regarding this idea Click It and the last thing is to get the cache for the button but I think this is going to work with WebApplications only!
Any help would be Great! =) .. And btw I decided to build my application as web application but then I changed my mind to build it as a WinForms because of the screenshot. But if I got a better and a more clean solution I'd go back to WebApp
Screen grabbing is not a good option. You should be able to use FindWindow based methods to get hold of the radio button if the app uses windowed controls. If not then UI Automation may very well be able to get the value of the radio button. Whatever it's usually possible to read UI state out of another application with methods like this, and much easier than screen scraping.

Multi-project solution & cross-application data handling

Time for another "what am I overlooking" question! Thanks in advance for your guidance, and as ever, you guys rock! :)
.NET 2010 Winforms, but I only have the Express version. I have 05 Pro, but am trying to transition to 2010. If I need to upgrade... well, maybe I'll stick with 05, since this is just for my own amusement.
I want to make a multi-application suite for a project I've got in mind. The project has several components that should interact together, but still be robust and stand-alone.
The components include:
1) A Notification Area utility (I/E System Tray) - I anticipate using this as a quick-launch, data-passing medium, and other minor things. I'd like to keep it as small as possible. Double-click to launch main menu, right-click to launch another app.
2) The Main Menu. This is what would start if you run the program normally, and essentially organizes the other apps.
3-6) These other apps each do some things, but are fairly self-contained.
.
.
Question 1: What is a multi-app or multi-project solution called? I think I'm missing a buzz-word here, because my search-fu isn't getting any results.
For the most part, I'm looking for some pointers, more precise vocabulary, and some suggestions on what existing features can handle these sorts of things.
Question 2: How can I make each of these apps/projects able to launch independently? I don't want to go through the Main Menu each time; I want the ability to start the app from Program Files directly.
Despite that requirement, I also need to check if the Notification Utility is running, and start it if it isn't. The Utility should be running any time any other app is running, and closing it would close all the other apps.
Also, the Notification (and Main Menu) apps need to be able to start the other apps.
Question 3: How can I pass data between the windows?
The concept in my head is to have Window A send a packet to the Utility, which would then pass it to Window B. Window B also needs to send a confirmation packet.
Question 4: How can I set up one of the apps (the Notification Utility)
Question 1 - "Solutions" typically contain one or more projects.

Categories

Resources