-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathSettingsForm.cs
51 lines (47 loc) · 1.88 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
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 AutoCADIODemo
{
public partial class SettingsForm : Form
{
public SettingsForm()
{
InitializeComponent();
// Populate the settings form based on the values saved in the default settings.
drawingsFolderPathTextBox.Text = Properties.Settings.Default.DrawingsFolderPath;
AutoCADIOClientIDText.Text = Properties.Settings.Default.DesignAutoClientId;
AutoCADIOClientSecretText.Text = Properties.Settings.Default.DesignAutoClientSecret;
}
/// <summary>
/// On click of the save button, persist the changes made to the settings.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SaveBtn_Click(object sender, EventArgs e)
{
// Update the default settings based on the values specified by the user and save it.
Properties.Settings.Default.DesignAutoClientId = AutoCADIOClientIDText.Text;
Properties.Settings.Default.DesignAutoClientSecret = AutoCADIOClientSecretText.Text;
Properties.Settings.Default.DrawingsFolderPath = drawingsFolderPathTextBox.Text;
Properties.Settings.Default.Save();
}
/// <summary>
/// Displays the browse folder dialog to select the drawings folder path
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void BrowseFolderBtn_Click(object sender, EventArgs e)
{
if (DrawingsFolderBrowser.ShowDialog() == DialogResult.OK)
{
drawingsFolderPathTextBox.Text = DrawingsFolderBrowser.SelectedPath;
}
}
}
}