private void TSM_CodecsInstall_Click(object sender, EventArgs e) { OpenFileDialog fileDialog = new OpenFileDialog(); fileDialog.Filter = "DLLs (*.dll)|*.dll"; fileDialog.RestoreDirectory = true; if (fileDialog.ShowDialog() == DialogResult.OK) { try { Assembly pluginAssembly = Assembly.LoadFrom(fileDialog.FileName); CodecToolStripMenuItem codecToolStripMenuItem = null; foreach (Type t in AssemblyUtils.FindDerivedTypes(pluginAssembly, typeof(ICodecConfig))) { ICodecConfig codecConfig = (ICodecConfig)Activator.CreateInstance(t); codecToolStripMenuItem = InstallCodec(codecConfig, CheckState.Unchecked); if (codecToolStripMenuItem != null) { break; } } if (codecToolStripMenuItem == null) { MessageBox.Show("Invalid Plugin.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show("Failed to Install Plugin.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public ConfigDialog(ICodecConfig config) { _Config = config; InitializeComponent(); cbMultiPass.CheckedChanged += cbMultiPass_CheckedChanged; cbxMinorVersion.Items.Add("1"); cbxMinorVersion.Items.Add("3"); cbxMinorVersion.DropDownStyle = ComboBoxStyle.DropDownList; }
/******************/ /* CODECS SECTION */ /******************/ private CodecToolStripMenuItem InstallCodec(ICodecConfig _CodecConfig, CheckState _CheckState) { CodecToolStripMenuItem codecItem = null; if (_CodecConfig != null) { IGraphCodec graphCodec = _CodecConfig.CreateGraphCodec(); if (graphCodec != null) { codecItem = new CodecToolStripMenuItem(_CodecConfig.GetCodecName(), graphCodec); codecItem.Click += TSM_CodecSelect_Click; codecItem.CheckState = _CheckState; TSM_Codecs.DropDownItems.Add(codecItem); } } return(codecItem); }
public bool ShowConfigDialog(ICodecConfig currentConfig) { ConfigDialog dialog = new ConfigDialog(currentConfig); dialog.ShowDialog(); return dialog.Cancelled; }