\r
namespace AudioRecorder\r
{\r
+ public delegate void RefreshPanelDelegate();\r
+\r
public partial class MainForm : Form, IMainForm\r
{\r
\r
private MMDevice currentDevice;\r
private bool pausing;\r
private float volumeHeight;\r
+ private RefreshPanelDelegate refreshPanel;\r
\r
public MainForm()\r
{\r
volumeHeight = height;\r
//volumePanel.Invalidate();\r
//volumePanel.Update();\r
+ if (volumePanel.InvokeRequired) {\r
+ refreshPanel = RefreshVolumePanel;\r
+ this.Invoke(refreshPanel);\r
+ } else {\r
+ volumePanel.Refresh();\r
+ }\r
+ }\r
+\r
+ private void RefreshVolumePanel() {\r
volumePanel.Refresh();\r
}\r
\r
this.currentFileName = currentFileName;\r
currentFilePath = String.Format("{0}\\{1}", path, currentFileName);\r
while (File.Exists(this.currentFilePath)) {\r
- this.currentFileName = File.Exists(filePath) ? currentFileName.Insert(currentFileName.IndexOf("."), String.Format("_{0}", i)) : currentFileName;\r
+ this.currentFileName = File.Exists(filePath) ? currentFileName.Insert(currentFileName.IndexOf("."), String.Format("-{0}", i)) : currentFileName;\r
currentFilePath = String.Format("{0}\\{1}", path, this.currentFileName);\r
i++;\r
}\r
{\r
Process process = new Process();\r
ProcessStartInfo startInfo = new ProcessStartInfo();\r
- startInfo.FileName = new FileInfo(currentFileName).FullName;\r
+ startInfo.FileName = new FileInfo(currentFilePath).FullName;\r
process.StartInfo = startInfo;\r
process.Start();\r
}\r
waveWriter.Write(e.Buffer, 0, e.BytesRecorded);\r
waveWriter.Flush();\r
try {\r
- float panelHeight = (device.AudioMeterInformation.MasterPeakValue + device.AudioSessionManager.SimpleAudioVolume.Volume) * 100;\r
- mainForm.setPanelSizeHeight(panelHeight);\r
+ //float panelHeight = device.AudioEndpointVolume.MasterVolumeLevelScalar * 100;//(device.AudioMeterInformation.MasterPeakValue + device.AudioSessionManager.SimpleAudioVolume.Volume) * 100;\r
+ //Debug.WriteLine(string.Format("panelHeight {0}", panelHeight) );\r
+ //mainForm.setPanelSizeHeight(panelHeight);\r
}\r
catch (Exception ex) {\r
Debug.WriteLine(ex.Message);\r