-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainForm.cs
54 lines (45 loc) · 1.45 KB
/
MainForm.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
54
using System;
using System.Windows.Forms;
using Serilog;
namespace SyncFolders
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
private void InputButtonClick(object sender, EventArgs e)
{
inputTextBox.Text = SelectFolder();
}
private void OutputButtonClick(object sender, EventArgs e)
{
outputTextBox.Text = SelectFolder();
}
private string SelectFolder()
{
var result = folderBrowserDialog.ShowDialog();
return result == DialogResult.OK ? folderBrowserDialog.SelectedPath : string.Empty;
}
private void SyncButtonClick(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(inputTextBox.Text) || string.IsNullOrWhiteSpace(outputTextBox.Text))
return;
var dirWatcher = new SyncDir()
{
InputDir = inputTextBox.Text,
OutputDir = outputTextBox.Text
};
dirWatcher.WatchDirectory(realTimeCheckbox.Checked, Convert.ToInt64(numericInputTimer.Value));
}
private void RealTimeCheckboxCheckedChanged(object sender, EventArgs e)
{
numericInputTimer.Enabled = !numericInputTimer.Enabled;
}
private void CloseLogger(object sender, EventArgs e)
{
Log.CloseAndFlush();
}
}
}