git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube...
authorBellai Ádám <USER\adam.bellai>
Wed, 15 Nov 2017 14:05:20 +0000 (14:05 +0000)
committerBellai Ádám <USER\adam.bellai>
Wed, 15 Nov 2017 14:05:20 +0000 (14:05 +0000)
client/AudioRecorder/MainForm.Designer.cs
client/AudioRecorder/MainForm.cs
client/AudioRecorder/VerticalProgressBar.cs
client/AudioRecorder/WavRecorder.cs

index 784534c0c13f8844530f2894adaf4707aa6084e8..20994f0b1499b58f14ccb97808b826f83ac742fd 100644 (file)
@@ -154,6 +154,7 @@ namespace AudioRecorder {
             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
index da07f89ce6dc3951a6c75f7e2c81bd55949c0817..a645dceedd2feae4f7940cb53b702b02056ad515 100644 (file)
@@ -5,7 +5,6 @@ using System.Drawing;
 using NAudio.CoreAudioApi;\r
 using System.Windows.Forms;\r
 using System.IO;\r
-using System.Runtime.InteropServices;\r
 using System.Threading;\r
 \r
 namespace AudioRecorder {\r
@@ -13,9 +12,6 @@ namespace AudioRecorder {
 \r
     public partial class MainForm : Form, IMainForm {\r
 \r
-        [DllImport("user32.dll")]\r
-        public static extern int SendMessage(IntPtr hWnd, int wMsg, int wParam, int lParam);\r
-\r
         //private const String CONFIG_FILE = "Resources/configuration.json";\r
         private const String CONFIG_FILE = "Configuration/audiorecorder.json";\r
 \r
@@ -50,6 +46,7 @@ namespace AudioRecorder {
                     saveAudioDeviceToConfig();\r
                 timeCodeWorker = new TimeCodeWorker(timecodeLabel);\r
                 //CreatenewThreadToListenMasterPeekVolume();\r
+                \r
             }\r
             catch (Exception e) {\r
                 MessageBox.Show(e.Message, StringResources.ERROR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);\r
@@ -133,9 +130,11 @@ namespace AudioRecorder {
             try {\r
                 if (recording) {\r
                     if (volumeHeight >= settings.getLoudValue())\r
-                        SendMessage(verticalProgressBar1.Handle, 1040, 2, 0);\r
+                        //SendMessage(verticalProgressBar1.Handle, 1040, 2, 0);\r
+                        verticalProgressBar1.ForeColor = Color.Red;\r
                     else\r
-                        SendMessage(verticalProgressBar1.Handle, 1040, 1, 0);\r
+                        // SendMessage(verticalProgressBar1.Handle, 1040, 1, 0);\r
+                        verticalProgressBar1.ForeColor = Color.Green;\r
                     verticalProgressBar1.Value = (int)volumeHeight;\r
                 }\r
             } catch (Exception e) {\r
index 04ccaca7e7b647159d72fe86ad86b7ec01ccb7b6..123e71273b5209540f52053e2c22ecc83de5d0ba 100644 (file)
@@ -4,10 +4,27 @@ using System.Linq;
 using System.Text;\r
 using System.Threading.Tasks;\r
 using System.Windows.Forms;\r
+using System.Runtime.InteropServices;\r
 \r
 namespace AudioRecorder {\r
     class VerticalProgressBar : ProgressBar {\r
 \r
+        [DllImport("uxtheme.dll", CharSet = CharSet.Unicode)]\r
+        public extern static int SetWindowTheme(IntPtr hWnd, string pszSubAppName, string pszSubIdList);\r
+\r
+        public VerticalProgressBar() {\r
+            Style = ProgressBarStyle.Blocks;\r
+            \r
+        }\r
+\r
+        protected override void CreateHandle() {\r
+            base.CreateHandle();\r
+            try {\r
+                SetWindowTheme(this.Handle, "", "");\r
+            }\r
+            catch { }\r
+        }\r
+\r
         protected override CreateParams CreateParams {\r
             get {\r
                 CreateParams cp = base.CreateParams;\r
index 2bf8d48f3c344fff66a229bd491d758e13db2bb0..04cb7c18f02cc47cf598bd1b172f6a0cd97b3d74 100644 (file)
@@ -60,8 +60,6 @@ namespace AudioRecorder {
                 waveWriter.Flush();\r
                 try {\r
                     int panelHeight = (int)Math.Round(device.AudioMeterInformation.MasterPeakValue * 100);\r
-                    Debug.WriteLine(String.Format("panelHeight {0}", panelHeight));\r
-                    // int panelHeight = (int)Math.Floor(currentDevice.AudioMeterInformation.MasterPeakValue * 79);\r
                     mainForm.setPanelSizeHeight(panelHeight);\r
                 }\r
                 catch (Exception ex) {\r