-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettingsForm.cs
53 lines (50 loc) · 1.64 KB
/
settingsForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace PingPongPower
{
public partial class settingsForm : Form
{
public settingsForm()
{
InitializeComponent();
}
private void settingsForm_Activated(object sender, EventArgs e)
{
try
{
smtpHost.Text = Properties.Settings.Default.smtpHost;
smtpPort.Text = Properties.Settings.Default.smtpPort.ToString();
mailDestination.Text = Properties.Settings.Default.mailDestination;
}
//catch (Exception ex)
catch
{
/* smtpHost.Text = "";
smtpPort.Text = "";
mailDestination.Text = "";
MessageBox.Show(ex.Message, "An exception occured");
*/
}
}
private void saveSettings_Click(object sender, EventArgs e)
{
try
{
Properties.Settings.Default.smtpHost = smtpHost.Text;
Properties.Settings.Default.smtpPort = int.Parse(smtpPort.Text);
Properties.Settings.Default.mailDestination = mailDestination.Text;
Properties.Settings.Default.Save();
}
catch (Exception ex)
{
MessageBox.Show(String.Format("{0}\r\n\r\n\r\nIs the port number correct?",ex.Message), "An Exception has occured");
}
}
}
}