1

I'm virtually a complete novice, I've tried Googling for answers and become totally confused.

Using Visual Studio 2010, I have a C# application which is an email notifier for a friend. The external (Arduino) hardware works, the main code (from a website) works but I'm sending it to her on the other side of the world to use and she is very 'non-technical' - hence the need for a 'setup form'.

I have created a form where she can enter comm port (selected from a list), username and password (all to be used by the main code), but that form should run only when the application is first installed on the PC.

At the moment it runs in VS-2010 (though I need to iron out a couple of snags), validates and hides - but I don't know how to a) store the data and make it available to the main code, b) ensure that the form only runs at setup, or c) exactly what I need to do or include to create an installable application.

Could somebody either help or direct me to some tutorials that don't assume I understand all the terminology?

I just want to create something that she can instal from a memory stick. I know it can be done and it's proababy quite simple for those who understand - I'm trying to learn but I'm no longer young and it's a struggle.

Thanks

Christian Phillips
  • 18,399
  • 8
  • 53
  • 82
user2609437
  • 11
  • 1
  • 2
  • "Deploying a C# application"? Does that mean making an installer? And an email notifier? Do you have a mail server? You still have a lot to consider. – Mark Jul 23 '13 at 07:19
  • Add a setup project to your solution. This link can help you: http://www.c-sharpcorner.com/Blogs/9817/ – Shai Aharoni Jul 23 '13 at 07:21
  • 2
    To store the data that your application needs, you can use an app.config file. Your application can read the settings that are defined in the config file. However, you'll probably want to encrypt sensitive information like passwords. During the installation, you can update the config file, based on the user's input. As mentioned, you will need to create a setup project for your application. See here for more info: http://raquila.com/software/configure-app-config-application-settings-during-msi-install/ – Riv Jul 23 '13 at 07:51
  • Making an installer? - Yes, I guess so...I just want to have something on a USB stick that she can plug in, set the comm port for the Arduino, enter UserName and Password and, thereafter, it starts up automatically when the Arduino is plugged in – user2609437 Jul 24 '13 at 11:46
  • 1
    Making an installer? - Yes, I guess so... I just want to have something on a USB stick that she can plug in, use the form to set the comm port for the Arduino, enter email address, UserName and Password and, thereafter, it starts up automaticaly when the Arduino is plugged in, but without the form (though that needs to be accessible somehow in case the hardware configuration of the PC changes, due to other USB devices being added - I think?) Mail server? It is to work with a Gmail account and the code I found is at http://www.albertopasca.it/whiletrue/2011/03/arduino-mail-notifier-cs/ – user2609437 Jul 24 '13 at 11:56
  • @user2609437 correct url: http://www.albertopasca.it/whiletrue/arduino-mail-notifier-with-c/ – elp Sep 18 '18 at 16:14

2 Answers2

0

a) store the data and make it available to the main code,

write the data on a file! you have millions of possibilities, for isntance reading and writing a plain text file can be done with few lines of code, but if you want to encrypt your file (it may be the case if you want to store the password) you can use System.Security.Cryptography as shown in this guide

b) ensure that the form only runs at setup,

once you have written the file, then it means that the program has run already at least once, so you don't need to ask the user again (just read the data from the file)

c) exactly what I need to do or include to create an installable application.

Visual Studio already comes with the Setup project for this task. See this good guide.

Community
  • 1
  • 1
dariosalvi
  • 23
  • 7
0

From your comment and link to the code project for the Arduino, I gather that this is your first venture into writing code in C#, or very close to it. And ideally you'd like to make this as easy for your friend as possible. The best advice I can give you is not to try to run before you learn to walk. If you try to create a custom setup project and use a configuration file, which is what you are talking about doing, you may hit so many barriers that you never get to a successful end of the project. That kind of experience is discouraging and I'd hate for you to lose the drive to ever want to try another software project.

Make this initial project easy on yourself. This is not good programming practice for most situations, but if you only have one user, hard-code her configruation information for this first version. In other words, put her username, password, com port, etc directly into the main program. This eliminates the need for both the configuration, and any custom setup form. If you still want to make the whole thing configurable and versatile, do that in your next version. Custom setup is not a beginner task. It will be a lot easier to take on with the encouragement of your friend's excitement and compliments over a first version that works.

Mark Bailey
  • 1,091
  • 10
  • 25
  • Other tha making a form with buttons to turn Leds on the Arduino on and off, yes, it's still 'first steps in C#" – user2609437 Jul 24 '13 at 20:44
  • I'd love to hard code here information straight it but there's a cultural problem involved. Where she is, your 'secret' information is exactly that and you tell it to absolutely nobody. Also I can't get her comm port information until she has the Arduino part to plug in and see what it appears as, which means double shipping and, on a pension, that all adds up, plus things get lost in translation. I read the two links in the first replies and one made some sense (http://raquilla.com...) but that seems to use a pre-configured dialog box, but it's close. – user2609437 Jul 24 '13 at 20:57
  • If I could use the form instead of the dialogue box it would be ok. I'm still confused by the terminology though! – user2609437 Jul 24 '13 at 20:57