From ea7dd2458f8748847d287719fceb21e09456075a Mon Sep 17 00:00:00 2001 From: moisesmcardona Date: Thu, 14 Mar 2019 20:34:15 -0400 Subject: [PATCH] Disable File button when encoding, enables when finish. --- opus_gui/Form1.Designer.vb | 22 +++++++++++----------- opus_gui/Form1.vb | 8 +++++--- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/opus_gui/Form1.Designer.vb b/opus_gui/Form1.Designer.vb index 13ebf2a..c7bff43 100644 --- a/opus_gui/Form1.Designer.vb +++ b/opus_gui/Form1.Designer.vb @@ -40,7 +40,7 @@ Partial Class Form1 Me.GroupBox1 = New System.Windows.Forms.GroupBox() Me.EncFfmpeg = New System.Windows.Forms.RadioButton() Me.EncOpusenc = New System.Windows.Forms.RadioButton() - Me.Button1 = New System.Windows.Forms.Button() + Me.InputFileBtn = New System.Windows.Forms.Button() Me.ffmpegVersionLabel = New System.Windows.Forms.Label() CType(Me.BitrateNumberBox, System.ComponentModel.ISupportInitialize).BeginInit() Me.GroupBox1.SuspendLayout() @@ -219,15 +219,15 @@ Partial Class Form1 Me.EncOpusenc.Text = "opusenc" Me.EncOpusenc.UseVisualStyleBackColor = True ' - 'Button1 + 'InputFileBtn ' - Me.Button1.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.Button1.Location = New System.Drawing.Point(392, 79) - Me.Button1.Name = "Button1" - Me.Button1.Size = New System.Drawing.Size(75, 23) - Me.Button1.TabIndex = 18 - Me.Button1.Text = "Browse File" - Me.Button1.UseVisualStyleBackColor = True + Me.InputFileBtn.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.InputFileBtn.Location = New System.Drawing.Point(392, 79) + Me.InputFileBtn.Name = "InputFileBtn" + Me.InputFileBtn.Size = New System.Drawing.Size(75, 23) + Me.InputFileBtn.TabIndex = 18 + Me.InputFileBtn.Text = "Browse File" + Me.InputFileBtn.UseVisualStyleBackColor = True ' 'ffmpegVersionLabel ' @@ -245,7 +245,7 @@ Partial Class Form1 Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(572, 322) Me.Controls.Add(Me.ffmpegVersionLabel) - Me.Controls.Add(Me.Button1) + Me.Controls.Add(Me.InputFileBtn) Me.Controls.Add(Me.GroupBox1) Me.Controls.Add(Me.enableMultithreading) Me.Controls.Add(Me.BitrateNumberBox) @@ -291,6 +291,6 @@ End Sub Friend WithEvents GroupBox1 As GroupBox Friend WithEvents EncFfmpeg As RadioButton Friend WithEvents EncOpusenc As RadioButton - Friend WithEvents Button1 As Button + Friend WithEvents InputFileBtn As Button Friend WithEvents ffmpegVersionLabel As Label End Class diff --git a/opus_gui/Form1.vb b/opus_gui/Form1.vb index ed2e4f0..15b41b7 100644 --- a/opus_gui/Form1.vb +++ b/opus_gui/Form1.vb @@ -27,6 +27,7 @@ InputTxt.Enabled = False OutputTxt.Enabled = False InputBrowseBtn.Enabled = False + InputFileBtn.Enabled = False OutputBrowseBtn.Enabled = False BitrateNumberBox.Enabled = False enableMultithreading.Enabled = False @@ -64,7 +65,7 @@ ErrorList.Add(File) End If Else - If Not String.IsNullOrEmpty(OutputTxt.Text) Then + If Not String.IsNullOrEmpty(OutputTxt.Text) Then If Not My.Computer.FileSystem.FileExists(OutputTxt.Text + "\" + My.Computer.FileSystem.GetName(File)) Then If Not IgnoreFilesWithExtensions.Contains(IO.Path.GetExtension(File)) Then My.Computer.FileSystem.CopyFile(File, OutputTxt.Text + "\" + My.Computer.FileSystem.GetName(File)) End If @@ -119,6 +120,7 @@ InputTxt.Enabled = True OutputTxt.Enabled = True InputBrowseBtn.Enabled = True + InputFileBtn.Enabled = True OutputBrowseBtn.Enabled = True End Sub) @@ -148,7 +150,7 @@ opusProcessInfo.Arguments = "--music --bitrate " & Bitrate & " """ + Input_File + """ """ + Output_File + """" Else If Not String.IsNullOrEmpty(Output_File) Then - opusProcessInfo.Arguments = "-i """ + Input_File + """ -c:a libopus -b:a " & Bitrate & "K """ + Output_File + """" + opusProcessInfo.Arguments = "-i """ + Input_File + """ -c:a libopus -application audio -b:a " & Bitrate & "K """ + Output_File + """" End If End If opusProcessInfo.WorkingDirectory = IO.Path.GetDirectoryName(Input_File) @@ -263,7 +265,7 @@ My.Settings.EncFfmpeg = EncFfmpeg.Checked End Sub - Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click + Private Sub Button1_Click(sender As Object, e As EventArgs) Handles InputFileBtn.Click Dim InputBrowser As New OpenFileDialog With { .Title = "Browse for a music file:", .FileName = ""