public MainForm() { CheckForIllegalCrossThreadCalls = false; InitializeComponent(); PreviewUI.Init(previewImg, model1TreeBtn, model2TreeBtn, imageOutputFormat, prevOverwriteCombox); BatchUpscaleUI.Init(batchOutDir, batchFileList, batchDirLabel); VideoUpscaleUI.Init(videoOutDir, videoLogBox, videoPathLabel, videoOutputFormat); Program.mainForm = this; WindowState = FormWindowState.Maximized; }
private async void upscaleBtn_Click(object sender, EventArgs e) { if (Program.busy) { return; } if (!PreviewUI.HasValidModelSelection()) { Program.ShowMessage("Invalid model selection.\nMake sure you have selected a model and that the file still exists.", "Error"); return; } bool useNcnn = (Config.Get("cudaFallback").GetInt() == 2 || Config.Get("cudaFallback").GetInt() == 3); if (useNcnn && !Program.mainForm.HasValidNcnnModelSelection()) { Program.ShowMessage("Invalid model selection - NCNN does not support interpolation or chaining.", "Error"); return; } if (Config.GetBool("reloadImageBeforeUpscale")) { ReloadImage(); } UpdateResizeMode(); Program.lastUpscaleIsVideo = htTabControl.SelectedIndex == 2; if (htTabControl.SelectedIndex == 0) { await PreviewUI.UpscaleImage(); } if (htTabControl.SelectedIndex == 1) { await BatchUpscaleUI.Run(preprocessMode.SelectedIndex == 0, true, batchCacheSplitDepth.SelectedIndex == 1); } if (htTabControl.SelectedIndex == 2) { await VideoUpscaleUI.Run(videoPreprocessMode.SelectedIndex == 0); } }
private void htTabControl_SelectedIndexChanged(object sender, EventArgs e) { if (Program.busy) { htTabControl.SelectedIndex = lastTabIndex; return; } lastTabIndex = htTabControl.SelectedIndex; videoOutputFormat.Visible = false; if (htTabControl.SelectedIndex == 0) { PreviewUI.TabSelected(); } if (htTabControl.SelectedIndex == 1) { BatchUpscaleUI.TabSelected(); } if (htTabControl.SelectedIndex == 2) { VideoUpscaleUI.TabSelected(); videoOutputFormat.Visible = true; } }
private void videoTab_DragDrop(object sender, DragEventArgs e) { string[] files = e.Data.GetData(DataFormats.FileDrop) as string[]; VideoUpscaleUI.LoadFile(files[0]); }