Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# C#4.0
Hi
I wonder if you guys can help me, how can I do a method just in my application's first run.
for e.g I want to write a registry key or create a file or checking existence of a file at the first time my application is executed; and other times it is executed the method will be ignored.
Posted 15-Aug-12 16:34pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I have a whole CodeProject article devoted exactly to this problem. Please see:
Wish You Were Here… Only Once[^].
 
Please see: this is pretty interesting. Even though my main very sophisticated method is very unusual and is developed mostly for fun, it is fully functional, based on the CLI standards, effective and demonstrates using very non-trivial technique. Besides, regular, non-esoteric approach to the problem is fully explained and discussed.
 
—SA
  Permalink  
v2
Comments
Mostafa M.A at 15-Aug-12 22:18pm
   
thanks
it's exactly what I want, but as you said before my knowledge is not enough to understand whole code.
actually I didn't understand most of it's parts.
hope that I'll understand all of it soon.
you know, I don't have such a lot of free time to go on C# programming, because this is not my main field in university. I study Civil Engineering...
so it might take such a long time for me to get familiar and to be expert in C#.
I really thank you for your kind answers to my problems
Sergey Alexandrovich Kryukov at 15-Aug-12 22:25pm
   
You don't have to understand the code -- it is well tested (you can easily test it with your code) and documented, you can just build my assembly, reference it and use in your projects as shown in the usage samples. The implementation is really tricky; as a matter of fact, I did not expect you to understand it; nevertheless, it is quite reliable, because only the conception and ideas are hard to understand, the implementation itself is very short and simple. If you keep interest to this matter and want to understand some detail later, I'll gladly answer your question.
 
Besides, look at the very beginning of the article to see what people would "usually" do.
 
So, anyway, please accepting the answer formally (green button) -- thanks. It is kind of quite comprehensive.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Kornfeld Eliyahu Peter 275
1 Maciej Los 214
2 Sergey Alexandrovich Kryukov 200
3 King Fisher 185
4 OriginalGriff 163
0 OriginalGriff 6,223
1 DamithSL 4,724
2 Maciej Los 4,196
3 Kornfeld Eliyahu Peter 3,894
4 Sergey Alexandrovich Kryukov 3,496


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 15 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100