/// </summary>\r
private void InitializeComponent() {\r
this.audioDevicesComboBox = new System.Windows.Forms.ComboBox();\r
- this.label1 = new System.Windows.Forms.Label();\r
this.groupBox1 = new System.Windows.Forms.GroupBox();\r
this.cancelButton = new System.Windows.Forms.Button();\r
this.okButton = new System.Windows.Forms.Button();\r
// \r
// audioDevicesComboBox\r
// \r
+ this.audioDevicesComboBox.BackColor = System.Drawing.Color.White;\r
this.audioDevicesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;\r
this.audioDevicesComboBox.FormattingEnabled = true;\r
- this.audioDevicesComboBox.Location = new System.Drawing.Point(9, 32);\r
+ this.audioDevicesComboBox.Location = new System.Drawing.Point(9, 27);\r
this.audioDevicesComboBox.Name = "audioDevicesComboBox";\r
- this.audioDevicesComboBox.Size = new System.Drawing.Size(359, 21);\r
+ this.audioDevicesComboBox.Size = new System.Drawing.Size(355, 21);\r
this.audioDevicesComboBox.TabIndex = 0;\r
// \r
- // label1\r
- // \r
- this.label1.AutoEllipsis = true;\r
- this.label1.AutoSize = true;\r
- this.label1.Location = new System.Drawing.Point(10, 7);\r
- this.label1.Name = "label1";\r
- this.label1.Size = new System.Drawing.Size(101, 13);\r
- this.label1.TabIndex = 2;\r
- this.label1.Text = "Select audio device";\r
- // \r
// groupBox1\r
// \r
- this.groupBox1.Controls.Add(this.label1);\r
this.groupBox1.Controls.Add(this.audioDevicesComboBox);\r
- this.groupBox1.Location = new System.Drawing.Point(2, 2);\r
+ this.groupBox1.Location = new System.Drawing.Point(4, 2);\r
this.groupBox1.Name = "groupBox1";\r
- this.groupBox1.Size = new System.Drawing.Size(376, 69);\r
+ this.groupBox1.Size = new System.Drawing.Size(372, 69);\r
this.groupBox1.TabIndex = 4;\r
this.groupBox1.TabStop = false;\r
// \r
// cancelButton\r
// \r
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;\r
- this.cancelButton.Location = new System.Drawing.Point(214, 91);\r
+ this.cancelButton.Location = new System.Drawing.Point(214, 85);\r
this.cancelButton.Name = "cancelButton";\r
this.cancelButton.Size = new System.Drawing.Size(75, 23);\r
this.cancelButton.TabIndex = 3;\r
// \r
// okButton\r
// \r
- this.okButton.Location = new System.Drawing.Point(295, 91);\r
+ this.okButton.Location = new System.Drawing.Point(295, 85);\r
this.okButton.Name = "okButton";\r
this.okButton.Size = new System.Drawing.Size(75, 23);\r
this.okButton.TabIndex = 1;\r
this.AcceptButton = this.okButton;\r
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r
+ this.BackColor = System.Drawing.Color.White;\r
this.CancelButton = this.cancelButton;\r
- this.ClientSize = new System.Drawing.Size(381, 127);\r
+ this.ClientSize = new System.Drawing.Size(381, 118);\r
this.ControlBox = false;\r
this.Controls.Add(this.okButton);\r
this.Controls.Add(this.groupBox1);\r
this.Controls.Add(this.cancelButton);\r
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;\r
this.Name = "AudioDeviceSelectorForm";\r
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;\r
this.Text = "AudioRecorder input device selector";\r
+ this.TopMost = true;\r
this.groupBox1.ResumeLayout(false);\r
- this.groupBox1.PerformLayout();\r
this.ResumeLayout(false);\r
\r
}\r
#endregion\r
\r
private System.Windows.Forms.ComboBox audioDevicesComboBox;\r
- private System.Windows.Forms.Label label1;\r
private System.Windows.Forms.GroupBox groupBox1;\r
private System.Windows.Forms.Button cancelButton;\r
private System.Windows.Forms.Button okButton;\r
using System;\r
using System.Collections.Generic;\r
-using NAudio.CoreAudioApi;\r
using System.Windows.Forms;\r
\r
namespace AudioRecorder {\r
- public partial class AudioDeviceSelectorForm : Form, IAudioDeviceSelectorForm {\r
+ public partial class AudioDeviceSelectorForm : Form {\r
\r
- private IAudioDevicesDetector devicesDetector;\r
- private List<String> deviceNames = new List<String>();\r
- private IMainForm mainForm;\r
- private bool deviceConnected;\r
+ private List<String> deviceNames;\r
+ private AudioRecorderSettings parameters;\r
\r
- public AudioDeviceSelectorForm(IMainForm mainForm) {\r
+ public AudioDeviceSelectorForm() {\r
InitializeComponent();\r
InitializeControlTexts();\r
- StartPosition = FormStartPosition.CenterParent;\r
- devicesDetector = new AudioDevicesDetector();\r
- this.mainForm = mainForm;\r
+\r
audioDevicesComboBox.KeyDown += (sender, args) => {\r
if (args.KeyCode == Keys.Return)\r
- okButton.PerformClick();\r
+ Close();\r
};\r
audioDevicesComboBox.KeyDown += (sender, args) => {\r
if (args.KeyCode == Keys.Escape)\r
- {\r
- Dispose();\r
- }\r
+ Close();\r
};\r
- findDevicesAnd();\r
}\r
\r
- private void InitializeControlTexts()\r
- {\r
+ private void InitializeControlTexts() {\r
cancelButton.Text = Resources.MEGSE;\r
- label1.Text = Resources.VALASSZON_MIKROFONT;\r
- this.Text = Resources.MIKROFON_VALASZTAS;\r
- }\r
-\r
- public AudioDeviceSelectorForm(IMainForm mainForm, IAudioDevicesDetector devicesDetector) {\r
- InitializeComponent();\r
- this.devicesDetector = devicesDetector;\r
- this.mainForm = mainForm;\r
- findDevicesAnd();\r
+ this.Text = Resources.VALASSZON_MIKROFONT;\r
}\r
\r
- private void findDevicesAnd() {\r
- devicesDetector.findDevices();\r
- deviceNames = devicesDetector.getDeviceNames();\r
- foreach (String actual in deviceNames)\r
- audioDevicesComboBox.Items.Add(actual);\r
- if (deviceNames.Count > 0) {\r
+ public int Open(List<string> deviceNames, int selectedIndex, ref AudioRecorderSettings parameters) {\r
+ this.deviceNames = deviceNames;\r
+ audioDevicesComboBox.DataSource = deviceNames;\r
+ \r
+ if (selectedIndex < deviceNames.Count - 1 && selectedIndex > -1)\r
+ audioDevicesComboBox.SelectedIndex = selectedIndex;\r
+ if (selectedIndex == -1 && deviceNames.Count > 0)\r
audioDevicesComboBox.SelectedIndex = 0;\r
- okButton.Enabled = true;\r
- deviceConnected = true;\r
- } else {\r
- DialogResult result = MessageBox.Show(StringResources.CONNECT_AUDIO_DEVICE, StringResources.ERROR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);\r
- deviceConnected = false;\r
- mainForm.disableRecordButton();\r
- Dispose();\r
- }\r
+ this.parameters = parameters;\r
+ if (ShowDialog() == DialogResult.OK)\r
+ return audioDevicesComboBox.SelectedIndex;\r
+ else\r
+ return selectedIndex;\r
}\r
\r
private void okButton_Click(object sender, EventArgs e) {\r
- int index = audioDevicesComboBox.SelectedIndex;\r
- String value = deviceNames[index];\r
- mainForm.initWavRecorder(index, value);\r
- Dispose();\r
- }\r
-\r
- public List<String> getDeviceNames() {\r
- return deviceNames;\r
+ DialogResult = DialogResult.OK;\r
+ parameters.audio_device_name = deviceNames[audioDevicesComboBox.SelectedIndex];\r
+ Close();\r
}\r
\r
- public bool isDeviceConnected() {\r
- return deviceConnected;\r
+ private void cancelButton_Click(object sender, EventArgs e) {\r
+ DialogResult = DialogResult.Cancel;\r
+ Close();\r
}\r
\r
- public bool isDisposed() {\r
- return IsDisposed;\r
- }\r
-\r
- public List<MMDevice> getDevices() {\r
- return devicesDetector.getDevices();\r
- }\r
-\r
- private void cancelButton_Click(object sender, EventArgs e)\r
- {\r
- Dispose();\r
- }\r
}\r
}\r
<Compile Include="AudioDeviceSelectorForm.Designer.cs">\r
<DependentUpon>AudioDeviceSelectorForm.cs</DependentUpon>\r
</Compile>\r
+ <Compile Include="AudioRecorderSettings.cs" />\r
<Compile Include="CustomTrackBar.cs">\r
<SubType>UserControl</SubType>\r
</Compile>\r
<DependentUpon>FileNameForm.cs</DependentUpon>\r
</Compile>\r
<Compile Include="FileWorker.cs" />\r
- <Compile Include="IAudioDeviceSelectorForm.cs" />\r
<Compile Include="IFileWorker.cs" />\r
<Compile Include="IMainForm.cs" />\r
- <Compile Include="ISettings.cs" />\r
- <Compile Include="JsonSettings.cs" />\r
<Compile Include="KnownTypesBinder.cs" />\r
<Compile Include="MainForm.cs">\r
<SubType>Form</SubType>\r
<Compile Include="IRecorder.cs" />\r
<Compile Include="ITimeCodeWorker.cs" />\r
<Compile Include="Pause.cs" />\r
+ <Compile Include="PeakMeterCtrl.cs">\r
+ <SubType>Component</SubType>\r
+ </Compile>\r
+ <Compile Include="PeakMeterCtrl.Designer.cs">\r
+ <DependentUpon>PeakMeterCtrl.cs</DependentUpon>\r
+ </Compile>\r
<Compile Include="Program.cs" />\r
<Compile Include="Properties\AssemblyInfo.cs" />\r
<Compile Include="Resources.Designer.cs">\r
<DesignTimeSharedInput>True</DesignTimeSharedInput>\r
</Compile>\r
<None Include="Configuration\audiorecorder.json">\r
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\r
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>\r
</None>\r
</ItemGroup>\r
<ItemGroup>\r
</ItemGroup>\r
<ItemGroup>\r
<Content Include="maestro.ico" />\r
+ <None Include="Resources\ic_refresh_black_24dp_1x.png" />\r
<Content Include="Resources\pause.png" />\r
<Content Include="Resources\record.png" />\r
<Content Include="Resources\stop.png" />\r
--- /dev/null
+using System;\r
+using Newtonsoft.Json;\r
+using System.IO;\r
+using System.Windows.Forms;\r
+\r
+namespace AudioRecorder {\r
+ public class AudioRecorderSettings {\r
+ public String audio_device_name { get; set; }\r
+ public String unc_path { get; set; }\r
+ public int loud_percent { get; set; }\r
+ public String working_dir { get; set; }\r
+\r
+ public Uri address { get; set; }\r
+ public String userName { get; set; }\r
+ public String password { get; set; }\r
+ public int timeout { get; set; }\r
+\r
+\r
+ public void Save(string fileName) {\r
+ try {\r
+ File.WriteAllText(fileName, JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented));\r
+ }\r
+ catch (Exception e) {\r
+ MessageBox.Show(e.Message);\r
+ }\r
+ }\r
+ }\r
+}\r
{\r
"audio_device_name": "",\r
- "unc_path": "I:\\",\r
"working_dir": "C:\\temp",\r
- "loud_percent": 30,\r
+ "loud_percent": 200,\r
+ "target" : {\r
+ "label": "Octopus mappába küldés",\r
+ "processor": "FTPTargetProcessor",\r
+ "tag": "Betöltés",\r
+ "outputFormat": "%ID%",\r
+ "subFolderFormat": "%IDROOT%-%TEXT%",\r
+ "killDateDays": 7,\r
+ "saveArchiveMetadata": false,\r
+ "remote": {\r
+ "address": "ftp://10.10.1.100/OCTOPUS",\r
+ "userName": "mediacube",\r
+ "password": "Dn8t4gfHcK98o8hyPgLDhr5SgSji4JCxsfpMJsODikUp3nXgrM0UNCi45lLAK8ZOnmEneO44P9qpJ4QDqhctN6MxZodjJgdZTyoZKmSa+ECzEzLr/wPYNgxVaXrVotEy",\r
+ "timeout": 1000\r
+ }\r
+ },\r
"address": "http://10.10.1.27/services/rest/octopus/",\r
"userName": "dani",\r
"password": "dani",\r
/// </summary>\r
private void InitializeComponent()\r
{\r
- this.trackBar1 = new System.Windows.Forms.TrackBar();\r
this.tickLabel = new System.Windows.Forms.Label();\r
+ this.trackBar1 = new System.Windows.Forms.TrackBar();\r
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();\r
this.SuspendLayout();\r
// \r
- // trackBar1\r
- // \r
- this.trackBar1.Location = new System.Drawing.Point(0, 0);\r
- this.trackBar1.Name = "trackBar1";\r
- this.trackBar1.Orientation = System.Windows.Forms.Orientation.Vertical;\r
- this.trackBar1.Size = new System.Drawing.Size(45, 214);\r
- this.trackBar1.TabIndex = 0;\r
- this.trackBar1.TickFrequency = 0;\r
- this.trackBar1.ValueChanged += new System.EventHandler(this.trackBar1_ValueChanged);\r
- // \r
// tickLabel\r
// \r
this.tickLabel.AutoSize = true;\r
this.tickLabel.TabIndex = 1;\r
this.tickLabel.Text = "_";\r
// \r
+ // trackBar1\r
+ // \r
+ this.trackBar1.Location = new System.Drawing.Point(0, 0);\r
+ this.trackBar1.Name = "trackBar1";\r
+ this.trackBar1.Orientation = System.Windows.Forms.Orientation.Vertical;\r
+ this.trackBar1.Size = new System.Drawing.Size(45, 214);\r
+ this.trackBar1.TabIndex = 0;\r
+ this.trackBar1.TickFrequency = 0;\r
+ this.trackBar1.ValueChanged += new System.EventHandler(this.trackBar1_ValueChanged);\r
+ // \r
// CustomTrackBar\r
// \r
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r
\r
#endregion\r
\r
- private System.Windows.Forms.TrackBar trackBar1;\r
private System.Windows.Forms.Label tickLabel;\r
+ private System.Windows.Forms.TrackBar trackBar1;\r
}\r
}\r
\r
namespace AudioRecorder {\r
public partial class FileNameForm : Form {\r
-\r
private String result;\r
- private IMainForm mainForm;\r
- private ISettings settings;\r
+ private MainForm mainForm;\r
private String id;\r
\r
- public FileNameForm(IMainForm mainForm, ISettings settings) {\r
+ public FileNameForm(MainForm mainForm, AudioRecorderSettings settings) {\r
InitializeComponent();\r
- this.settings = settings;\r
this.mainForm = mainForm;\r
octopusIDSelector1.IDChangedEvent = IdChangedEvent;\r
octopusIDSelector1.Parameters = new OctopusParameters() {\r
UserName = "Hangalámondó",\r
Configuration = new OctopusMetadata() {\r
Server = new Connection() {\r
- Address = settings.getAddress(),\r
- Password = settings.getPassword(),\r
- UserName = settings.getUserName(),\r
- Timeout = settings.getTimeout()\r
+ Address = settings.address,\r
+ Password = settings.password,\r
+ UserName = settings.userName,\r
+ Timeout = settings.timeout\r
}\r
}\r
};\r
using System;\r
using System.Collections.Generic;\r
-using System.Text;\r
using System.IO;\r
\r
namespace AudioRecorder {\r
+++ /dev/null
-using System;\r
-using System.Collections.Generic;\r
-using NAudio.CoreAudioApi;\r
-using System.Windows.Forms;\r
-namespace AudioRecorder {\r
- public interface IAudioDeviceSelectorForm {\r
- DialogResult ShowDialog();\r
- List<String> getDeviceNames();\r
- bool isDeviceConnected();\r
- bool isDisposed();\r
- List<MMDevice> getDevices();\r
- }\r
-}\r
+++ /dev/null
-using System;\r
-\r
-namespace AudioRecorder {\r
- public interface ISettings {\r
- String getAudioDeviceName();\r
- String getUncPath();\r
- int getLoudValue();\r
- String getWorkingDir();\r
- Uri getAddress();\r
- String getUserName();\r
- String getPassword();\r
- int getTimeout();\r
- void addSelectedAudio(String value, String fileName);\r
- }\r
-}\r
+++ /dev/null
-using System;\r
-using System.Collections.Generic;\r
-using Newtonsoft.Json;\r
-using System.IO;\r
-namespace AudioRecorder\r
-{\r
- public class JsonSettings : ISettings\r
- {\r
- public String audio_device_name { get; set; }\r
- public String unc_path { get; set; }\r
- public int loud_percent { get; set; }\r
- public String working_dir { get; set; }\r
-\r
- public Uri address;\r
- public String userName;\r
- public String password;\r
- public int timeout;\r
-\r
- private JsonSettings()\r
- {\r
-\r
- }\r
-\r
- public static JsonSettings GetInstance(string configFileName)\r
- {\r
- string configuration = File.ReadAllText(configFileName);\r
- KnownTypesBinder knownTypesBinder = new KnownTypesBinder\r
- {\r
- KnownTypes = new List<Type> { typeof(String), typeof(String), typeof(String), typeof(int), }\r
- };\r
- JsonSerializerSettings settings = new JsonSerializerSettings\r
- {\r
- TypeNameHandling = TypeNameHandling.Objects,\r
- SerializationBinder = knownTypesBinder,\r
- };\r
-\r
- return JsonConvert.DeserializeObject<JsonSettings>(configuration, settings);\r
- }\r
-\r
- //public void addSelectedAudio(String value, String fileName) { }\r
- public String getAudioDeviceName()\r
- {\r
- return audio_device_name;\r
- }\r
- public String getUncPath()\r
- {\r
- return unc_path;\r
- }\r
-\r
- public int getLoudValue()\r
- {\r
- return loud_percent;\r
- }\r
-\r
- public String getWorkingDir()\r
- {\r
- return working_dir;\r
- }\r
-\r
- Uri ISettings.getAddress()\r
- {\r
- return address;\r
- }\r
-\r
- string ISettings.getUserName()\r
- {\r
- return userName;\r
- }\r
-\r
- string ISettings.getPassword()\r
- {\r
- return password;\r
- }\r
-\r
- int ISettings.getTimeout()\r
- {\r
- return timeout;\r
- }\r
-\r
- public void addSelectedAudio(string value, string fileName)\r
- {\r
- try\r
- {\r
- string json = File.ReadAllText(fileName);\r
- dynamic jsonObj = JsonConvert.DeserializeObject(json);\r
- jsonObj["audio_device_name"] = value;\r
- string output = Newtonsoft.Json.JsonConvert.SerializeObject(jsonObj, Newtonsoft.Json.Formatting.Indented);\r
- File.Delete(fileName);\r
- File.WriteAllText(fileName, output);\r
- }\r
- catch (Exception e) { }\r
- }\r
- }\r
-}\r
this.recordButton = new System.Windows.Forms.Button();\r
this.stopButton = new System.Windows.Forms.Button();\r
this.timecodeLabel = new System.Windows.Forms.Label();\r
- this.selectAudioButton = new System.Windows.Forms.Button();\r
+ this.btnSelectAudio = new System.Windows.Forms.Button();\r
this.groupBox1 = new System.Windows.Forms.GroupBox();\r
- this.groupBox4 = new System.Windows.Forms.GroupBox();\r
this.pauseButton = new System.Windows.Forms.Button();\r
this.groupBox2 = new System.Windows.Forms.GroupBox();\r
- this.verticalProgressBar1 = new AudioRecorder.VerticalProgressBar();\r
- this.customTrackBar1 = new AudioRecorder.CustomTrackBar();\r
+ this.pmVolume = new Ernzo.WinForms.Controls.PeakMeterCtrl();\r
this.fileNameLabel = new System.Windows.Forms.Label();\r
this.playButton = new System.Windows.Forms.Button();\r
this.groupBox3 = new System.Windows.Forms.GroupBox();\r
+ this.tbVolume = new System.Windows.Forms.TrackBar();\r
this.groupBox1.SuspendLayout();\r
- this.groupBox4.SuspendLayout();\r
this.groupBox2.SuspendLayout();\r
this.groupBox3.SuspendLayout();\r
+ ((System.ComponentModel.ISupportInitialize)(this.tbVolume)).BeginInit();\r
this.SuspendLayout();\r
// \r
// recordButton\r
// \r
+ this.recordButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\r
this.recordButton.BackColor = System.Drawing.Color.White;\r
this.recordButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;\r
this.recordButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
this.recordButton.Image = ((System.Drawing.Image)(resources.GetObject("recordButton.Image")));\r
- this.recordButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;\r
- this.recordButton.Location = new System.Drawing.Point(15, 14);\r
+ this.recordButton.Location = new System.Drawing.Point(51, 85);\r
this.recordButton.Name = "recordButton";\r
- this.recordButton.Size = new System.Drawing.Size(181, 56);\r
+ this.recordButton.Size = new System.Drawing.Size(129, 56);\r
this.recordButton.TabIndex = 0;\r
this.recordButton.Text = "Record";\r
this.recordButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;\r
this.recordButton.UseVisualStyleBackColor = false;\r
- this.recordButton.Click += new System.EventHandler(this.record_Click);\r
+ this.recordButton.Click += new System.EventHandler(this.OnRecordClick);\r
// \r
// stopButton\r
// \r
+ this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\r
this.stopButton.BackColor = System.Drawing.Color.White;\r
this.stopButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;\r
this.stopButton.Enabled = false;\r
this.stopButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
this.stopButton.Image = ((System.Drawing.Image)(resources.GetObject("stopButton.Image")));\r
- this.stopButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;\r
- this.stopButton.Location = new System.Drawing.Point(15, 115);\r
+ this.stopButton.Location = new System.Drawing.Point(51, 186);\r
this.stopButton.Name = "stopButton";\r
- this.stopButton.Size = new System.Drawing.Size(181, 38);\r
+ this.stopButton.Size = new System.Drawing.Size(129, 38);\r
this.stopButton.TabIndex = 1;\r
this.stopButton.Text = "Stop ";\r
this.stopButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;\r
// \r
// timecodeLabel\r
// \r
- this.timecodeLabel.AutoSize = true;\r
+ this.timecodeLabel.Dock = System.Windows.Forms.DockStyle.Top;\r
this.timecodeLabel.Font = new System.Drawing.Font("Calibri", 28F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- this.timecodeLabel.Location = new System.Drawing.Point(9, 15);\r
+ this.timecodeLabel.Location = new System.Drawing.Point(3, 16);\r
this.timecodeLabel.Name = "timecodeLabel";\r
- this.timecodeLabel.Size = new System.Drawing.Size(202, 46);\r
+ this.timecodeLabel.Size = new System.Drawing.Size(241, 46);\r
this.timecodeLabel.TabIndex = 2;\r
this.timecodeLabel.Text = "00:00:00:00";\r
+ this.timecodeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;\r
// \r
- // selectAudioButton\r
+ // btnSelectAudio\r
// \r
- this.selectAudioButton.BackColor = System.Drawing.Color.White;\r
- this.selectAudioButton.Location = new System.Drawing.Point(8, 19);\r
- this.selectAudioButton.Name = "selectAudioButton";\r
- this.selectAudioButton.Size = new System.Drawing.Size(307, 23);\r
- this.selectAudioButton.TabIndex = 3;\r
- this.selectAudioButton.Text = "Select audio";\r
- this.selectAudioButton.UseVisualStyleBackColor = false;\r
- this.selectAudioButton.Click += new System.EventHandler(this.selectAudioButton_Click);\r
+ this.btnSelectAudio.BackColor = System.Drawing.Color.White;\r
+ this.btnSelectAudio.Location = new System.Drawing.Point(8, 19);\r
+ this.btnSelectAudio.Name = "btnSelectAudio";\r
+ this.btnSelectAudio.Size = new System.Drawing.Size(307, 23);\r
+ this.btnSelectAudio.TabIndex = 3;\r
+ this.btnSelectAudio.Text = "Select audio";\r
+ this.btnSelectAudio.UseVisualStyleBackColor = false;\r
+ this.btnSelectAudio.Click += new System.EventHandler(this.selectAudioButton_Click);\r
// \r
// groupBox1\r
// \r
- this.groupBox1.Controls.Add(this.groupBox4);\r
+ this.groupBox1.Controls.Add(this.pauseButton);\r
+ this.groupBox1.Controls.Add(this.recordButton);\r
+ this.groupBox1.Controls.Add(this.stopButton);\r
this.groupBox1.Controls.Add(this.timecodeLabel);\r
this.groupBox1.Location = new System.Drawing.Point(15, 12);\r
this.groupBox1.Name = "groupBox1";\r
- this.groupBox1.Size = new System.Drawing.Size(228, 240);\r
+ this.groupBox1.Size = new System.Drawing.Size(247, 240);\r
this.groupBox1.TabIndex = 5;\r
this.groupBox1.TabStop = false;\r
// \r
- // groupBox4\r
- // \r
- this.groupBox4.Controls.Add(this.pauseButton);\r
- this.groupBox4.Controls.Add(this.recordButton);\r
- this.groupBox4.Controls.Add(this.stopButton);\r
- this.groupBox4.Location = new System.Drawing.Point(8, 62);\r
- this.groupBox4.Name = "groupBox4";\r
- this.groupBox4.Size = new System.Drawing.Size(214, 163);\r
- this.groupBox4.TabIndex = 11;\r
- this.groupBox4.TabStop = false;\r
- // \r
// pauseButton\r
// \r
+ this.pauseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\r
this.pauseButton.BackColor = System.Drawing.Color.White;\r
this.pauseButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;\r
this.pauseButton.Enabled = false;\r
this.pauseButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold);\r
this.pauseButton.Image = ((System.Drawing.Image)(resources.GetObject("pauseButton.Image")));\r
- this.pauseButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;\r
- this.pauseButton.Location = new System.Drawing.Point(15, 77);\r
+ this.pauseButton.Location = new System.Drawing.Point(51, 148);\r
this.pauseButton.Name = "pauseButton";\r
- this.pauseButton.Size = new System.Drawing.Size(181, 32);\r
+ this.pauseButton.Size = new System.Drawing.Size(129, 32);\r
this.pauseButton.TabIndex = 3;\r
this.pauseButton.Text = "Pause ";\r
this.pauseButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;\r
// \r
// groupBox2\r
// \r
- this.groupBox2.Controls.Add(this.verticalProgressBar1);\r
- this.groupBox2.Controls.Add(this.customTrackBar1);\r
- this.groupBox2.Location = new System.Drawing.Point(262, 12);\r
+ this.groupBox2.Controls.Add(this.tbVolume);\r
+ this.groupBox2.Controls.Add(this.pmVolume);\r
+ this.groupBox2.Location = new System.Drawing.Point(272, 12);\r
this.groupBox2.Name = "groupBox2";\r
- this.groupBox2.Size = new System.Drawing.Size(85, 240);\r
+ this.groupBox2.Size = new System.Drawing.Size(75, 240);\r
this.groupBox2.TabIndex = 6;\r
this.groupBox2.TabStop = false;\r
// \r
- // verticalProgressBar1\r
- // \r
- this.verticalProgressBar1.BackColor = System.Drawing.Color.White;\r
- this.verticalProgressBar1.ForeColor = System.Drawing.Color.White;\r
- this.verticalProgressBar1.Location = new System.Drawing.Point(18, 19);\r
- this.verticalProgressBar1.Name = "verticalProgressBar1";\r
- this.verticalProgressBar1.Size = new System.Drawing.Size(15, 203);\r
- this.verticalProgressBar1.Step = 1;\r
- this.verticalProgressBar1.TabIndex = 12;\r
- // \r
- // customTrackBar1\r
- // \r
- this.customTrackBar1.Location = new System.Drawing.Point(39, 15);\r
- this.customTrackBar1.MainForm = null;\r
- this.customTrackBar1.Name = "customTrackBar1";\r
- this.customTrackBar1.Size = new System.Drawing.Size(40, 213);\r
- this.customTrackBar1.TabIndex = 11;\r
+ // pmVolume\r
+ // \r
+ this.pmVolume.BandsCount = 1;\r
+ this.pmVolume.ColorHigh = System.Drawing.Color.Red;\r
+ this.pmVolume.ColorHighBack = System.Drawing.Color.White;\r
+ this.pmVolume.ColorMedium = System.Drawing.Color.Yellow;\r
+ this.pmVolume.ColorMediumBack = System.Drawing.Color.White;\r
+ this.pmVolume.ColorNormal = System.Drawing.Color.Green;\r
+ this.pmVolume.ColorNormalBack = System.Drawing.Color.White;\r
+ this.pmVolume.FalloffColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))));\r
+ this.pmVolume.GridColor = System.Drawing.Color.Gainsboro;\r
+ this.pmVolume.LEDCount = 17;\r
+ this.pmVolume.Location = new System.Drawing.Point(6, 19);\r
+ this.pmVolume.Name = "pmVolume";\r
+ this.pmVolume.Size = new System.Drawing.Size(15, 207);\r
+ this.pmVolume.TabIndex = 12;\r
+ this.pmVolume.Text = "pmVolume";\r
// \r
// fileNameLabel\r
// \r
this.playButton.Text = "Play";\r
this.playButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;\r
this.playButton.UseVisualStyleBackColor = false;\r
- this.playButton.Click += new System.EventHandler(this.playButton_Click);\r
+ this.playButton.Click += new System.EventHandler(this.OnPlayClick);\r
// \r
// groupBox3\r
// \r
- this.groupBox3.Controls.Add(this.selectAudioButton);\r
+ this.groupBox3.Controls.Add(this.btnSelectAudio);\r
this.groupBox3.Controls.Add(this.playButton);\r
this.groupBox3.Controls.Add(this.fileNameLabel);\r
this.groupBox3.Location = new System.Drawing.Point(15, 258);\r
this.groupBox3.TabIndex = 10;\r
this.groupBox3.TabStop = false;\r
// \r
+ // tbVolume\r
+ // \r
+ this.tbVolume.LargeChange = 10;\r
+ this.tbVolume.Location = new System.Drawing.Point(27, 16);\r
+ this.tbVolume.Maximum = 100;\r
+ this.tbVolume.Name = "tbVolume";\r
+ this.tbVolume.Orientation = System.Windows.Forms.Orientation.Vertical;\r
+ this.tbVolume.Size = new System.Drawing.Size(45, 220);\r
+ this.tbVolume.SmallChange = 2;\r
+ this.tbVolume.TabIndex = 13;\r
+ this.tbVolume.TickFrequency = 10;\r
+ this.tbVolume.TickStyle = System.Windows.Forms.TickStyle.Both;\r
+ this.tbVolume.ValueChanged += new System.EventHandler(this.OnVolumeChanged);\r
+ // \r
// MainForm\r
// \r
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;\r
this.Text = "AudioRecorder";\r
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);\r
- this.Load += new System.EventHandler(this.Form1_Load);\r
+ this.Shown += new System.EventHandler(this.OnMainShown);\r
this.groupBox1.ResumeLayout(false);\r
- this.groupBox1.PerformLayout();\r
- this.groupBox4.ResumeLayout(false);\r
this.groupBox2.ResumeLayout(false);\r
+ this.groupBox2.PerformLayout();\r
this.groupBox3.ResumeLayout(false);\r
+ ((System.ComponentModel.ISupportInitialize)(this.tbVolume)).EndInit();\r
this.ResumeLayout(false);\r
\r
}\r
private System.Windows.Forms.Button recordButton;\r
private System.Windows.Forms.Button stopButton;\r
private System.Windows.Forms.Label timecodeLabel;\r
- private System.Windows.Forms.Button selectAudioButton;\r
+ private System.Windows.Forms.Button btnSelectAudio;\r
private System.Windows.Forms.GroupBox groupBox1;\r
private System.Windows.Forms.GroupBox groupBox2;\r
private System.Windows.Forms.Label fileNameLabel;\r
private System.Windows.Forms.Button playButton;\r
private System.Windows.Forms.Button pauseButton;\r
private System.Windows.Forms.GroupBox groupBox3;\r
- private System.Windows.Forms.GroupBox groupBox4;\r
- private CustomTrackBar customTrackBar1;\r
- private VerticalProgressBar verticalProgressBar1;\r
+ private Ernzo.WinForms.Controls.PeakMeterCtrl pmVolume;\r
+ private System.Windows.Forms.TrackBar tbVolume;\r
}\r
}\r
\r
using NAudio.CoreAudioApi;\r
using System.Windows.Forms;\r
using System.IO;\r
+using MaestroShared.Configuration;\r
+using System.ComponentModel;\r
\r
namespace AudioRecorder {\r
public delegate void RefreshPanelDelegate();\r
\r
- public partial class MainForm : Form, IMainForm {\r
+ public partial class MainForm : Form {\r
\r
- //private const String CONFIG_FILE = "Resources/configuration.json";\r
private const String CONFIG_FILE = "Configuration/audiorecorder.json";\r
\r
- private IRecorder recorder;\r
- private ISettings settings;\r
+ private IAudioDevicesDetector devicesDetector;\r
+ private List<string> audioDevicesNames;\r
+ private int selectedDeviceIndex = -1;\r
+ private WavRecorder recorder;\r
+ private AudioRecorderSettings parameters;\r
private ITimeCodeWorker timeCodeWorker;\r
- private IAudioDeviceSelectorForm selectorForm;\r
private IFileWorker fileWorker;\r
- private String selectedAudioName;\r
private String currentFileName;\r
private String currentFilePath;\r
private bool recording;\r
- private System.Windows.Forms.Timer countDownTimer;\r
+ private Timer countDownTimer;\r
private int countDown = 3;\r
private MMDevice currentDevice;\r
private bool pausing;\r
- private float volumeHeight;\r
- private RefreshPanelDelegate refreshPanel;\r
+ private BackgroundWorker volumeMonitor;\r
\r
public MainForm() {\r
InitializeComponent();\r
InitializeControlTexts();\r
- customTrackBar1.MainForm = this;\r
+ }\r
+\r
+ public int SelectedDeviceIndex {\r
+ get => selectedDeviceIndex;\r
+ set {\r
+ selectedDeviceIndex = value;\r
+ if (selectedDeviceIndex > -1)\r
+ CurrentDevice = devicesDetector.getDevices()[SelectedDeviceIndex];\r
+ else\r
+ CurrentDevice = null;\r
+ }\r
+ }\r
+\r
+ public MMDevice CurrentDevice {\r
+ get => currentDevice;\r
+ set {\r
+ if (currentDevice == value)\r
+ return;\r
+ Cleanup();\r
+ currentDevice = value;\r
+ if (currentDevice != null)\r
+ Initialize();\r
+ UpdateGUI();\r
+ }\r
+ }\r
+\r
+ private void Cleanup() {\r
+ if (CurrentDevice != null)\r
+ CurrentDevice.AudioEndpointVolume.OnVolumeNotification -= AudioEndpointVolume_OnVolumeNotification;\r
+ if (recorder != null)\r
+ recorder = null;\r
+ }\r
+\r
+ private void OnMainShown(object sender, EventArgs e) {\r
+\r
try {\r
- settings = JsonSettings.GetInstance(CONFIG_FILE);\r
+ parameters = Loader.Get<AudioRecorderSettings>(CONFIG_FILE);\r
+ UpdateGUI();\r
+\r
fileWorker = new FileWorker();\r
- countDownTimer = new System.Windows.Forms.Timer();\r
+ timeCodeWorker = new TimeCodeWorker(timecodeLabel);\r
+ countDownTimer = new Timer();\r
countDownTimer.Interval = 1000;\r
countDownTimer.Tick += new EventHandler(timer_Tick);\r
- selectorForm = new AudioDeviceSelectorForm(this);\r
- if (selectorForm.isDeviceConnected())\r
- saveAudioDeviceToConfig();\r
- timeCodeWorker = new TimeCodeWorker(timecodeLabel);\r
- //CreatenewThreadToListenMasterPeekVolume();\r
- \r
+ devicesDetector = new AudioDevicesDetector();\r
+ devicesDetector.findDevices();\r
+ audioDevicesNames = devicesDetector.getDeviceNames();\r
+ if (!String.IsNullOrEmpty(parameters.audio_device_name) && audioDevicesNames != null)\r
+ SelectedDeviceIndex = audioDevicesNames.IndexOf(parameters.audio_device_name);\r
+ if (SelectedDeviceIndex < 0)\r
+ ShowAudioDeviceSelectorForm();\r
}\r
- catch (Exception e) {\r
- MessageBox.Show(e.Message, StringResources.ERROR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+ catch (Exception ex) {\r
+ MessageBox.Show(ex.Message, StringResources.ERROR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);\r
}\r
}\r
\r
- //private void CreatenewThreadToListenMasterPeekVolume() {\r
- // new Thread(() => {\r
- // while (true) {\r
- // try {\r
- // int panelHeight = (int)Math.Round(currentDevice.AudioMeterInformation.MasterPeakValue * 100);\r
- // Debug.WriteLine(String.Format("panelHeight {0}", panelHeight));\r
- // // int panelHeight = (int)Math.Floor(currentDevice.AudioMeterInformation.MasterPeakValue * 79);\r
- // setPanelSizeHeight(panelHeight);\r
- // Thread.Sleep(1);\r
- // }\r
- // catch (Exception e) {\r
- // Console.WriteLine(e.Message);\r
- // }\r
- // }\r
- // }).Start();\r
- //}\r
+ private void OnMonitorVolume(object sender, DoWorkEventArgs e) {\r
+ while (!e.Cancel) {\r
+ try {\r
+ float value = currentDevice.AudioMeterInformation.MasterPeakValue * 1000;\r
+ int[] levels = { (int) Math.Floor(value) };\r
+ Debug.WriteLine(String.Format($"Values {levels[0]}"));\r
+ pmVolume.SetData(levels, 0, 1);\r
+ System.Threading.Thread.Sleep(100);\r
+ } catch (Exception ex) {\r
+ Debug.WriteLine(ex.Message);\r
+ }\r
+ }\r
+ }\r
+\r
+ private void UpdateGUI() {\r
+ if (CurrentDevice == null) {\r
+ int steps = parameters.loud_percent;\r
+ pmVolume.SetRange(steps * 3, steps * 4, steps * 5);\r
+ pmVolume.SetData(new int[] { 0 }, 0, 1);\r
+ recordButton.Enabled = false;\r
+ recordButton.BackColor = SystemColors.Control;\r
+ if (volumeMonitor != null)\r
+ volumeMonitor.CancelAsync();\r
+ } else {\r
+ tbVolume.Minimum = (int)Math.Floor(CurrentDevice.AudioEndpointVolume.VolumeRange.MinDecibels);\r
+ tbVolume.Maximum = (int)Math.Floor(CurrentDevice.AudioEndpointVolume.VolumeRange.MaxDecibels);\r
+ tbVolume.Value = (int)Math.Round(CurrentDevice.AudioEndpointVolume.MasterVolumeLevel);\r
+ Debug.WriteLine($"Levels {CurrentDevice.AudioEndpointVolume.VolumeRange.MinDecibels} {CurrentDevice.AudioEndpointVolume.VolumeRange.MaxDecibels} V {CurrentDevice.AudioEndpointVolume.MasterVolumeLevel}");\r
+ recordButton.Enabled = true;\r
+ recordButton.BackColor = Color.Lime;\r
+ btnSelectAudio.Text = parameters.audio_device_name;\r
+ volumeMonitor = new BackgroundWorker();\r
+ volumeMonitor.WorkerSupportsCancellation = true;\r
+ volumeMonitor.DoWork += OnMonitorVolume;\r
+ volumeMonitor.RunWorkerAsync();\r
+ }\r
+ }\r
\r
private void InitializeControlTexts() {\r
recordButton.Text = Resources.FELVETEL;\r
stopButton.Text = Resources.LEALLITAS;\r
pauseButton.Text = Resources.SZUNET;\r
- selectAudioButton.Text = Resources.VALASSZON_MIKROFONT;\r
+ btnSelectAudio.Text = Resources.VALASSZON_MIKROFONT;\r
playButton.Text = Resources.LEJATSZAS;\r
}\r
\r
- private void setVolumeTrackerEdgesAndValue() {\r
- if (currentDevice != null) {\r
- customTrackBar1.setMinimumMaximumSizesAndVolume((int)currentDevice.AudioEndpointVolume.VolumeRange.MinDecibels,\r
- (int)currentDevice.AudioEndpointVolume.VolumeRange.MaxDecibels,\r
- (int)currentDevice.AudioEndpointVolume.MasterVolumeLevel);\r
- }\r
- }\r
-\r
- private void saveAudioDeviceToConfig() {\r
- if (String.IsNullOrEmpty(settings.getAudioDeviceName()))\r
- recordButton.Enabled = false;\r
- else {\r
- List<String> devices = selectorForm.getDeviceNames();\r
- int indexOfDeviceName = devices.IndexOf(settings.getAudioDeviceName());\r
- if (indexOfDeviceName == -1)\r
- showAudioDeviceSelectorForm();\r
- else\r
- initWavRecorder(indexOfDeviceName, settings.getAudioDeviceName());\r
- }\r
- }\r
-\r
- public void initWavRecorder(int index, String selectedAudioName) {\r
- int inputDeviceIndex = index;\r
- this.selectedAudioName = selectedAudioName;\r
- currentDevice = selectorForm.getDevices()[index];\r
+ public void Initialize() {\r
currentDevice.AudioEndpointVolume.OnVolumeNotification += AudioEndpointVolume_OnVolumeNotification;\r
- recorder = new WavRecorder(inputDeviceIndex, currentDevice, this);\r
- recordButton.Enabled = true;\r
- recordButton.BackColor = Color.Lime;\r
- selectAudioButton.Text = selectedAudioName;\r
- settings.addSelectedAudio(selectedAudioName, CONFIG_FILE);\r
- setVolumeTrackerEdgesAndValue();\r
- customTrackBar1.setTickLabelLocationByPercentage(settings.getLoudValue());\r
+ recorder = new WavRecorder(SelectedDeviceIndex, CurrentDevice, this);\r
}\r
\r
void AudioEndpointVolume_OnVolumeNotification(AudioVolumeNotificationData data) {\r
- customTrackBar1.SetValue((int)currentDevice.AudioEndpointVolume.MasterVolumeLevel);\r
+ //customTrackBar1.SetValue((int)CurrentDevice.AudioEndpointVolume.MasterVolumeLevel);\r
}\r
\r
- public void setPanelSizeHeight(float height) {\r
- volumeHeight = height;\r
- if (verticalProgressBar1.InvokeRequired) {\r
- refreshPanel = RefreshVolumePanel;\r
- this.Invoke(refreshPanel);\r
- } else\r
- RefreshVolumePanel();\r
- }\r
\r
- private void RefreshVolumePanel() {\r
- try {\r
- if (recording) {\r
- if (volumeHeight >= settings.getLoudValue())\r
- //SendMessage(verticalProgressBar1.Handle, 1040, 2, 0);\r
- verticalProgressBar1.ForeColor = Color.Red;\r
- else\r
- // SendMessage(verticalProgressBar1.Handle, 1040, 1, 0);\r
- verticalProgressBar1.ForeColor = Color.Green;\r
- verticalProgressBar1.Value = (int)volumeHeight;\r
- }\r
- } catch (Exception e) {\r
- Console.WriteLine(e.Message);\r
- }\r
- }\r
-\r
- private void Form1_Load(object sender, EventArgs e) {\r
+ //private void RefreshVolumePanel() {\r
+ // try {\r
+ // if (recording) {\r
+ // if (volumeHeight >= parameters.loud_percent)\r
+ // //SendMessage(verticalProgressBar1.Handle, 1040, 2, 0);\r
+ // verticalProgressBar1.ForeColor = Color.Red;\r
+ // else\r
+ // // SendMessage(verticalProgressBar1.Handle, 1040, 1, 0);\r
+ // verticalProgressBar1.ForeColor = Color.Green;\r
+ // verticalProgressBar1.Value = (int)volumeHeight;\r
+ // }\r
+ // } catch (Exception e) {\r
+ // Console.WriteLine(e.Message);\r
+ // }\r
+ //}\r
\r
- }\r
\r
private void stop_Click(object sender, EventArgs e) {\r
stopRecording();\r
}\r
\r
+\r
+ private void startRecord() {\r
+ try {\r
+ recording = true;\r
+ currentFilePath = Path.Combine(parameters.working_dir, "1.wav");\r
+ recorder.StartRecording(currentFilePath);\r
+ timeCodeWorker.Start();\r
+ pauseButton.Enabled = true;\r
+ recordButton.Enabled = false;\r
+ stopButton.Enabled = true;\r
+ btnSelectAudio.Enabled = false;\r
+ playButton.Enabled = false;\r
+ stopButton.BackColor = Color.Red;\r
+ recordButton.BackColor = Color.White;\r
+ }\r
+ catch (Exception e) {\r
+ MessageBox.Show(e.Message, StringResources.ERROR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+ }\r
+ }\r
+\r
+\r
private void stopRecording() {\r
try {\r
recording = false;\r
recordButton.Enabled = true;\r
stopButton.Enabled = false;\r
- selectAudioButton.Enabled = true;\r
+ btnSelectAudio.Enabled = true;\r
pauseButton.Enabled = false;\r
- verticalProgressBar1.Value = 0;\r
+\r
recorder.StopRecording();\r
timeCodeWorker.Stop();\r
playButton.Enabled = true;\r
stopButton.BackColor = Color.White;\r
recordButton.BackColor = Color.Lime;\r
- copyFileToUncPath();\r
+ //copyFileToUncPath();\r
}\r
catch (Exception e) {\r
MessageBox.Show(e.Message, StringResources.ERROR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);\r
private void copyFileToUncPath() {\r
FileInfo fileInfo = new FileInfo(recorder.getCurentWavFilePath());\r
String wavFileName = fileInfo.Name;\r
- String wavUncPath = DetermineWorkingDirectory(settings.getUncPath(), fileInfo.Name);\r
+ String wavUncPath = DetermineWorkingDirectory(parameters.unc_path, fileInfo.Name);\r
if (!Directory.Exists(wavUncPath))\r
Directory.CreateDirectory(wavUncPath);\r
wavUncPath = Path.Combine(wavUncPath, fileInfo.Name);\r
return result;\r
}\r
\r
- private void record_Click(object sender, EventArgs e) {\r
- FileNameForm nameForm = new FileNameForm(this, settings);\r
- nameForm.ShowDialog();\r
- }\r
+ private void OnRecordClick(object sender, EventArgs e) {\r
+ //FileNameForm nameForm = new FileNameForm(this, parameters);\r
+ //nameForm.ShowDialog();\r
\r
- private void startRecord() {\r
- try {\r
- recording = true;\r
- recorder.StartRecording(currentFilePath);\r
- timeCodeWorker.Start();\r
- pauseButton.Enabled = true;\r
- recordButton.Enabled = false;\r
- stopButton.Enabled = true;\r
- selectAudioButton.Enabled = false;\r
- playButton.Enabled = false;\r
- stopButton.BackColor = Color.Red;\r
- recordButton.BackColor = Color.White;\r
- }\r
- catch (Exception e) {\r
- MessageBox.Show(e.Message, StringResources.ERROR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);\r
- }\r
+ startRecord();\r
}\r
\r
public void recordFireEvent(String currentFileName, string id) {\r
recordButton.Enabled = false;\r
- String path = String.Format("{0}\\{1}", settings.getWorkingDir(), id);\r
+ String path = String.Format("{0}\\{1}", parameters.working_dir, id);\r
if (!Directory.Exists(path))\r
Directory.CreateDirectory(path);\r
SetCurrentFileNameAndPath(currentFileName, path);\r
\r
private void setToolTipToFileNameLabel(String filePath) {\r
ToolTip toolTip = new ToolTip();\r
- String uncPath = String.Format("{0}{1}{2}", settings.getUncPath(), Path.DirectorySeparatorChar, currentFileName);\r
+ String uncPath = String.Format("{0}{1}{2}", parameters.unc_path, Path.DirectorySeparatorChar, currentFileName);\r
String tip = String.Format("{0}\n{1}", filePath, uncPath);\r
toolTip.SetToolTip(fileNameLabel, tip);\r
}\r
\r
private void selectAudioButton_Click(object sender, EventArgs e) {\r
- showAudioDeviceSelectorForm();\r
+ ShowAudioDeviceSelectorForm(true);\r
}\r
\r
- private void showAudioDeviceSelectorForm() {\r
- selectorForm = new AudioDeviceSelectorForm(this);\r
- if (!selectorForm.isDisposed())\r
- selectorForm.ShowDialog();\r
+ private void ShowAudioDeviceSelectorForm(bool refreshDevices = false) {\r
+ if (refreshDevices) {\r
+ devicesDetector = new AudioDevicesDetector();\r
+ devicesDetector.findDevices();\r
+ audioDevicesNames = devicesDetector.getDeviceNames();\r
+ }\r
+ AudioDeviceSelectorForm deviceSelectorForm = new AudioDeviceSelectorForm();\r
+ SelectedDeviceIndex = deviceSelectorForm.Open(audioDevicesNames, SelectedDeviceIndex, ref parameters);\r
+ if (SelectedDeviceIndex > -1)\r
+ parameters.Save(CONFIG_FILE);\r
}\r
\r
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) {\r
- if (recording) {\r
- DialogResult result = MessageBox.Show(StringResources.ARE_YOU_SURE_TO_QUIT_DURING_RECORDING,\r
- StringResources.EXIT_TITLE, MessageBoxButtons.YesNo);\r
- if (result == DialogResult.Yes) {\r
- stopRecording();\r
- deleteTemporariFiles();\r
- } else\r
- e.Cancel = true;\r
- } else {\r
- if (String.IsNullOrEmpty(settings.getAudioDeviceName()))\r
- settings.addSelectedAudio(selectedAudioName, CONFIG_FILE);\r
+ if (recording)\r
+ e.Cancel = true;\r
+ else\r
deleteTemporariFiles();\r
- }\r
}\r
\r
private void deleteTemporariFiles() {\r
- if (recorder != null) {\r
- List<String> createdFiles = recorder.getCreatedFiles();\r
- fileWorker.deleteFiles(createdFiles);\r
- }\r
+ //if (recorder != null) {\r
+ // List<String> createdFiles = recorder.getCreatedFiles();\r
+ // fileWorker.deleteFiles(createdFiles);\r
+ //}\r
}\r
\r
- public void disableRecordButton() {\r
- recordButton.Enabled = false;\r
- }\r
-\r
- private void playButton_Click(object sender, EventArgs e) {\r
+ private void OnPlayClick(object sender, EventArgs e) {\r
Process process = new Process();\r
ProcessStartInfo startInfo = new ProcessStartInfo();\r
startInfo.FileName = new FileInfo(currentFilePath).FullName;\r
TrackBar trackbar = sender as TrackBar;\r
if (trackbar == null)\r
return;\r
- if (currentDevice == null)\r
+ if (CurrentDevice == null)\r
return;\r
int value = trackbar.Value;\r
- currentDevice.AudioEndpointVolume.MasterVolumeLevel = value;\r
+ CurrentDevice.AudioEndpointVolume.MasterVolumeLevel = value;\r
}\r
\r
private void pauseButton_Click(object sender, EventArgs e) {\r
TrackBar trackbar = sender as TrackBar;\r
if (trackbar == null)\r
return;\r
- if (currentDevice == null)\r
+ if (CurrentDevice == null)\r
return;\r
int value = trackbar.Value;\r
- currentDevice.AudioEndpointVolume.MasterVolumeLevel = value;\r
+ CurrentDevice.AudioEndpointVolume.MasterVolumeLevel = value;\r
+ }\r
+\r
+ private void OnVolumeChanged(object sender, EventArgs e) {\r
+ CurrentDevice.AudioEndpointVolume.MasterVolumeLevel = tbVolume.Value;\r
+ Debug.WriteLine($"Levels {CurrentDevice.AudioEndpointVolume.VolumeRange.MinDecibels} {CurrentDevice.AudioEndpointVolume.VolumeRange.MaxDecibels} V {CurrentDevice.AudioEndpointVolume.MasterVolumeLevel}");\r
}\r
}\r
}\r
--- /dev/null
+using System;\r
+namespace Ernzo.WinForms.Controls\r
+{\r
+ partial class PeakMeterCtrl\r
+ {\r
+ /// <summary>\r
+ /// Required designer variable.\r
+ /// </summary>\r
+ private System.ComponentModel.IContainer components = null;\r
+\r
+ /// <summary>\r
+ /// Clean up any resources being used.\r
+ /// </summary>\r
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>\r
+ protected override void Dispose(bool disposing)\r
+ {\r
+ StopAnimation();\r
+ if (disposing && (components != null))\r
+ {\r
+ components.Dispose();\r
+ }\r
+ base.Dispose(disposing);\r
+ }\r
+\r
+ #region Component Designer generated code\r
+\r
+ /// <summary>\r
+ /// Required method for Designer support - do not modify \r
+ /// the contents of this method with the code editor.\r
+ /// </summary>\r
+ private void InitializeComponent()\r
+ {\r
+ components = new System.ComponentModel.Container();\r
+ }\r
+\r
+ #endregion\r
+\r
+ }\r
+}\r
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////\r
+// Copyright (c) 2008 Ernest Laurentin (elaurentin@netzero.net)\r
+//\r
+// This software is provided 'as-is', without any express or implied\r
+// warranty. In no event will the authors be held liable for any damages\r
+// arising from the use of this software.\r
+//\r
+// Permission is granted to anyone to use this software for any purpose,\r
+// including commercial applications, and to alter it and redistribute it\r
+// freely, subject to the following restrictions:\r
+//\r
+// 1. The origin of this software must not be misrepresented; you must not\r
+// claim that you wrote the original software. If you use this software\r
+// in a product, an acknowledgment in the product documentation would be\r
+// appreciated but is not required.\r
+//\r
+// 2. Altered source versions must be plainly marked as such, and must not be\r
+// misrepresented as being the original software.\r
+//\r
+// 3. This notice may not be removed or altered from any source distribution.\r
+///////////////////////////////////////////////////////////////////////////////\r
+using System;\r
+using System.ComponentModel;\r
+using System.Drawing;\r
+using System.Windows.Forms;\r
+using System.Threading;\r
+\r
+namespace Ernzo.WinForms.Controls\r
+{\r
+ public enum PeakMeterStyle\r
+ {\r
+ PMS_Horizontal = 0,\r
+ PMS_Vertical = 1\r
+ }\r
+\r
+ internal struct PeakMeterData\r
+ {\r
+ public int Value;\r
+ public int Falloff;\r
+ public int Speed;\r
+ }\r
+\r
+ [ToolboxBitmap(typeof(MyResourceNamespace), "PeakMeterCtrl.pmicon.bmp")]\r
+ public partial class PeakMeterCtrl : Control\r
+ {\r
+ private const byte DarkenByDefault = 40;\r
+ private const byte LightenByDefault = 150;\r
+ private const int MinRangeDefault = 60;\r
+ private const int MedRangeDefault = 80;\r
+ private const int MaxRangeDefault = 100;\r
+ private const int FalloffFast = 1;\r
+ private const int FalloffNormal = 10;\r
+ private const int FalloffSlow = 100;\r
+ private const int FalloffDefault = 10;\r
+ private const int DecrementPercent = 10;\r
+ private const int BandsMin = 1;\r
+ private const int BandsMax = 1000;\r
+ private const int BandsDefault = 8;\r
+ private const int LEDMin = 1;\r
+ private const int LEDMax = 1000;\r
+ private const int LEDDefault = 8;\r
+ private const int cxyMargin = 1;\r
+\r
+ private int _AnimDelay;\r
+ private int _MinRangeValue;\r
+ private int _MedRangeValue;\r
+ private int _MaxRangeValue;\r
+ private PeakMeterData[] _meterData;\r
+ private System.Threading.Timer _animationTimer;\r
+ public PeakMeterCtrl()\r
+ {\r
+ InitializeComponent();\r
+ InitDefault();\r
+ this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);\r
+ this.SetStyle(ControlStyles.UserPaint, true);\r
+ //this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);\r
+ }\r
+\r
+ private void InitDefault()\r
+ {\r
+ _AnimDelay = Timeout.Infinite;\r
+ _MinRangeValue = MinRangeDefault; // [0,60[\r
+ _MedRangeValue = MedRangeDefault; // [60,80[\r
+ _MaxRangeValue = MaxRangeDefault; // [80,100[\r
+ _meterData = null;\r
+ _animationTimer = null;\r
+ _ShowGrid = true;\r
+ _ColoredGrid = false;\r
+ _GridColor = Color.Gainsboro;\r
+ _ColorNormal = Color.Green;\r
+ _ColorMedium = Color.Yellow;\r
+ _ColorHigh = Color.Red;\r
+ _ColorNormalBack = LightenColor(_ColorNormal, LightenByDefault);\r
+ _ColorMediumBack = LightenColor(_ColorMedium, LightenByDefault);\r
+ _ColorHighBack = LightenColor(_ColorHigh, LightenByDefault);\r
+ _BandsCount = BandsDefault;\r
+ _LEDCount = LEDDefault;\r
+ _FalloffSpeed = FalloffNormal;\r
+ _FalloffEffect = true;\r
+ _FalloffColor = DarkenColor(_GridColor, DarkenByDefault);\r
+ ResetControl();\r
+ }\r
+\r
+ #region Control properties\r
+ private PeakMeterStyle _PmsMeterStyle;\r
+ [Category("Appearance"), DefaultValue(PeakMeterStyle.PMS_Horizontal)]\r
+ public PeakMeterStyle MeterStyle\r
+ {\r
+ get { return _PmsMeterStyle; }\r
+ set { _PmsMeterStyle = value; Refresh(); }\r
+ }\r
+\r
+ private bool _ShowGrid;\r
+ [Category("Appearance"), DefaultValue(true)]\r
+ public bool ShowGrid\r
+ {\r
+ get { return _ShowGrid; }\r
+ set { _ShowGrid = value; Refresh(); }\r
+ }\r
+\r
+ private bool _ColoredGrid;\r
+ [Category("Appearance"), DefaultValue(false)]\r
+ public bool ColoredGrid\r
+ {\r
+ get { return _ColoredGrid; }\r
+ set { _ColoredGrid = value; Refresh(); }\r
+ }\r
+\r
+ private Color _GridColor;\r
+ [Category("Appearance")]\r
+ public Color GridColor\r
+ {\r
+ get { return _GridColor; }\r
+ set { _GridColor = value; Refresh(); }\r
+ }\r
+\r
+ private Color _ColorNormal;\r
+ [Category("Appearance")]\r
+ public Color ColorNormal\r
+ {\r
+ get { return _ColorNormal; }\r
+ set { _ColorNormal = value; Refresh(); }\r
+ }\r
+\r
+ private Color _ColorMedium;\r
+ [Category("Appearance")]\r
+ public Color ColorMedium\r
+ {\r
+ get { return _ColorMedium; }\r
+ set { _ColorMedium = value; Refresh(); }\r
+ }\r
+\r
+ private Color _ColorHigh;\r
+ [Category("Appearance")]\r
+ public Color ColorHigh\r
+ {\r
+ get { return _ColorHigh; }\r
+ set { _ColorHigh = value; Refresh(); }\r
+ }\r
+\r
+ private Color _ColorNormalBack;\r
+ [Category("Appearance")]\r
+ public Color ColorNormalBack\r
+ {\r
+ get { return _ColorNormalBack; }\r
+ set { _ColorNormalBack = value; Refresh(); }\r
+ }\r
+\r
+ private Color _ColorMediumBack;\r
+ [Category("Appearance")]\r
+ public Color ColorMediumBack\r
+ {\r
+ get { return _ColorMediumBack; }\r
+ set { _ColorMediumBack = value; Refresh(); }\r
+ }\r
+\r
+ private Color _ColorHighBack;\r
+ [Category("Appearance")]\r
+ public Color ColorHighBack\r
+ {\r
+ get { return _ColorHighBack; }\r
+ set { _ColorHighBack = value; Refresh(); }\r
+ }\r
+\r
+ private int _BandsCount;\r
+ [Category("Appearance"), DefaultValue(BandsDefault)]\r
+ public int BandsCount\r
+ {\r
+ get { return _BandsCount; }\r
+ set {\r
+ if (value >= BandsMin && value <= BandsMax)\r
+ {\r
+ _BandsCount = value;\r
+ ResetControl();\r
+ Refresh();\r
+ }\r
+ }\r
+ }\r
+\r
+ private int _LEDCount;\r
+ [Category("Appearance"), DefaultValue(LEDDefault)]\r
+ public int LEDCount\r
+ {\r
+ get { return _LEDCount; }\r
+ set {\r
+ if (value >= LEDMin && value <= LEDMax)\r
+ {\r
+ _LEDCount = value;\r
+ Refresh();\r
+ }\r
+ }\r
+ }\r
+\r
+ private int _FalloffSpeed;\r
+ [Category("Falloff Effect"), DefaultValue(FalloffDefault)]\r
+ public int FalloffSpeed\r
+ {\r
+ get { return _FalloffSpeed; }\r
+ set { _FalloffSpeed = value; }\r
+ }\r
+\r
+ private bool _FalloffEffect;\r
+ [Category("Falloff Effect"), DefaultValue(true)]\r
+ public bool FalloffEffect\r
+ {\r
+ get { return _FalloffEffect; }\r
+ set { _FalloffEffect = value; }\r
+ }\r
+\r
+ private Color _FalloffColor;\r
+ [Category("Falloff Effect")]\r
+ public Color FalloffColor\r
+ {\r
+ get { return _FalloffColor; }\r
+ set { _FalloffColor = value; }\r
+ }\r
+ \r
+ #endregion\r
+\r
+ [Browsable(false)]\r
+ public bool IsActive\r
+ {\r
+ get { return (_animationTimer != null); }\r
+ }\r
+\r
+ #region Control Methods\r
+\r
+ // support for thread-safe version\r
+ private delegate bool StartDelegate(int delay);\r
+ /// <summary>\r
+ /// Start animation\r
+ /// </summary>\r
+ /// <param name="delay"></param>\r
+ /// <returns></returns>\r
+ public bool Start(int delay)\r
+ {\r
+ if (this.InvokeRequired)\r
+ {\r
+ StartDelegate startDelegate = new StartDelegate(this.Start);\r
+ return (bool)this.Invoke(startDelegate, delay);\r
+ }\r
+ _AnimDelay = delay;\r
+ return StartAnimation(delay);\r
+ }\r
+\r
+ // support for thread-safe version\r
+ private delegate bool StopDelegate();\r
+ /// <summary>\r
+ /// Stop Animation\r
+ /// </summary>\r
+ /// <returns></returns>\r
+ public bool Stop()\r
+ {\r
+ if (this.InvokeRequired)\r
+ {\r
+ StopDelegate stopDelegate = new StopDelegate(this.Stop);\r
+ return (bool)this.Invoke(stopDelegate);\r
+ }\r
+ _AnimDelay = Timeout.Infinite;\r
+ return StopAnimation();\r
+ }\r
+\r
+ /// <summary>\r
+ /// Set number of LED bands\r
+ /// </summary>\r
+ /// <param name="BandsCount">Number of bands</param>\r
+ /// <param name="LEDCount">Number of LED per bands</param>\r
+ public void SetMeterBands(int BandsCount, int LEDCount)\r
+ {\r
+ if (BandsCount < BandsMin || BandsCount > BandsMax)\r
+ throw new ArgumentOutOfRangeException("BandsCount");\r
+ if (LEDCount < LEDMin || LEDCount > LEDMax)\r
+ throw new ArgumentOutOfRangeException("LEDCount");\r
+ _BandsCount = BandsCount;\r
+ _LEDCount = LEDCount;\r
+ ResetControl();\r
+ Refresh();\r
+ }\r
+\r
+ /// <summary>\r
+ /// Set range info\r
+ /// </summary>\r
+ /// <param name="minRangeVal">Min Range</param>\r
+ /// <param name="medRangeVal">Medium Range</param>\r
+ /// <param name="maxRangeVal">High Range</param>\r
+ public void SetRange(int minRangeVal, int medRangeVal, int maxRangeVal)\r
+ {\r
+ if (maxRangeVal <= medRangeVal || medRangeVal < minRangeVal )\r
+ throw new ArgumentOutOfRangeException("minRangeVal");\r
+ _MinRangeValue = minRangeVal;\r
+ _MedRangeValue = medRangeVal;\r
+ _MaxRangeValue = maxRangeVal;\r
+ ResetControl();\r
+ Refresh();\r
+ }\r
+\r
+ // support for thread-safe version\r
+ private delegate bool SetDataDelegate(int[] arrayValue, int offset, int size);\r
+ /// <summary>\r
+ /// Set meter band value\r
+ /// </summary>\r
+ /// <param name="arrayValue">Array value for the bands</param>\r
+ /// <param name="offset">Starting offset position</param>\r
+ /// <param name="size">Number of values to set</param>\r
+ /// <returns></returns>\r
+ public bool SetData(int[] arrayValue, int offset, int size)\r
+ {\r
+ if (arrayValue == null)\r
+ throw new ArgumentNullException("arrayValue");\r
+ if (arrayValue.Length < (offset + size))\r
+ throw new ArgumentOutOfRangeException("arrayValue");\r
+\r
+ if (this.InvokeRequired)\r
+ {\r
+ SetDataDelegate setDelegate = new SetDataDelegate(this.SetData);\r
+ return (bool)this.Invoke(setDelegate, arrayValue, offset, size);\r
+ }\r
+ bool isRunning = this.IsActive;\r
+\r
+ Monitor.Enter(this._meterData);\r
+\r
+ int maxIndex = offset + size;\r
+ for (int i = offset; i < maxIndex; i++)\r
+ {\r
+ if (i < this._meterData.Length)\r
+ {\r
+ PeakMeterData pm = this._meterData[i];\r
+ pm.Value = Math.Min(arrayValue[i], this._MaxRangeValue);\r
+ pm.Value = Math.Max(pm.Value, 0);\r
+ if (pm.Falloff < pm.Value)\r
+ {\r
+ pm.Falloff = pm.Value;\r
+ pm.Speed = this._FalloffSpeed;\r
+ }\r
+ this._meterData[i] = pm;\r
+ }\r
+ }\r
+ Monitor.Exit(this._meterData);\r
+ \r
+ // check that timer should be restarted\r
+ if (_AnimDelay != Timeout.Infinite)\r
+ {\r
+ if (_animationTimer == null)\r
+ {\r
+ StartAnimation(_AnimDelay);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ Refresh();\r
+ }\r
+\r
+ return isRunning;\r
+ }\r
+ #endregion\r
+\r
+ /// <summary>\r
+ /// Make a color darker\r
+ /// </summary>\r
+ /// <param name="color">Color to darken</param>\r
+ /// <param name="darkenBy">Value to decrease by</param>\r
+ protected virtual Color DarkenColor(Color color, byte darkenBy)\r
+ {\r
+ byte red = (byte)(color.R > darkenBy ? (color.R - darkenBy) : 0);\r
+ byte green = (byte)(color.G > darkenBy ? (color.G - darkenBy) : 0);\r
+ byte blue = (byte)(color.B > darkenBy ? (color.B - darkenBy) : 0);\r
+ return Color.FromArgb(red, green, blue);\r
+ }\r
+ /// <summary>\r
+ /// Make a color lighter\r
+ /// </summary>\r
+ /// <param name="color"></param>\r
+ /// <param name="lightenBy"></param>\r
+ /// <returns></returns>\r
+ protected virtual Color LightenColor(Color color, byte lightenBy)\r
+ {\r
+ byte red = (byte)((color.R + lightenBy) <= 255 ? (color.R + lightenBy) : 255);\r
+ byte green = (byte)((color.G + lightenBy) <= 255 ? (color.G + lightenBy) : 255);\r
+ byte blue = (byte)((color.B + lightenBy) <= 255 ? (color.B + lightenBy) : 255);\r
+ return Color.FromArgb(red, green, blue);\r
+ }\r
+\r
+ protected static bool InRange(int value, int rangeMin, int rangeMax)\r
+ {\r
+ return (value >= rangeMin && value <= rangeMax);\r
+ }\r
+ \r
+ protected void ResetControl()\r
+ {\r
+ _meterData = new PeakMeterData[_BandsCount];\r
+ PeakMeterData pm;\r
+ pm.Value = _MaxRangeValue;\r
+ pm.Falloff = _MaxRangeValue;\r
+ pm.Speed = _FalloffSpeed;\r
+ for (int i = 0; i < _meterData.Length; i++)\r
+ {\r
+ _meterData[i] = pm;\r
+ }\r
+ }\r
+ protected bool StartAnimation(int period)\r
+ {\r
+ if ( !IsActive )\r
+ {\r
+ TimerCallback timerDelegate = \r
+ new TimerCallback(TimerCallback);\r
+ _animationTimer = new System.Threading.Timer(timerDelegate, this, Timeout.Infinite, Timeout.Infinite);\r
+ }\r
+ return _animationTimer.Change(period, period);\r
+ }\r
+ protected bool StopAnimation()\r
+ {\r
+ bool result = false;\r
+ if ( IsActive )\r
+ {\r
+ try\r
+ {\r
+ result = _animationTimer.Change(Timeout.Infinite, Timeout.Infinite);\r
+ _animationTimer.Dispose();\r
+ _animationTimer = null;\r
+ result = true;\r
+ }\r
+ catch (Exception)\r
+ {\r
+ }\r
+ }\r
+ return result;\r
+ }\r
+\r
+ protected override void OnHandleDestroyed(EventArgs e)\r
+ {\r
+ Stop();\r
+ base.OnHandleDestroyed(e);\r
+ }\r
+ protected override void OnBackColorChanged(EventArgs e)\r
+ {\r
+ Refresh();\r
+ }\r
+ protected override void OnPaint(PaintEventArgs e)\r
+ {\r
+ // Calling the base class OnPaint\r
+ base.OnPaint(e);\r
+\r
+ Graphics g = e.Graphics;\r
+ Rectangle rect = new Rectangle(0, 0, this.Width, this.Height);\r
+ Brush backColorBrush = new SolidBrush(this.BackColor);\r
+\r
+ g.FillRectangle(backColorBrush, rect);\r
+ //rect.Inflate(-this.Margin.Left, -this.Margin.Top);\r
+ if (MeterStyle == PeakMeterStyle.PMS_Horizontal)\r
+ {\r
+ DrawHorzBand(g, rect);\r
+ }\r
+ else\r
+ {\r
+ DrawVertBand(g, rect);\r
+ }\r
+ }\r
+\r
+ protected void TimerCallback(Object thisObject)\r
+ {\r
+ try\r
+ {\r
+ // refresh now!\r
+ Control thisControl = thisObject as Control;\r
+ if (thisControl != null && thisControl.IsHandleCreated)\r
+ {\r
+ thisControl.Invoke(new MethodInvoker(Refresh));\r
+ }\r
+ else\r
+ {\r
+ return;\r
+ }\r
+ }\r
+ catch (Exception)\r
+ {\r
+ // just ignore\r
+ }\r
+\r
+ int nDecValue = _MaxRangeValue / _LEDCount;\r
+ bool noUpdate = true;\r
+\r
+ Monitor.Enter(this._meterData);\r
+ for (int i = 0; i < _meterData.Length; i++)\r
+ {\r
+ PeakMeterData pm = _meterData[i];\r
+\r
+ if (pm.Value > 0)\r
+ {\r
+ pm.Value -= (_LEDCount > 1 ? nDecValue : (_MaxRangeValue * DecrementPercent) / 100);\r
+ if (pm.Value < 0)\r
+ pm.Value = 0;\r
+ noUpdate = false;\r
+ }\r
+\r
+ if (pm.Speed > 0)\r
+ {\r
+ pm.Speed -= 1;\r
+ noUpdate = false;\r
+ }\r
+\r
+ if (pm.Speed == 0 && pm.Falloff > 0)\r
+ {\r
+ pm.Falloff -= (_LEDCount > 1 ? nDecValue >> 1 : 5);\r
+ if (pm.Falloff < 0)\r
+ pm.Falloff = 0;\r
+ noUpdate = false;\r
+ }\r
+\r
+ // re-assign PeakMeterData\r
+ _meterData[i] = pm;\r
+ }\r
+ Monitor.Exit(this._meterData);\r
+\r
+ if (noUpdate) // Stop timer if no more data but do not reset ID\r
+ {\r
+ StopAnimation();\r
+ }\r
+ }\r
+ protected void DrawHorzBand(Graphics g, Rectangle rect)\r
+ {\r
+ int nMaxRange = (_MedRangeValue == 0) ? Math.Abs(_MaxRangeValue - _MinRangeValue) : _MaxRangeValue;\r
+ int nVertBands = (_LEDCount > 1 ? _LEDCount : (nMaxRange * DecrementPercent) / 100);\r
+ int nMinVertLimit = _MinRangeValue * nVertBands / nMaxRange;\r
+ int nMedVertLimit = _MedRangeValue * nVertBands / nMaxRange;\r
+ int nMaxVertLimit = nVertBands;\r
+\r
+ if (_MedRangeValue == 0)\r
+ {\r
+ nMedVertLimit = Math.Abs(_MinRangeValue) * nVertBands / nMaxRange;\r
+ nMinVertLimit = 0;\r
+ }\r
+ Size size = new Size(rect.Width/_BandsCount, rect.Height/nVertBands);\r
+ Rectangle rcBand = new Rectangle(rect.Location, size);\r
+\r
+ // Draw band from bottom\r
+ rcBand.Offset(0, rect.Height-size.Height);\r
+ int xDecal = (_BandsCount>1 ? cxyMargin : 0);\r
+ //int yDecal = 0;\r
+\r
+ Color gridPenColor = (this.ShowGrid ? GridColor : BackColor);\r
+ Pen gridPen = new Pen(gridPenColor);\r
+ Pen fallPen = new Pen( this.FalloffColor );\r
+\r
+ for(int nHorz=0; nHorz < _BandsCount; nHorz++)\r
+ {\r
+ int nValue = _meterData[nHorz].Value;\r
+ int nVertValue = nValue*nVertBands/nMaxRange;\r
+ Rectangle rcPrev = rcBand;\r
+\r
+ for(int nVert=0; nVert < nVertBands; nVert++)\r
+ {\r
+ // Find color based on range value\r
+ Color colorBand = gridPenColor;\r
+\r
+ // Draw grid line (level) bar\r
+ if ( this.ShowGrid && (nVert == nMinVertLimit || nVert == nMedVertLimit || nVert == (nVertBands-1)))\r
+ {\r
+ Point []points = new Point[2];\r
+ points[0].X = rcBand.Left;\r
+ points[0].Y = rcBand.Top + (rcBand.Height>>1);\r
+ points[1].X = rcBand.Right;\r
+ points[1].Y = points[0].Y;\r
+ g.DrawPolygon(gridPen, points);\r
+ }\r
+\r
+ if ( _MedRangeValue == 0 )\r
+ {\r
+ int nVertStart = nMedVertLimit+nVertValue;\r
+ if ( InRange(nVert, nVertStart, nMedVertLimit-1) )\r
+ colorBand = this.ColorNormal;\r
+ else if ( nVert >= nMedVertLimit && InRange(nVert, nMedVertLimit, nVertStart) )\r
+ colorBand = this.ColorHigh;\r
+ else {\r
+ colorBand = (nVert < nMedVertLimit) ? this.ColorNormalBack : this.ColorHighBack;\r
+ }\r
+ }\r
+ else if ( nVertValue < nVert )\r
+ {\r
+ if ( this.ShowGrid && this.ColoredGrid )\r
+ {\r
+ if ( InRange(nVert, 0, nMinVertLimit) )\r
+ colorBand = this.ColorNormalBack;\r
+ else if ( InRange(nVert, nMinVertLimit+1, nMedVertLimit) )\r
+ colorBand = this.ColorMediumBack;\r
+ else if ( InRange(nVert, nMedVertLimit+1, nMaxVertLimit) )\r
+ colorBand = this.ColorHighBack;\r
+ }\r
+ } else {\r
+ if (nValue == 0)\r
+ {\r
+ if (this.ShowGrid && this.ColoredGrid)\r
+ colorBand = this.ColorNormalBack;\r
+ }\r
+ else if ( InRange(nVert, 0, nMinVertLimit) )\r
+ colorBand = this.ColorNormal;\r
+ else if ( InRange(nVert, nMinVertLimit+1, nMedVertLimit) )\r
+ colorBand = this.ColorMedium;\r
+ else if ( InRange(nVert, nMedVertLimit+1, nMaxVertLimit) )\r
+ colorBand = this.ColorHigh;\r
+ }\r
+\r
+ if (colorBand != this.BackColor)\r
+ {\r
+ SolidBrush fillBrush = new SolidBrush(colorBand);\r
+ if (this._LEDCount > 1)\r
+ rcBand.Inflate(-cxyMargin, -cxyMargin);\r
+ g.FillRectangle(fillBrush, rcBand.Left, rcBand.Top, rcBand.Width+1, rcBand.Height);\r
+ if (this._LEDCount > 1)\r
+ rcBand.Inflate(cxyMargin, cxyMargin);\r
+ }\r
+ rcBand.Offset(0, -size.Height);\r
+ }\r
+\r
+ // Draw falloff effect\r
+ if (this.FalloffEffect && this.IsActive)\r
+ {\r
+ int nMaxHeight = size.Height*nVertBands;\r
+ Point []points = new Point[2];\r
+ points[0].X = rcPrev.Left + xDecal;\r
+ points[0].Y = rcPrev.Bottom - (_meterData[nHorz].Falloff * nMaxHeight) / _MaxRangeValue;\r
+ points[1].X = rcPrev.Right - xDecal;\r
+ points[1].Y = points[0].Y;\r
+ g.DrawPolygon(fallPen, points);\r
+ }\r
+\r
+ // Move to Next Horizontal band\r
+ rcBand.Offset(size.Width, size.Height * nVertBands);\r
+ }\r
+ }\r
+ protected void DrawVertBand(Graphics g, Rectangle rect)\r
+ {\r
+ int nMaxRange = (_MedRangeValue == 0) ? Math.Abs(_MaxRangeValue - _MinRangeValue) : _MaxRangeValue;\r
+ int nHorzBands = (_LEDCount > 1 ? _LEDCount : (nMaxRange * DecrementPercent) / 100);\r
+ int nMinHorzLimit = _MinRangeValue*nHorzBands/nMaxRange;\r
+ int nMedHorzLimit = _MedRangeValue*nHorzBands/nMaxRange;\r
+ int nMaxHorzLimit = nHorzBands;\r
+\r
+ if ( _MedRangeValue == 0 )\r
+ {\r
+ nMedHorzLimit = Math.Abs(_MinRangeValue)*nHorzBands/nMaxRange;\r
+ nMinHorzLimit = 0;\r
+ }\r
+\r
+ Size size = new Size(rect.Width/nHorzBands, rect.Height/_BandsCount);\r
+ Rectangle rcBand = new Rectangle(rect.Location, size);\r
+\r
+ // Draw band from top\r
+ rcBand.Offset(0, rect.Height-size.Height*_BandsCount);\r
+ //int xDecal = 0;\r
+ int yDecal = (_BandsCount>1 ? cxyMargin : 0);\r
+\r
+ Color gridPenColor = (this.ShowGrid ? GridColor : BackColor);\r
+ Pen gridPen = new Pen(gridPenColor);\r
+ Pen fallPen = new Pen( this.FalloffColor );\r
+\r
+ for(int nVert=0; nVert < _BandsCount; nVert++)\r
+ {\r
+ int nValue = _meterData[nVert].Value;\r
+ int nHorzValue = nValue*nHorzBands/nMaxRange;\r
+ Rectangle rcPrev = rcBand;\r
+\r
+ for(int nHorz=0; nHorz < nHorzBands; nHorz++)\r
+ {\r
+ // Find color based on range value\r
+ Color colorBand = gridPenColor;\r
+\r
+ if ( this.ShowGrid && (nHorz == nMinHorzLimit || nHorz == nMedHorzLimit || nHorz == (nHorzBands-1)))\r
+ {\r
+ Point []points = new Point[2];\r
+ points[0].X = rcBand.Left + (rcBand.Width>>1);\r
+ points[0].Y = rcBand.Top;\r
+ points[1].X = points[0].X;\r
+ points[1].Y = rcBand.Bottom;\r
+ g.DrawPolygon(gridPen, points);\r
+ }\r
+\r
+ if (_MedRangeValue == 0)\r
+ {\r
+ int nHorzStart = nMedHorzLimit+nHorzValue;\r
+ if ( InRange(nHorz, nHorzStart, nMedHorzLimit-1) )\r
+ colorBand = this.ColorNormal;\r
+ else if ( nHorz >= nMedHorzLimit && InRange(nHorz, nMedHorzLimit, nHorzStart) )\r
+ colorBand = this.ColorHigh;\r
+ else {\r
+ colorBand = (nHorz < nMedHorzLimit) ? this.ColorNormalBack : this.ColorHighBack;\r
+ }\r
+ }\r
+ else if ( nHorzValue < nHorz )\r
+ {\r
+ if ( this.ShowGrid && this.ColoredGrid )\r
+ {\r
+ if ( InRange(nHorz, 0, nMinHorzLimit) )\r
+ colorBand = this.ColorNormalBack;\r
+ else if ( InRange(nHorz, nMinHorzLimit+1, nMedHorzLimit) )\r
+ colorBand = this.ColorMediumBack;\r
+ else if ( InRange(nHorz, nMedHorzLimit+1, nMaxHorzLimit) )\r
+ colorBand = this.ColorHighBack;\r
+ }\r
+ } else {\r
+ if (nValue == 0)\r
+ {\r
+ if (this.ShowGrid && this.ColoredGrid)\r
+ colorBand = this.ColorNormalBack;\r
+ }\r
+ else if (InRange(nHorz, 0, nMinHorzLimit))\r
+ colorBand = this.ColorNormal;\r
+ else if ( InRange(nHorz, nMinHorzLimit+1, nMedHorzLimit) )\r
+ colorBand = this.ColorMedium;\r
+ else if ( InRange(nHorz, nMedHorzLimit+1, nMaxHorzLimit) )\r
+ colorBand = this.ColorHigh;\r
+ }\r
+\r
+ if (colorBand != this.BackColor)\r
+ {\r
+ SolidBrush fillBrush = new SolidBrush(colorBand);\r
+ if (this._LEDCount > 1)\r
+ rcBand.Inflate(-cxyMargin, -cxyMargin);\r
+ g.FillRectangle(fillBrush, rcBand.Left, rcBand.Top, rcBand.Width, rcBand.Height+1);\r
+ if (this._LEDCount > 1)\r
+ rcBand.Inflate(cxyMargin, cxyMargin);\r
+ }\r
+ rcBand.Offset(size.Width, 0);\r
+ }\r
+\r
+ // Draw falloff effect\r
+ if (this.FalloffEffect && this.IsActive)\r
+ {\r
+ int nMaxWidth = size.Width * nHorzBands;\r
+ Point[] points = new Point[2];\r
+ points[0].X = rcPrev.Left + (_meterData[nVert].Falloff * nMaxWidth) / _MaxRangeValue;\r
+ points[0].Y = rcPrev.Top + yDecal;\r
+ points[1].X = points[0].X;\r
+ points[1].Y = rcPrev.Bottom - yDecal;\r
+ g.DrawPolygon(fallPen, points);\r
+ }\r
+ \r
+ // Move to Next Vertical band\r
+ rcBand.Offset(-size.Width*nHorzBands, size.Height);\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+// use this to find resource namespace\r
+internal class MyResourceNamespace\r
+{\r
+}\r
}\r
}\r
\r
+ /// <summary>\r
+ /// Looks up a localized resource of type System.Drawing.Bitmap.\r
+ /// </summary>\r
+ internal static System.Drawing.Bitmap ic_refresh_black_24dp_1x {\r
+ get {\r
+ object obj = ResourceManager.GetObject("ic_refresh_black_24dp_1x", resourceCulture);\r
+ return ((System.Drawing.Bitmap)(obj));\r
+ }\r
+ }\r
+ \r
/// <summary>\r
/// Looks up a localized string similar to Leállítás.\r
/// </summary>\r
<data name="FELVETEL" xml:space="preserve">\r
<value>Felvétel</value>\r
</data>\r
+ <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />\r
+ <data name="ic_refresh_black_24dp_1x" type="System.Resources.ResXFileRef, System.Windows.Forms">\r
+ <value>Resources\ic_refresh_black_24dp_1x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>\r
+ </data>\r
<data name="LEALLITAS" xml:space="preserve">\r
<value>Leállítás</value>\r
</data>\r
\r
public VerticalProgressBar() {\r
Style = ProgressBarStyle.Blocks;\r
- \r
}\r
\r
protected override void CreateHandle() {\r
using System.Collections.Generic;\r
using NAudio.Wave;\r
using NAudio.CoreAudioApi;\r
-using System.Diagnostics;\r
-using System.Linq;\r
\r
namespace AudioRecorder {\r
- public class WavRecorder : IRecorder {\r
+ public class WavRecorder {\r
private const int MONO_CHANEL = 1;\r
\r
private int inputDeviceIndex;\r
private String filePath;\r
private List<String> createdWavFiles;\r
private MMDevice device;\r
- private IMainForm mainForm;\r
+ private MainForm mainForm;\r
private volatile bool pausing;\r
\r
- public WavRecorder(int inputDeviceIndex, MMDevice device, IMainForm mainForm) {\r
+ public WavRecorder(int inputDeviceIndex, MMDevice device, MainForm mainForm) {\r
this.inputDeviceIndex = inputDeviceIndex;\r
createdWavFiles = new List<String>();\r
this.device = device;\r
if (!pausing) {\r
waveWriter.Write(e.Buffer, 0, e.BytesRecorded);\r
waveWriter.Flush();\r
- try {\r
- int panelHeight = (int)Math.Round(device.AudioMeterInformation.MasterPeakValue * 100);\r
- mainForm.setPanelSizeHeight(panelHeight);\r
- }\r
- catch (Exception ex) {\r
- Console.WriteLine(ex.Message);\r
- }\r
}\r
}\r
\r
</Reference>\r
</ItemGroup>\r
<ItemGroup>\r
- <Compile Include="ColorSlider.cs">\r
- <SubType>Component</SubType>\r
- </Compile>\r
- <Compile Include="ColorSlider.designer.cs">\r
- <DependentUpon>ColorSlider.cs</DependentUpon>\r
- </Compile>\r
<Compile Include="DxPlayer.cs" />\r
<Compile Include="FilterGraphTools.cs" />\r
<Compile Include="FlexibleMessageBox.cs" />\r
<None Include="MediaInfo.dll">\r
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\r
</None>\r
- <EmbeddedResource Include="ColorSlider.resx">\r
- <DependentUpon>ColorSlider.cs</DependentUpon>\r
- </EmbeddedResource>\r
<EmbeddedResource Include="PlayerForm.resx">\r
<DependentUpon>PlayerForm.cs</DependentUpon>\r
</EmbeddedResource>\r
private Panel pVideo;\r
private NoFocusCueButton btnPlay;\r
private NoFocusCueButton btnPause;\r
- private TextBox textCurrentTC;\r
+ private TextBox lbCurrentTC;\r
private NoFocusCueButton btnStop;\r
- private TextBox txtStartTC;\r
- private TextBox txtEndTC;\r
+ private TextBox lbStartTC;\r
+ private TextBox lbEndTC;\r
private Panel panel3;\r
- private Label label2;\r
- private Label label1;\r
+ private Label lbDuration;\r
+ private Label lbStart;\r
\r
/// <summary>\r
/// Clean up any resources being used.\r
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();\r
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PlayerForm));\r
this.pVideo = new System.Windows.Forms.Panel();\r
- this.textCurrentTC = new System.Windows.Forms.TextBox();\r
- this.txtStartTC = new System.Windows.Forms.TextBox();\r
- this.txtEndTC = new System.Windows.Forms.TextBox();\r
+ this.lbCurrentTC = new System.Windows.Forms.TextBox();\r
+ this.lbStartTC = new System.Windows.Forms.TextBox();\r
+ this.lbEndTC = new System.Windows.Forms.TextBox();\r
this.panel3 = new System.Windows.Forms.Panel();\r
- this.labelStatus = new System.Windows.Forms.Label();\r
- this.trackBar1 = new DxPlay.ColorSlider();\r
- this.label2 = new System.Windows.Forms.Label();\r
- this.label1 = new System.Windows.Forms.Label();\r
+ this.lbStatus = new System.Windows.Forms.Label();\r
+ this.trackBar1 = new ColorSlider();\r
+ this.lbDuration = new System.Windows.Forms.Label();\r
+ this.lbStart = new System.Windows.Forms.Label();\r
this.splitContainer1 = new System.Windows.Forms.SplitContainer();\r
this.panelPlayer = new System.Windows.Forms.Panel();\r
this.pControls = new System.Windows.Forms.FlowLayoutPanel();\r
- this.btnPlay = new NoFocusCueButton();\r
- this.btnStop = new NoFocusCueButton();\r
- this.btnPause = new NoFocusCueButton();\r
+ this.btnPlay = new MaestroShared.Controls.NoFocusCueButton();\r
+ this.btnStop = new MaestroShared.Controls.NoFocusCueButton();\r
+ this.btnPause = new MaestroShared.Controls.NoFocusCueButton();\r
this.dgSegments = new System.Windows.Forms.DataGridView();\r
this.bsSegments = new System.Windows.Forms.BindingSource(this.components);\r
this.menuButtonSegmentActions = new DxPlay.MenuButton();\r
this.pVideo.SizeChanged += new System.EventHandler(this.panel1_SizeChanged);\r
this.pVideo.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown);\r
// \r
- // textCurrentTC\r
- // \r
- this.textCurrentTC.Anchor = System.Windows.Forms.AnchorStyles.Bottom;\r
- this.textCurrentTC.BackColor = System.Drawing.Color.White;\r
- this.textCurrentTC.BorderStyle = System.Windows.Forms.BorderStyle.None;\r
- this.textCurrentTC.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- this.textCurrentTC.Location = new System.Drawing.Point(284, 12);\r
- this.textCurrentTC.Name = "textCurrentTC";\r
- this.textCurrentTC.ReadOnly = true;\r
- this.textCurrentTC.Size = new System.Drawing.Size(108, 27);\r
- this.textCurrentTC.TabIndex = 15;\r
- this.textCurrentTC.TabStop = false;\r
- this.textCurrentTC.Text = "00:00:00.00";\r
- // \r
- // txtStartTC\r
- // \r
- this.txtStartTC.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));\r
- this.txtStartTC.BackColor = System.Drawing.Color.White;\r
- this.txtStartTC.BorderStyle = System.Windows.Forms.BorderStyle.None;\r
- this.txtStartTC.Font = new System.Drawing.Font("Calibri", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- this.txtStartTC.ForeColor = System.Drawing.SystemColors.WindowText;\r
- this.txtStartTC.Location = new System.Drawing.Point(6, 21);\r
- this.txtStartTC.Name = "txtStartTC";\r
- this.txtStartTC.ReadOnly = true;\r
- this.txtStartTC.Size = new System.Drawing.Size(66, 17);\r
- this.txtStartTC.TabIndex = 16;\r
- this.txtStartTC.TabStop = false;\r
- this.txtStartTC.Text = "00:00:00.00";\r
- // \r
- // txtEndTC\r
- // \r
- this.txtEndTC.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));\r
- this.txtEndTC.BackColor = System.Drawing.Color.White;\r
- this.txtEndTC.BorderStyle = System.Windows.Forms.BorderStyle.None;\r
- this.txtEndTC.Font = new System.Drawing.Font("Calibri", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- this.txtEndTC.ForeColor = System.Drawing.SystemColors.WindowText;\r
- this.txtEndTC.Location = new System.Drawing.Point(605, 24);\r
- this.txtEndTC.Name = "txtEndTC";\r
- this.txtEndTC.ReadOnly = true;\r
- this.txtEndTC.Size = new System.Drawing.Size(65, 17);\r
- this.txtEndTC.TabIndex = 17;\r
- this.txtEndTC.TabStop = false;\r
- this.txtEndTC.Text = "00:00:00.00";\r
- this.txtEndTC.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;\r
+ // lbCurrentTC\r
+ // \r
+ this.lbCurrentTC.Anchor = System.Windows.Forms.AnchorStyles.Bottom;\r
+ this.lbCurrentTC.BackColor = System.Drawing.Color.White;\r
+ this.lbCurrentTC.BorderStyle = System.Windows.Forms.BorderStyle.None;\r
+ this.lbCurrentTC.Font = new System.Drawing.Font("Calibri", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ this.lbCurrentTC.Location = new System.Drawing.Point(284, 12);\r
+ this.lbCurrentTC.Name = "lbCurrentTC";\r
+ this.lbCurrentTC.ReadOnly = true;\r
+ this.lbCurrentTC.Size = new System.Drawing.Size(108, 27);\r
+ this.lbCurrentTC.TabIndex = 15;\r
+ this.lbCurrentTC.TabStop = false;\r
+ this.lbCurrentTC.Text = "00:00:00.00";\r
+ // \r
+ // lbStartTC\r
+ // \r
+ this.lbStartTC.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));\r
+ this.lbStartTC.BackColor = System.Drawing.Color.White;\r
+ this.lbStartTC.BorderStyle = System.Windows.Forms.BorderStyle.None;\r
+ this.lbStartTC.Font = new System.Drawing.Font("Calibri", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ this.lbStartTC.ForeColor = System.Drawing.SystemColors.WindowText;\r
+ this.lbStartTC.Location = new System.Drawing.Point(6, 21);\r
+ this.lbStartTC.Name = "lbStartTC";\r
+ this.lbStartTC.ReadOnly = true;\r
+ this.lbStartTC.Size = new System.Drawing.Size(66, 17);\r
+ this.lbStartTC.TabIndex = 16;\r
+ this.lbStartTC.TabStop = false;\r
+ this.lbStartTC.Text = "00:00:00.00";\r
+ // \r
+ // lbEndTC\r
+ // \r
+ this.lbEndTC.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));\r
+ this.lbEndTC.BackColor = System.Drawing.Color.White;\r
+ this.lbEndTC.BorderStyle = System.Windows.Forms.BorderStyle.None;\r
+ this.lbEndTC.Font = new System.Drawing.Font("Calibri", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ this.lbEndTC.ForeColor = System.Drawing.SystemColors.WindowText;\r
+ this.lbEndTC.Location = new System.Drawing.Point(605, 24);\r
+ this.lbEndTC.Name = "lbEndTC";\r
+ this.lbEndTC.ReadOnly = true;\r
+ this.lbEndTC.Size = new System.Drawing.Size(65, 17);\r
+ this.lbEndTC.TabIndex = 17;\r
+ this.lbEndTC.TabStop = false;\r
+ this.lbEndTC.Text = "00:00:00.00";\r
+ this.lbEndTC.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;\r
// \r
// panel3\r
// \r
- this.panel3.Controls.Add(this.labelStatus);\r
+ this.panel3.Controls.Add(this.lbStatus);\r
this.panel3.Controls.Add(this.trackBar1);\r
- this.panel3.Controls.Add(this.label2);\r
- this.panel3.Controls.Add(this.label1);\r
- this.panel3.Controls.Add(this.txtStartTC);\r
- this.panel3.Controls.Add(this.txtEndTC);\r
- this.panel3.Controls.Add(this.textCurrentTC);\r
+ this.panel3.Controls.Add(this.lbDuration);\r
+ this.panel3.Controls.Add(this.lbStart);\r
+ this.panel3.Controls.Add(this.lbStartTC);\r
+ this.panel3.Controls.Add(this.lbEndTC);\r
+ this.panel3.Controls.Add(this.lbCurrentTC);\r
this.panel3.Dock = System.Windows.Forms.DockStyle.Bottom;\r
this.panel3.Location = new System.Drawing.Point(0, 433);\r
this.panel3.Name = "panel3";\r
this.panel3.Size = new System.Drawing.Size(675, 51);\r
this.panel3.TabIndex = 19;\r
// \r
- // labelStatus\r
+ // lbStatus\r
// \r
- this.labelStatus.Anchor = System.Windows.Forms.AnchorStyles.Bottom;\r
- this.labelStatus.Font = new System.Drawing.Font("Calibri", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- this.labelStatus.Location = new System.Drawing.Point(281, 4);\r
- this.labelStatus.Name = "labelStatus";\r
- this.labelStatus.Size = new System.Drawing.Size(111, 13);\r
- this.labelStatus.TabIndex = 20;\r
- this.labelStatus.Text = "NO INPUT";\r
- this.labelStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;\r
+ this.lbStatus.Anchor = System.Windows.Forms.AnchorStyles.Bottom;\r
+ this.lbStatus.Font = new System.Drawing.Font("Calibri", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ this.lbStatus.Location = new System.Drawing.Point(281, 4);\r
+ this.lbStatus.Name = "lbStatus";\r
+ this.lbStatus.Size = new System.Drawing.Size(111, 13);\r
+ this.lbStatus.TabIndex = 20;\r
+ this.lbStatus.Text = "NO INPUT";\r
+ this.lbStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;\r
// \r
// trackBar1\r
// \r
this.trackBar1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.trackBar1_MouseDown);\r
this.trackBar1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.trackBar1_MouseUp);\r
// \r
- // label2\r
+ // lbDuration\r
// \r
- this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));\r
- this.label2.Font = new System.Drawing.Font("Calibri", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- this.label2.Location = new System.Drawing.Point(605, 5);\r
- this.label2.Name = "label2";\r
- this.label2.Size = new System.Drawing.Size(68, 13);\r
- this.label2.TabIndex = 19;\r
- this.label2.Text = "DURATION";\r
- this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;\r
+ this.lbDuration.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));\r
+ this.lbDuration.Font = new System.Drawing.Font("Calibri", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ this.lbDuration.Location = new System.Drawing.Point(605, 5);\r
+ this.lbDuration.Name = "lbDuration";\r
+ this.lbDuration.Size = new System.Drawing.Size(68, 13);\r
+ this.lbDuration.TabIndex = 19;\r
+ this.lbDuration.Text = "DURATION";\r
+ this.lbDuration.TextAlign = System.Drawing.ContentAlignment.MiddleRight;\r
// \r
- // label1\r
+ // lbStart\r
// \r
- this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));\r
- this.label1.Font = new System.Drawing.Font("Calibri", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- this.label1.Location = new System.Drawing.Point(3, 5);\r
- this.label1.Name = "label1";\r
- this.label1.Size = new System.Drawing.Size(69, 13);\r
- this.label1.TabIndex = 18;\r
- this.label1.Text = "START";\r
- this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;\r
+ this.lbStart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));\r
+ this.lbStart.Font = new System.Drawing.Font("Calibri", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ this.lbStart.Location = new System.Drawing.Point(3, 5);\r
+ this.lbStart.Name = "lbStart";\r
+ this.lbStart.Size = new System.Drawing.Size(69, 13);\r
+ this.lbStart.TabIndex = 18;\r
+ this.lbStart.Text = "START";\r
+ this.lbStart.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;\r
// \r
// splitContainer1\r
// \r
// btnPlay\r
// \r
this.btnPlay.AutoSize = true;\r
- this.btnPlay.BackColor = System.Drawing.Color.White;\r
+ this.btnPlay.BackColor = System.Drawing.Color.Transparent;\r
this.btnPlay.FlatAppearance.BorderSize = 0;\r
this.btnPlay.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
this.btnPlay.Image = global::DxPlay.Properties.Resources.ic_play_arrow_black_24dp_2x;\r
// btnStop\r
// \r
this.btnStop.AutoSize = true;\r
- this.btnStop.BackColor = System.Drawing.Color.White;\r
+ this.btnStop.BackColor = System.Drawing.Color.Transparent;\r
this.btnStop.FlatAppearance.BorderSize = 0;\r
this.btnStop.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
this.btnStop.Image = global::DxPlay.Properties.Resources.ic_stop_black_24dp_2x;\r
// btnPause\r
// \r
this.btnPause.AutoSize = true;\r
- this.btnPause.BackColor = System.Drawing.Color.White;\r
+ this.btnPause.BackColor = System.Drawing.Color.Transparent;\r
this.btnPause.FlatAppearance.BorderSize = 0;\r
this.btnPause.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
this.btnPause.Image = global::DxPlay.Properties.Resources.ic_pause_black_24dp_2x;\r
#endregion\r
\r
private ColorSlider trackBar1;\r
- private Label labelStatus;\r
+ private Label lbStatus;\r
private SplitContainer splitContainer1;\r
private Panel panelPlayer;\r
private MenuButton menuButtonSegmentActions;\r
}\r
\r
private void InitializeTexts() {\r
+\r
defineOneSegmentToolStripMenuItem.Text = StringResource.SZEGMENS_DEFINIALASA;\r
splitSegmentAtCurrentPositionToolStripMenuItem.Text = StringResource.SZEGMENS_SZETVAGASA;\r
actualPositionToIntroToolStripMenuItem.Text = StringResource.AKTUALIS_POZICIO_BELEPO;\r
//btnPause.Text = StringResource.SZUNET;\r
//btnPlay.Text = StringResource.LEJATSZAS;\r
//btnStop.Text = StringResource.LEALLITAS;\r
- labelStatus.Text = StringResource.NINCS_BEMENET;\r
- label1.Text = StringResource.INDULASI_PONT;\r
- label2.Text = StringResource.HOSSZ;\r
+ lbStatus.Text = StringResource.NINCS_BEMENET;\r
+ lbStart.Text = StringResource.INDULASI_PONT;\r
+ lbDuration.Text = StringResource.HOSSZ;\r
}\r
\r
private void cueue() {\r
m_play.PlayEvent += new DxPlayEvent(playEvent);\r
if (m_mediaDescription != null) {\r
trackBar1.Maximum = m_mediaDescription.Duration.Frames;\r
- txtStartTC.Text = m_mediaDescription.FirstFrame.ToString();\r
- txtEndTC.Text = m_mediaDescription.Duration.ToString();\r
+ lbStartTC.Text = m_mediaDescription.FirstFrame.ToString();\r
+ lbEndTC.Text = m_mediaDescription.Duration.ToString();\r
}\r
}\r
catch (Exception ce) {\r
return;\r
if (!trackBarAtUser)\r
trackBar1.Value = m_play.CurrentTC.ZeroBasedFrames;\r
- textCurrentTC.Text = m_play.CurrentTC.ToString();\r
- string labelStatusText = labelStatus.Text;\r
+ lbCurrentTC.Text = m_play.CurrentTC.ToString();\r
+ string labelStatusText = lbStatus.Text;\r
m_play.stateHunStringValues.TryGetValue(m_play.State, out labelStatusText);//m_play.State.ToString().ToUpper();\r
- labelStatus.Text = labelStatusText;\r
+ lbStatus.Text = labelStatusText;\r
}));\r
}\r
\r
splitContainer1.Panel2Collapsed = true;\r
splitContainer1.Panel2.Hide();\r
}\r
+\r
+ lbStartTC.BackColor = BackColor;\r
+ lbDuration.BackColor = BackColor;\r
+ lbEndTC.BackColor = BackColor;\r
+ lbCurrentTC.BackColor = BackColor;\r
+ lbStart.BackColor = BackColor;\r
+ lbStatus.BackColor = BackColor;\r
+ dgSegments.BackgroundColor = BackColor;\r
+\r
}\r
\r
private void PlayerForm_KeyDown(object sender, KeyEventArgs e) {\r
m_play.Play();\r
result = true;\r
break;\r
+ case Keys.I:\r
+ if (SegmentEditor)\r
+ SetActualPositionAsIn();\r
+ break;\r
+ case Keys.O:\r
+ if (SegmentEditor)\r
+ SetActualPositionAsOut();\r
+ break;\r
}\r
return result;\r
}\r
segments.Remove(bsSegments.Current as MovieSegment);\r
}\r
\r
- private void OnActualPositionToTCInToolStripMenuItem1Click(object sender, EventArgs e) {\r
+ private void SetActualPositionAsIn() {\r
MovieSegment currentSegment = bsSegments.Current as MovieSegment;\r
- if (currentSegment == null)\r
- return;\r
- if (currentSegment.TCOut.Frames <= m_play.CurrentTC.Frames) {\r
- MessageBox.Show("A belépõ nem lehet a kilépõ után.");\r
- return;\r
- }\r
- //if (MessageBox.Show("Biztos felül akarja írni az belépõt?", "Belépõ felülírása", MessageBoxButtons.YesNo) == DialogResult.No)\r
- // return;\r
- MovieSegment collisionSegment = segments.Where(s => s.TCIn.Frames < m_play.CurrentTC.Frames && m_play.CurrentTC.Frames < s.TCOut.Frames).SingleOrDefault();\r
+ if (currentSegment == null || bsSegments.Count == 0) {\r
+ MovieSegment newSegment = new MovieSegment() {\r
+ TCIn = new Timecode(m_play.CurrentTC.Frames),\r
+ TCOut = new Timecode(m_play.MediaDescription.FirstFrame.Frames + m_play.MediaDescription.Duration.Frames)\r
+ };\r
+ bsSegments.Position = bsSegments.Add(newSegment);\r
+ } else {\r
+ if (currentSegment.TCOut.Frames <= m_play.CurrentTC.Frames) {\r
+ int pos = bsSegments.IndexOf(currentSegment);\r
+ if (pos == bsSegments.Count - 1) {\r
+ MovieSegment newSegment = new MovieSegment() {\r
+ TCIn = new Timecode(m_play.CurrentTC.Frames),\r
+ TCOut = new Timecode(m_play.MediaDescription.FirstFrame.Frames + m_play.MediaDescription.Duration.Frames)\r
+ };\r
+ bsSegments.Position = bsSegments.Add(newSegment);\r
+ return;\r
+ }\r
+ MessageBox.Show("A belépõ nem lehet a kilépõ után.");\r
+ return;\r
+ }\r
+ //if (MessageBox.Show("Biztos felül akarja írni az belépõt?", "Belépõ felülírása", MessageBoxButtons.YesNo) == DialogResult.No)\r
+ // return;\r
+ MovieSegment collisionSegment = segments.Where(s => s.TCIn.Frames < m_play.CurrentTC.Frames && m_play.CurrentTC.Frames < s.TCOut.Frames).SingleOrDefault();\r
\r
- if (collisionSegment != null && !currentSegment.Equals(collisionSegment)) {\r
- MessageBox.Show("A szegmensek között nem lehet átfedés.");\r
- return;\r
- }\r
+ if (collisionSegment != null && !currentSegment.Equals(collisionSegment)) {\r
+ MessageBox.Show("A szegmensek között nem lehet átfedés.");\r
+ return;\r
+ }\r
\r
- currentSegment.TCIn = new Timecode(m_play.CurrentTC.Frames);\r
+ currentSegment.TCIn = new Timecode(m_play.CurrentTC.Frames);\r
+ }\r
}\r
\r
- private void OnActualPositionToTCOutToolStripMenuItem1Click(object sender, EventArgs e) {\r
+\r
+ private void SetActualPositionAsOut() {\r
MovieSegment currentSegment = bsSegments.Current as MovieSegment;\r
- if (currentSegment == null)\r
- return;\r
- if (currentSegment.TCIn.Frames >= m_play.CurrentTC.Frames)\r
- MessageBox.Show("A kilépõ nem lehet a belépõ elõtt.");\r
+ if (currentSegment == null || bsSegments.Count == 0) {\r
+ MovieSegment newSegment = new MovieSegment() {\r
+ TCIn = new Timecode(m_play.MediaDescription.FirstFrame.Frames),\r
+ TCOut = new Timecode(m_play.CurrentTC.Frames),\r
+ };\r
+ bsSegments.Position = bsSegments.Add(newSegment);\r
+ } else {\r
+ if (currentSegment.TCIn.Frames >= m_play.CurrentTC.Frames)\r
+ MessageBox.Show("A kilépõ nem lehet a belépõ elõtt.");\r
\r
- MovieSegment collisionSegment = segments.Where(s => s.TCIn.Frames < m_play.CurrentTC.Frames && m_play.CurrentTC.Frames < s.TCOut.Frames).SingleOrDefault();\r
+ MovieSegment collisionSegment = segments.Where(s => s.TCIn.Frames < m_play.CurrentTC.Frames && m_play.CurrentTC.Frames < s.TCOut.Frames).SingleOrDefault();\r
\r
- if (collisionSegment != null && !currentSegment.Equals(collisionSegment)) {\r
- MessageBox.Show("A szegmensek között nem lehet átfedés.");\r
- return;\r
+ if (collisionSegment != null && !currentSegment.Equals(collisionSegment)) {\r
+ MessageBox.Show("A szegmensek között nem lehet átfedés.");\r
+ return;\r
+ }\r
+\r
+ //if (MessageBox.Show("Biztos felül akarja írni az kilépõt?", "Kilépõ felülírása", MessageBoxButtons.YesNo) == DialogResult.No)\r
+ // return;\r
+ currentSegment.TCOut = new Timecode(m_play.CurrentTC.Frames);\r
}\r
+ }\r
+\r
+ private void OnActualPositionToTCInToolStripMenuItem1Click(object sender, EventArgs e) {\r
+ SetActualPositionAsIn();\r
+ }\r
\r
- //if (MessageBox.Show("Biztos felül akarja írni az kilépõt?", "Kilépõ felülírása", MessageBoxButtons.YesNo) == DialogResult.No)\r
- // return;\r
- currentSegment.TCOut = new Timecode(m_play.CurrentTC.Frames);\r
+ private void OnActualPositionToTCOutToolStripMenuItem1Click(object sender, EventArgs e) {\r
+ SetActualPositionAsOut();\r
}\r
\r
private void OnSplitSegmentAtCurrentPositionClick(object sender, EventArgs e) {\r
m_play.Pause();\r
int pos = actualSegment.TCOut.Frames - m_play.MediaDescription.FirstFrame.Frames;\r
//Az utolsó kocka nem jelenik meg egyébként\r
- if (pos == m_play.MediaDescription.Duration.Frames)\r
+ if (pos == m_play.MediaDescription.Duration.Frames) {\r
pos--;\r
- m_play.Seek(pos);\r
- m_play.Play();\r
+ m_play.Seek(pos);\r
+ m_play.Play();\r
+ } else\r
+ m_play.Seek(pos);\r
+\r
}\r
\r
}\r
"active": true,\r
"startInTray": false,\r
"enableCustomMetadataId": true,\r
+ "defaultWindowColor": "#E1BEE7",\r
+ "partialWindowColor": "#F3E5F5",\r
"player": {\r
"enabled": true,\r
"autoStart": false,\r
"timeout": 1000\r
}\r
},\r
- "disableProject": false,\r
- "disableSourceOpen": false\r
+ "disableOpenProject": false,\r
+ "disableOpenSourceFolder": false\r
}\r
},\r
{\r
}\r
\r
ArchiveMetadataForm form = new ArchiveMetadataForm(ref archiveMetadata);\r
+ form.BackColor = partialColor;\r
DialogResult result = form.ShowDialog();\r
\r
if (result == DialogResult.OK && String.IsNullOrEmpty(textSelectedMetadata.Text)) {\r
if (movieSegments == null)\r
movieSegments = new BindingList<MovieSegment>();\r
PlayerForm player = new PlayerForm(ref movieSegments);\r
+ player.BackColor = partialColor;\r
player.AutoStart = Configuration.Player.AutoStart;\r
player.SegmentEditor = Configuration.Player.SegmentEditor;\r
player.Open(SelectedSource.FileInfo);\r
Lookup(SelectedMetadata.ID);\r
}\r
\r
+ private void ClearSelectedMetadata() {\r
+ trafficIDSelector.ClearSelection();\r
+ octopusIDSelector.ClearSelection();\r
+ SelectedMetadata = null;\r
+ }\r
+\r
}\r
}\r
}\r
\r
private void InitializeSource() {\r
+\r
+ if (Configuration.DefaultWindowColor != null)\r
+ defaultColor = (Color) Configuration.DefaultWindowColor;\r
+ if (Configuration.PartialWindowColor != null)\r
+ partialColor = (Color) Configuration.PartialWindowColor;\r
+\r
Uri localAddress = Configuration?.Source?.Local?.Address;\r
Uri remoteAddress = Configuration?.Source?.Remote?.Address;\r
if (String.IsNullOrEmpty(remoteAddress?.ToString())) {\r
Cursor = Cursors.WaitCursor;\r
try {\r
PlayerForm player = new PlayerForm();\r
+ player.BackColor = partialColor;\r
player.AutoStart = Configuration.Player.AutoStart;\r
player.Open(fileSourceItem.FileInfo);\r
if (!player.IsDisposed)\r
CreateJobsQueueWorker();\r
ActivateTab(0);\r
SelectedSource = null;\r
+ ClearSelectedMetadata();\r
}\r
\r
-\r
}\r
}\r
private ToolTip formTooltip = new ToolTip();\r
private ConfigurationInfo configuration;\r
\r
- private static readonly Color highlightColor = Color.White;\r
- private static readonly Color defaultColor = SystemColors.Control;\r
+ private Color partialColor = Color.White;\r
+ private Color defaultColor = SystemColors.Control;\r
\r
\r
public ConfigurationInfo Configuration {\r
private void groupBox_Enter(object sender, EventArgs e) {\r
Control control = sender as Control;\r
control.Font = new Font(control.Font, FontStyle.Bold);\r
- SetColor(control, highlightColor);\r
+ SetColor(control, partialColor);\r
}\r
\r
private void SetColor(Control control, Color color) {\r
// You can specify all the values or you can default the Build and Revision Numbers\r
// by using the '*' as shown below:\r
// [assembly: AssemblyVersion("1.0.*")]\r
-[assembly: AssemblyVersion("2.0.4.5")]\r
-[assembly: AssemblyFileVersion("2.0.4.5")]\r
+[assembly: AssemblyVersion("2.0.5.0")]\r
+[assembly: AssemblyFileVersion("2.0.5.0")]\r
using System.Linq;\r
using System.Collections.Generic;\r
using System.IO;\r
+using System.Drawing;\r
\r
namespace MaestroShared.Configuration {\r
\r
}\r
\r
public class ConfigurationInfo {\r
+ //[JsonConverter(typeof(KeysColorConverter))]\r
+ public Color? DefaultWindowColor { get; set; }\r
+ //[JsonConverter(typeof(KeysColorConverter))]\r
+ public Color? PartialWindowColor { get; set; }\r
public bool StartInTray { get; set; }\r
public bool Active { get; set; }\r
public string Title { get; set; }\r
//[JsonConverter(typeof(KeysJsonConverter))]\r
public Uri Address { get; set; }\r
public string UserName { get; set; }\r
- [JsonConverter(typeof(KeysJsonConverter))]\r
+ [JsonConverter(typeof(KeysPasswordConverter))]\r
public string Password { get; set; }\r
public int Timeout { get; set; }\r
}\r
public Connection TemplateRoot { get; set; }\r
public Target Target { get; set; }\r
public string TemplateName { get; set; }\r
- public bool DisableProject { get; set; }\r
- public bool DisableSourceOpen { get; set; }\r
+ public bool DisableOpenProject { get; set; }\r
+ public bool DisableOpenSourceFolder { get; set; }\r
public bool IsValid {\r
get {\r
return Target?.Remote?.Address != null &&\r
--- /dev/null
+using Newtonsoft.Json;\r
+using System;\r
+using System.Drawing;\r
+using System.Globalization;\r
+using System.Windows.Forms;\r
+\r
+namespace MaestroShared.Configuration {\r
+ public class KeysColorConverter : JsonConverter {\r
+ public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) {\r
+ }\r
+\r
+ public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) {\r
+ string d = serializer.Deserialize(reader, objectType)?.ToString();\r
+ Color color = SystemColors.Control;\r
+ try {\r
+ color = Color.FromArgb(int.Parse(d.Substring(1, 2), NumberStyles.HexNumber),\r
+ int.Parse(d.Substring(3, 2), NumberStyles.HexNumber), \r
+ int.Parse(d.Substring(5, 2), NumberStyles.HexNumber));\r
+ }\r
+ catch (Exception e) {\r
+ MessageBox.Show(e.Message);\r
+ }\r
+ return color;\r
+ }\r
+\r
+ public override bool CanConvert(Type objectType) {\r
+ return true;\r
+ }\r
+\r
+ public override bool CanRead {\r
+ get {\r
+ return true;\r
+ }\r
+ }\r
+ }\r
+}\r
using System;\r
\r
namespace MaestroShared.Configuration {\r
- public class KeysJsonConverter : JsonConverter {\r
+ public class KeysPasswordConverter : JsonConverter {\r
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) {\r
}\r
\r
using System.Drawing.Drawing2D;\r
using System.Windows.Forms;\r
\r
-namespace DxPlay\r
+namespace MaestroShared.Controls\r
{\r
/// <summary>\r
/// Encapsulates control that visualy displays certain integer value and allows user to change it within desired range. It imitates <see cref="System.Windows.Forms.TrackBar"/> as far as mouse usage is concerned.\r
-namespace DxPlay {\r
+namespace MaestroShared.Controls {\r
partial class ColorSlider {\r
/// <summary> \r
/// Required designer variable.\r
<Compile Include="Commons\PatterNameMaker.cs" />\r
<Compile Include="Commons\Win32File.cs" />\r
<Compile Include="Configuration\ConfigurationInfo.cs" />\r
+ <Compile Include="Configuration\KeysColorConverter.cs" />\r
<Compile Include="Configuration\KeysJsonConverter.cs" />\r
<Compile Include="Configuration\KnownTypesBinder.cs" />\r
+ <Compile Include="Controls\ColorSlider.cs">\r
+ <SubType>Component</SubType>\r
+ </Compile>\r
+ <Compile Include="Controls\ColorSlider.designer.cs">\r
+ <DependentUpon>ColorSlider.cs</DependentUpon>\r
+ </Compile>\r
<Compile Include="Controls\NoFocusCueButton.cs">\r
<SubType>Component</SubType>\r
</Compile>\r
<Name>PasswordEncrypter</Name>\r
</ProjectReference>\r
</ItemGroup>\r
+ <ItemGroup>\r
+ <EmbeddedResource Include="Controls\ColorSlider.resx">\r
+ <DependentUpon>ColorSlider.cs</DependentUpon>\r
+ </EmbeddedResource>\r
+ </ItemGroup>\r
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
</Project>
\ No newline at end of file
<Name>MaestroShared</Name>\r
</ProjectReference>\r
</ItemGroup>\r
+ <ItemGroup>\r
+ <None Include="Resources\ic_refresh_black_24dp_1x.png" />\r
+ </ItemGroup>\r
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
</Project>
\ No newline at end of file
/// </summary>\r
private void InitializeComponent() {\r
this.treeOctopus = new OctopusClient.CheckableTreeView();\r
- this.pSearch = new System.Windows.Forms.TableLayoutPanel();\r
+ this.pSeparator = new System.Windows.Forms.Panel();\r
+ this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();\r
this.cbFolders = new System.Windows.Forms.ComboBox();\r
+ this.dtScheduled = new System.Windows.Forms.DateTimePicker();\r
this.pFolderType = new System.Windows.Forms.FlowLayoutPanel();\r
this.rbRundown = new System.Windows.Forms.RadioButton();\r
this.rbStoryFolder = new System.Windows.Forms.RadioButton();\r
this.txtFilter = new System.Windows.Forms.TextBox();\r
- this.dtScheduled = new System.Windows.Forms.DateTimePicker();\r
- this.pSeparator = new System.Windows.Forms.Panel();\r
- this.pSearch.SuspendLayout();\r
+ this.noFocusCueButton1 = new MaestroShared.Controls.NoFocusCueButton();\r
+ this.tableLayoutPanel1.SuspendLayout();\r
this.pFolderType.SuspendLayout();\r
this.SuspendLayout();\r
// \r
this.treeOctopus.BorderStyle = System.Windows.Forms.BorderStyle.None;\r
this.treeOctopus.CheckBoxes = true;\r
this.treeOctopus.Dock = System.Windows.Forms.DockStyle.Fill;\r
- this.treeOctopus.Location = new System.Drawing.Point(0, 78);\r
+ this.treeOctopus.Location = new System.Drawing.Point(0, 80);\r
this.treeOctopus.Margin = new System.Windows.Forms.Padding(0);\r
this.treeOctopus.Name = "treeOctopus";\r
- this.treeOctopus.Size = new System.Drawing.Size(300, 322);\r
+ this.treeOctopus.Size = new System.Drawing.Size(300, 320);\r
this.treeOctopus.TabIndex = 5;\r
this.treeOctopus.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeOctopus_NodeMouseClick);\r
this.treeOctopus.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeOctopus_NodeMouseDoubleClick);\r
this.treeOctopus.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeContent_KeyDown);\r
// \r
- // pSearch\r
- // \r
- this.pSearch.AutoSize = true;\r
- this.pSearch.ColumnCount = 2;\r
- this.pSearch.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
- this.pSearch.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));\r
- this.pSearch.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));\r
- this.pSearch.Controls.Add(this.cbFolders, 0, 2);\r
- this.pSearch.Controls.Add(this.pFolderType, 0, 1);\r
- this.pSearch.Controls.Add(this.txtFilter, 0, 0);\r
- this.pSearch.Controls.Add(this.dtScheduled, 0, 2);\r
- this.pSearch.Dock = System.Windows.Forms.DockStyle.Top;\r
- this.pSearch.Location = new System.Drawing.Point(0, 0);\r
- this.pSearch.Margin = new System.Windows.Forms.Padding(0);\r
- this.pSearch.Name = "pSearch";\r
- this.pSearch.Padding = new System.Windows.Forms.Padding(3);\r
- this.pSearch.RowCount = 3;\r
- this.pSearch.RowStyles.Add(new System.Windows.Forms.RowStyle());\r
- this.pSearch.RowStyles.Add(new System.Windows.Forms.RowStyle());\r
- this.pSearch.RowStyles.Add(new System.Windows.Forms.RowStyle());\r
- this.pSearch.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));\r
- this.pSearch.Size = new System.Drawing.Size(300, 72);\r
- this.pSearch.TabIndex = 11;\r
- this.pSearch.Paint += new System.Windows.Forms.PaintEventHandler(this.OnSearchPanelPaint);\r
+ // pSeparator\r
+ // \r
+ this.pSeparator.BackColor = System.Drawing.Color.White;\r
+ this.pSeparator.Dock = System.Windows.Forms.DockStyle.Top;\r
+ this.pSeparator.Location = new System.Drawing.Point(0, 74);\r
+ this.pSeparator.Name = "pSeparator";\r
+ this.pSeparator.Size = new System.Drawing.Size(300, 6);\r
+ this.pSeparator.TabIndex = 12;\r
+ // \r
+ // tableLayoutPanel1\r
+ // \r
+ this.tableLayoutPanel1.ColumnCount = 3;\r
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));\r
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
+ this.tableLayoutPanel1.Controls.Add(this.cbFolders, 1, 2);\r
+ this.tableLayoutPanel1.Controls.Add(this.dtScheduled, 0, 2);\r
+ this.tableLayoutPanel1.Controls.Add(this.pFolderType, 0, 1);\r
+ this.tableLayoutPanel1.Controls.Add(this.txtFilter, 0, 0);\r
+ this.tableLayoutPanel1.Controls.Add(this.noFocusCueButton1, 2, 2);\r
+ this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top;\r
+ this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);\r
+ this.tableLayoutPanel1.Name = "tableLayoutPanel1";\r
+ this.tableLayoutPanel1.RowCount = 3;\r
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());\r
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());\r
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));\r
+ this.tableLayoutPanel1.Size = new System.Drawing.Size(300, 74);\r
+ this.tableLayoutPanel1.TabIndex = 13;\r
// \r
// cbFolders\r
// \r
this.cbFolders.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;\r
this.cbFolders.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
this.cbFolders.FormattingEnabled = true;\r
- this.cbFolders.Location = new System.Drawing.Point(86, 47);\r
+ this.cbFolders.Location = new System.Drawing.Point(83, 49);\r
this.cbFolders.Margin = new System.Windows.Forms.Padding(1);\r
this.cbFolders.Name = "cbFolders";\r
- this.cbFolders.Size = new System.Drawing.Size(210, 21);\r
- this.cbFolders.TabIndex = 4;\r
- this.cbFolders.SelectedIndexChanged += new System.EventHandler(this.OnSelectedFolderChanged);\r
+ this.cbFolders.Size = new System.Drawing.Size(193, 21);\r
+ this.cbFolders.TabIndex = 5;\r
+ this.cbFolders.SelectedValueChanged += new System.EventHandler(this.OnSelectedFolderChanged);\r
+ // \r
+ // dtScheduled\r
+ // \r
+ this.dtScheduled.CustomFormat = " ";\r
+ this.dtScheduled.Format = System.Windows.Forms.DateTimePickerFormat.Short;\r
+ this.dtScheduled.Location = new System.Drawing.Point(1, 49);\r
+ this.dtScheduled.Margin = new System.Windows.Forms.Padding(1);\r
+ this.dtScheduled.Name = "dtScheduled";\r
+ this.dtScheduled.Size = new System.Drawing.Size(80, 20);\r
+ this.dtScheduled.TabIndex = 4;\r
+ this.dtScheduled.ValueChanged += new System.EventHandler(this.OnDateChanged);\r
// \r
// pFolderType\r
// \r
- this.pSearch.SetColumnSpan(this.pFolderType, 2);\r
+ this.tableLayoutPanel1.SetColumnSpan(this.pFolderType, 3);\r
this.pFolderType.Controls.Add(this.rbRundown);\r
this.pFolderType.Controls.Add(this.rbStoryFolder);\r
this.pFolderType.Dock = System.Windows.Forms.DockStyle.Top;\r
- this.pFolderType.Location = new System.Drawing.Point(3, 25);\r
+ this.pFolderType.Location = new System.Drawing.Point(0, 22);\r
this.pFolderType.Margin = new System.Windows.Forms.Padding(0);\r
this.pFolderType.Name = "pFolderType";\r
- this.pFolderType.Size = new System.Drawing.Size(294, 21);\r
- this.pFolderType.TabIndex = 2;\r
+ this.pFolderType.Size = new System.Drawing.Size(300, 26);\r
+ this.pFolderType.TabIndex = 3;\r
// \r
// rbRundown\r
// \r
// \r
// txtFilter\r
// \r
- this.pSearch.SetColumnSpan(this.txtFilter, 2);\r
+ this.tableLayoutPanel1.SetColumnSpan(this.txtFilter, 3);\r
this.txtFilter.Dock = System.Windows.Forms.DockStyle.Fill;\r
- this.txtFilter.Location = new System.Drawing.Point(4, 4);\r
+ this.txtFilter.Location = new System.Drawing.Point(1, 1);\r
this.txtFilter.Margin = new System.Windows.Forms.Padding(1);\r
this.txtFilter.Name = "txtFilter";\r
- this.txtFilter.Size = new System.Drawing.Size(292, 20);\r
- this.txtFilter.TabIndex = 0;\r
+ this.txtFilter.Size = new System.Drawing.Size(298, 20);\r
+ this.txtFilter.TabIndex = 1;\r
this.txtFilter.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnFilterKeyDown);\r
// \r
- // dtScheduled\r
+ // noFocusCueButton1\r
// \r
- this.dtScheduled.CustomFormat = " ";\r
- this.dtScheduled.Format = System.Windows.Forms.DateTimePickerFormat.Short;\r
- this.dtScheduled.Location = new System.Drawing.Point(4, 47);\r
- this.dtScheduled.Margin = new System.Windows.Forms.Padding(1);\r
- this.dtScheduled.Name = "dtScheduled";\r
- this.dtScheduled.Size = new System.Drawing.Size(80, 20);\r
- this.dtScheduled.TabIndex = 3;\r
- this.dtScheduled.ValueChanged += new System.EventHandler(this.OnDateChanged);\r
- // \r
- // pSeparator\r
- // \r
- this.pSeparator.BackColor = System.Drawing.Color.White;\r
- this.pSeparator.Dock = System.Windows.Forms.DockStyle.Top;\r
- this.pSeparator.Location = new System.Drawing.Point(0, 72);\r
- this.pSeparator.Name = "pSeparator";\r
- this.pSeparator.Size = new System.Drawing.Size(300, 6);\r
- this.pSeparator.TabIndex = 12;\r
+ this.noFocusCueButton1.FlatAppearance.BorderSize = 0;\r
+ this.noFocusCueButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+ this.noFocusCueButton1.Image = global::OctopusClient.Resources.ic_refresh_black_24dp_1x;\r
+ this.noFocusCueButton1.Location = new System.Drawing.Point(278, 49);\r
+ this.noFocusCueButton1.Margin = new System.Windows.Forms.Padding(1);\r
+ this.noFocusCueButton1.Name = "noFocusCueButton1";\r
+ this.noFocusCueButton1.Size = new System.Drawing.Size(21, 21);\r
+ this.noFocusCueButton1.TabIndex = 6;\r
+ this.noFocusCueButton1.UseVisualStyleBackColor = true;\r
+ this.noFocusCueButton1.Click += new System.EventHandler(this.noFocusCueButton1_Click);\r
// \r
// OctopusIDSelector\r
// \r
this.BackColor = System.Drawing.Color.Transparent;\r
this.Controls.Add(this.treeOctopus);\r
this.Controls.Add(this.pSeparator);\r
- this.Controls.Add(this.pSearch);\r
+ this.Controls.Add(this.tableLayoutPanel1);\r
this.Name = "OctopusIDSelector";\r
this.Size = new System.Drawing.Size(300, 400);\r
- this.pSearch.ResumeLayout(false);\r
- this.pSearch.PerformLayout();\r
+ this.tableLayoutPanel1.ResumeLayout(false);\r
+ this.tableLayoutPanel1.PerformLayout();\r
this.pFolderType.ResumeLayout(false);\r
this.pFolderType.PerformLayout();\r
this.ResumeLayout(false);\r
- this.PerformLayout();\r
\r
}\r
\r
#endregion\r
private CheckableTreeView treeOctopus;\r
- private System.Windows.Forms.TableLayoutPanel pSearch;\r
+ private System.Windows.Forms.Panel pSeparator;\r
+ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;\r
+ private System.Windows.Forms.ComboBox cbFolders;\r
+ private System.Windows.Forms.DateTimePicker dtScheduled;\r
private System.Windows.Forms.FlowLayoutPanel pFolderType;\r
private System.Windows.Forms.RadioButton rbRundown;\r
private System.Windows.Forms.RadioButton rbStoryFolder;\r
private System.Windows.Forms.TextBox txtFilter;\r
- private System.Windows.Forms.DateTimePicker dtScheduled;\r
- private System.Windows.Forms.ComboBox cbFolders;\r
- private System.Windows.Forms.Panel pSeparator;\r
+ private MaestroShared.Controls.NoFocusCueButton noFocusCueButton1;\r
}\r
}\r
treeOctopus.AfterCheck += OnTreeAfterCheck;\r
treeOctopus.DrawMode = TreeViewDrawMode.OwnerDrawText;\r
treeOctopus.DrawNode += OnDrawNode;\r
- treeOctopus.NodeDoubleClick += treeOctopus_NodeDoubleClick;\r
+ treeOctopus.NodeDoubleClick += OnNodeDoubleClick;\r
}\r
\r
void OnDrawNode(object sender, DrawTreeNodeEventArgs e) {\r
Graphics g = e.Graphics;\r
- if ((e.State & TreeNodeStates.Selected) == TreeNodeStates.Selected) {\r
+ if ((e.State & TreeNodeStates.Selected) == TreeNodeStates.Selected || (e.State & TreeNodeStates.Focused) == TreeNodeStates.Focused) {\r
using (SolidBrush brush = new SolidBrush(Color.Gainsboro)) {\r
e.Graphics.FillRectangle(brush, e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);\r
}\r
- using (Pen pen = new Pen(Color.Black)) {\r
- pen.Width = 1;\r
- e.Graphics.DrawLine(pen, e.Bounds.X, e.Bounds.Y + 2, e.Bounds.X, e.Bounds.Y + e.Bounds.Height - 4);\r
+ if ((e.Node.Level == 0 && !parameters.Configuration.DisableStoryCheck) ||\r
+ e.Node.Level == 1 && !parameters.Configuration.DisablePlaceHolderCheck) {\r
+ using (Pen pen = new Pen(Color.Black)) {\r
+ pen.Width = 1;\r
+ e.Graphics.DrawLine(pen, e.Bounds.X, e.Bounds.Y + 2, e.Bounds.X, e.Bounds.Y + e.Bounds.Height - 4);\r
+ }\r
}\r
}\r
TextRenderer.DrawText(e.Graphics, e.Node.Text, treeOctopus.Font, e.Bounds, treeOctopus.ForeColor, TextFormatFlags.Left | TextFormatFlags.Top);\r
//this.OnKeyDown(e);\r
if (e.KeyCode != Keys.F5)\r
return;\r
+ Refresh();\r
+ }\r
+\r
+ private void Refresh() {\r
if (String.IsNullOrEmpty(txtFilter.Text))\r
RefreshStories();\r
else\r
private void treeOctopus_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) {\r
}\r
\r
- private void treeOctopus_NodeDoubleClick(object sender, TreeNodeMouseClickEventArgs e) {\r
- if (e.X < e.Node.Bounds.X + 5)\r
+ private void OnNodeDoubleClick(object sender, TreeNodeMouseClickEventArgs e) {\r
+ if (e.X < e.Node.Bounds.X + 5 || e.Node.Level != 0)\r
return;\r
Open(e.Node);\r
}\r
return;\r
}\r
\r
- Process.Start(processor.Output);\r
+ if (!projectConfiguration.DisableOpenProject)\r
+ Process.Start(processor.Output);\r
+ if (!projectConfiguration.DisableOpenSourceFolder) {\r
+ string path = Path.GetDirectoryName(Path.GetDirectoryName(processor.Output));\r
+ Process.Start(path);\r
+ }\r
}\r
\r
-\r
+ private void noFocusCueButton1_Click(object sender, EventArgs e) {\r
+ Refresh();\r
+ }\r
}\r
\r
public class OctopusAPIMessage : IMessage {\r
}\r
}\r
\r
+ /// <summary>\r
+ /// Looks up a localized resource of type System.Drawing.Bitmap.\r
+ /// </summary>\r
+ internal static System.Drawing.Bitmap ic_refresh_black_24dp_1x {\r
+ get {\r
+ object obj = ResourceManager.GetObject("ic_refresh_black_24dp_1x", resourceCulture);\r
+ return ((System.Drawing.Bitmap)(obj));\r
+ }\r
+ }\r
+ \r
/// <summary>\r
/// Looks up a localized string similar to ID.\r
/// </summary>\r
<data name="GLOBAL_ID" xml:space="preserve">\r
<value>Global ID</value>\r
</data>\r
+ <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />\r
+ <data name="ic_refresh_black_24dp_1x" type="System.Resources.ResXFileRef, System.Windows.Forms">\r
+ <value>Resources\ic_refresh_black_24dp_1x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>\r
+ </data>\r
<data name="ID" xml:space="preserve">\r
<value>ID</value>\r
</data>\r