function showMix($owner) { $form = New-Object System.Windows.Forms.Form $form.Owner = $owner $form.icon = $icon $form.Text = "Mezclar" $form.Width = 445 $form.Height = 345 $form.AutoSize = $true $form.StartPosition = [System.Windows.Forms.FormStartPosition]::CenterParent $form.Font = "Microsoft Sans Serif, 9.35" $form.FormBorderStyle = 'FixedDialog' $label_image = New-Object System.Windows.Forms.Label $label_image.Text = "Imagen:" $label_image.AutoSize = $true $label_image.Location = New-Object System.Drawing.Point(20, 23) $text_image = New-Object System.Windows.Forms.TextBox $text_image.Text = $sel_image $text_image.Width = 245 $text_image.Location = New-Object System.Drawing.Point(85, 20) $text_image.add_DoubleClick({ $text_image.SelectAll(); }) $btn_image = New-Object System.Windows.Forms.Button $btn_image.Text = "Examinar" $btn_image.AutoSize = $true $btn_image.Location = New-Object System.Drawing.Point(335, 18) $btn_image.Add_Click({ $res = selectFile -path "" -formats "Imagenes y Videos (*.*)|*.*" if ($null -ne $res) { $text_image.Text = $res } }) $label_audio = New-Object System.Windows.Forms.Label $label_audio.Text = "Sonido:" $label_audio.AutoSize = $true $label_audio.Location = New-Object System.Drawing.Point(20, 58) $text_audio = New-Object System.Windows.Forms.TextBox $text_audio.Text = $sel_audio $text_audio.Width = 245 $text_audio.Location = New-Object System.Drawing.Point(85, 55) $text_audio.add_DoubleClick({ $text_audio.SelectAll(); }) $btn_audio = New-Object System.Windows.Forms.Button $btn_audio.Text = "Examinar" $btn_audio.AutoSize = $true $btn_audio.Location = New-Object System.Drawing.Point(335, 53) $btn_audio.Add_Click({ $res = selectFile -path "" -formats "Audios (*.*)|*.*" if ($null -ne $res) { $text_audio.Text = $res } }) $label_subs = New-Object System.Windows.Forms.Label $label_subs.Text = "Subtítulos:" $label_subs.AutoSize = $true $label_subs.Location = New-Object System.Drawing.Point(20, 93) $text_subs = New-Object System.Windows.Forms.TextBox $text_subs.Text = $sel_audio $text_subs.Width = 245 $text_subs.Location = New-Object System.Drawing.Point(85, 90) $text_subs.add_DoubleClick({ $text_subs.SelectAll(); }) $btn_subs = New-Object System.Windows.Forms.Button $btn_subs.Text = "Examinar" $btn_subs.AutoSize = $true $btn_subs.Location = New-Object System.Drawing.Point(335, 88) $btn_subs.Add_Click({ $res = selectFile -path "" -formats "Subtitulos (*.*)|*.*" if ($null -ne $res) { $text_subs.Text = $res $radio_burn.Enabled = $true $radio_attach.Enabled = $true } }) $radio_group = New-Object System.Windows.Forms.Panel $radio_group.Location = '85,119' $radio_group.Width = 325 $radio_group.Height = 25 # $radio_group.text = "Imagen" $form.Controls.Add($radio_group) $radio_burn = New-Object System.Windows.Forms.RadioButton $radio_burn.Location = '2,5' $radio_burn.AutoSize = $true $radio_burn.Checked = $true $radio_burn.Enabled = $false $radio_burn.Text = "Incrustados" $radio_attach = New-Object System.Windows.Forms.RadioButton $radio_attach.Location = '100,5' $radio_attach.AutoSize = $true $radio_attach.Checked = $false $radio_attach.Enabled = $false $radio_attach.Text = "Adjuntos" $radio_group.Controls.AddRange(@($radio_burn, $radio_attach)) $label_dest = New-Object System.Windows.Forms.Label $label_dest.Text = "Destino:" $label_dest.AutoSize = $true $label_dest.Location = New-Object System.Drawing.Point(20, 160) $text_dest = New-Object System.Windows.Forms.TextBox $text_dest.Text = $def_dest_dir $text_dest.Width = 245 $text_dest.Location = New-Object System.Drawing.Point(85, 157) $text_dest.add_DoubleClick({ $text_dest.SelectAll(); }) $btn_dest = New-Object System.Windows.Forms.Button $btn_dest.Text = "Examinar" $btn_dest.AutoSize = $true $btn_dest.Location = New-Object System.Drawing.Point(335, 155) $btn_dest.Add_Click({ $dest = selectFolder -path $def_dest_dir if ($dest) { $text_dest.Text = $dest } }) $label_name = New-Object System.Windows.Forms.Label $label_name.Text = "Nombre:" $label_name.AutoSize = $true $label_name.Location = New-Object System.Drawing.Point(20, 195) $text_name = New-Object System.Windows.Forms.TextBox $text_name.Text = "Mezcla - $(Get-Date -Format "yyyy-MM-dd HH.mm")" $text_name.Width = 323 $text_name.Location = New-Object System.Drawing.Point(85, 193) $text_name.add_TextChanged({ removeInvalidChars -textbox $text_name }) $text_name.add_DoubleClick({ $text_name.SelectAll(); }) $text_name.Add_KeyDown({ if ($_.KeyCode -eq "Enter") { $btn_exec.PerformClick() } }) $check_encode = New-Object System.Windows.Forms.Checkbox $check_encode.Location = New-Object System.Drawing.Point(85, 227) $check_encode.AutoSize = $true $check_encode.Text = "Recodificar" $check_encode.Checked = $true $check_encode.Enabled = $false $form.Controls.Add($check_encode) $btn_exec = New-Object System.Windows.Forms.Button $btn_exec.Text = "Mezclar" $btn_exec.Location = New-Object System.Drawing.Point(140, 260) $btn_exec.Width = 150 $btn_exec.Height = 30 $btn_exec.Add_Click({ try { $prevCode = startAlwaysOn $subs_mode = "" if ($radio_burn.Checked) { $subs_mode = "burn" } elseif ($radio_attach.Checked) { $subs_mode = "attach" } mix -image $text_image.Text -audio $text_audio.Text -subs $text_subs.Text -subs_mode $subs_mode -out "$($text_dest.Text)\$($text_name.Text)" -encode $check_encode.Checked } finally { endAlwaysOn -code $prevCode } }) $form.Controls.Add($label_image) $form.Controls.Add($text_image) $form.Controls.Add($btn_image) $form.Controls.Add($label_audio) $form.Controls.Add($text_audio) $form.Controls.Add($btn_audio) $form.Controls.Add($label_subs) $form.Controls.Add($text_subs) $form.Controls.Add($btn_subs) $form.Controls.Add($label_dest) $form.Controls.Add($text_dest) $form.Controls.Add($btn_dest) $form.Controls.Add($label_name) $form.Controls.Add($text_name) $form.Controls.Add($btn_exec) $text_image.Select() $form.Add_Closing({ $owner.Location = getRelativeLocation -parent $owner -child $form $form.Hide() $owner.Show() }) [PSAppID]::SetAppIdForWindow($form.handle, "$($metadata.package).$app_name") $form.Add_LocationChanged({ $global:win_loc = $form.Location }) $form.Add_Resize({ $global:win_size = $form.Size }) $form.MaximizeBox = $false $form.ShowDialog() }