Beispiel #1
0
        private void FrmMain_Load(object sender, EventArgs e)
        {
            if (FileShellExtension.ContextMenuExists(".mkv", "DownloadSubtitle"))
            {
                chkContextMenu.Checked = true;
            }

            txtQuery.Text = FileName;
        }
Beispiel #2
0
        private void chkContextMenu_CheckedChanged(object sender, EventArgs e)
        {
            var menuDescription = "Download subtitle";
            var menuCommand     = string.Format("\"{0}\" \"%L\"", Application.ExecutablePath);
            var menuName        = "DownloadSubtitle";
            var extensions      = new string[] { ".mkv", ".webm", ".flv", ".mp4", ".avi" };

            if (chkContextMenu.Checked)
            {
                chkContextMenu.Text = "Remove from context menu";
                foreach (var extension in extensions)
                {
                    FileShellExtension.AddContextMenuItem(extension, menuName, menuDescription, menuCommand);
                }
            }
            else
            {
                chkContextMenu.Text = "Add to context menu";
                foreach (var extension in extensions)
                {
                    FileShellExtension.RemoveContextMenuItem(extension, menuName);
                }
            }
        }