-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRecordingForm.cs
More file actions
118 lines (99 loc) · 3.8 KB
/
Copy pathRecordingForm.cs
File metadata and controls
118 lines (99 loc) · 3.8 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using WindowsFormsApp1.project;
using Sound_Recorder_Project.program;
using Sound_Recorder_Project.program.tools;
using Sound_Recorder_Project.Properties;
namespace Sound_Recorder_Project
{
public partial class RecordingForm : Form
{
private String RECORDING_ON = " (recording)";
private String RECORDING_OFF = " (not recording)";
public RecordingForm()
{
InitializeComponent();
CheckRecording();
LoadSettings();
}
private void CheckRecording()
{
if (SoundManager.Recording)
this.Text = this.Text + RECORDING_ON;
else
this.Text = this.Text + RECORDING_OFF;
}
private void LoadSettings()
{
outputFolderTB.Text = Settings.Default.recordsPath;
storageSpaceTB.Text = Settings.Default.memoryAllocation.ToString();
recordRateTB.Text = Settings.Default.waveRate.ToString();
recordTimeTB.Text = Settings.Default.recordingCycleTime.ToString();
runOnStartupCB.Checked = Settings.Default.runOnStartup;
}
private void SaveBtn_Click(object sender, EventArgs e)
{
SaveSettings();
MyUtils.RunOnStartup(runOnStartupCB.Checked);
System.Diagnostics.Process.Start(Application.ExecutablePath); // to start new instance of application
MyUtils.ExitProgram(); //to turn off current app
}
private void SaveSettings()
{
Settings.Default.Upgrade();
Settings.Default.recordsPath = outputFolderTB.Text;
Settings.Default.memoryAllocation = int.Parse(storageSpaceTB.Text);
Settings.Default.waveRate= int.Parse(recordRateTB.Text);
Settings.Default.recordingCycleTime = int.Parse(recordTimeTB.Text);
Settings.Default.runOnStartup = runOnStartupCB.Checked;
Settings.Default.Save();
}
private void outputFolderDialog_FileOk(object sender, CancelEventArgs e)
{
outputFolderTB.Text = TitleExporter(sender.ToString());
}
private string TitleExporter(string fileLongStr) { return fileLongStr.ToString().Substring(fileLongStr.ToString().IndexOf("FileName: ") + 10); }
private void OutputTBDropHandler(object sender, DragEventArgs e)
{
outputFolderTB.Text = ((string[])e.Data.GetData(DataFormats.FileDrop, false))[0];
}
private void DragEnterHandler(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
e.Effect = DragDropEffects.Copy;
else
e.Effect = DragDropEffects.None;
}
private void outputFolderBrowseBtn_Click(object sender, EventArgs e)
{
DialogResult result = outputFolderDialog.ShowDialog();
if (result == DialogResult.OK && outputFolderDialog.SelectedPath.Length > 0)
{
outputFolderTB.Text = outputFolderDialog.SelectedPath;
}
}
private void outputFolderDialog_HelpRequest(object sender, EventArgs e)
{
}
private void HistoryBtn_Click(object sender, EventArgs e)
{
new HistoryForm().ShowDialog();
}
private void Terminate_Click(object sender, EventArgs e)
{
MyUtils.ExitProgram();
}
private void logBtn_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
MessageBox.Show(Logger.GetTxt(), Logger.TITLE);
}
}
}