| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace crusherScanner
- {
- public partial class SettingsDialog : Form
- {
- public SettingsDialog()
- {
- InitializeComponent();
- }
- /// <summary>
- /// Save and Exit.
- /// </summary>
- private void button5_Click(object sender, EventArgs e)
- {
- Properties.Settings.Default.CrusherNo = (int)numericUpDown1.Value;
- Properties.Settings.Default.PrepmasterMagazineSerial = textBox1.Text;
- Properties.Settings.Default.OreDefInFile = textBox2.Text;
- Properties.Settings.Default.OreDefWorkFile = textBox3.Text;
- Properties.Settings.Default.OreDefOutFile = textBox4.Text;
- Properties.Settings.Default.OutputFormat = comboBox1.Text;
- Properties.Settings.Default.Save();
- Close();
- }
- private void SettingsDialog_Load(object sender, EventArgs e)
- {
- numericUpDown1.Value = Properties.Settings.Default.CrusherNo;
- textBox1.Text = Properties.Settings.Default.PrepmasterMagazineSerial;
- textBox2.Text = Properties.Settings.Default.OreDefInFile;
- textBox3.Text = Properties.Settings.Default.OreDefWorkFile;
- textBox4.Text = Properties.Settings.Default.OreDefOutFile;
- comboBox1.Text = Properties.Settings.Default.OutputFormat;
- }
- /// <summary>
- /// Discard and exit.
- /// </summary>
- private void button4_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// OreDef input file dir.
- /// </summary>
- private void button1_Click(object sender, EventArgs e)
- {
- string returnPath = FolderBrowser(textBox2.Text);
- if (returnPath != "")
- {
- textBox2.Text = returnPath;
- }
- }
- /// <summary>
- /// OreDef working file dir.
- /// </summary>
- private void button2_Click(object sender, EventArgs e)
- {
- string returnPath = FolderBrowser(textBox3.Text);
- if (returnPath != "")
- {
- textBox3.Text = returnPath;
- }
- }
- /// <summary>
- /// OreDef output file dir.
- /// </summary>
- private void button3_Click(object sender, EventArgs e)
- {
- string returnPath = FolderBrowser(textBox4.Text);
- if (returnPath != "")
- {
- textBox4.Text = returnPath;
- }
- }
- /// <summary>
- /// Dynamic folder dialog.
- /// </summary>
- private string FolderBrowser(string path)
- {
- folderBrowserDialog1.Reset();
- if (path != "")
- {
- //folderBrowserDialog1.InitialDirectory = path;
- folderBrowserDialog1.SelectedPath = path;
- }
- DialogResult result = folderBrowserDialog1.ShowDialog();
- if (result == DialogResult.OK)
- {
- return folderBrowserDialog1.SelectedPath;
- }
- else
- {
- return "";
- }
- }
- }
- }
|