protected override bool CanShowMenu() { return(Helios.IsInstalled && SelectedItemPaths.Count() == 1 && Profile.GetAllProfiles().Any() && ParseSteamAppId() > 0); }
protected override System.Windows.Forms.ContextMenuStrip CreateMenu() { //yeni bir menu oluştur var menu = new ContextMenuStrip(); itemBaglanti = new ToolStripMenuItem { Text = "Secilenleri Say", }; itemBaglanti.Click += (s1, e1) => { StringBuilder sb = new StringBuilder(); foreach (var f in SelectedItemPaths) { sb.AppendLine(System.IO.Path.GetFileName(f));//dosya isimlerini ekle } sb.AppendLine("-------------------------"); sb.AppendLine(SelectedItemPaths.Count() + " tane dosya seçildi"); MessageBox.Show(sb.ToString()); }; var item2 = new ToolStripMenuItem("Test2Yeahh"); item2.Click += (s2, e2) => { MessageBox.Show("selamm"); }; item2.MouseHover += (s3, e3) => { MessageBox.Show("common"); }; menu.Items.Add(itemBaglanti);//baglatiyi ekle menu.Items.Add(item2); return(menu); }
protected override bool CanShowMenu() { if (SelectedItemPaths.Count() < 1) { return(false); } selectedVersionableFiles.Clear(); foreach (string selectedItemPath in SelectedItemPaths) { FileAttributes attr = File.GetAttributes(selectedItemPath); if ((attr & FileAttributes.Directory) == FileAttributes.Directory) { continue; } selectedVersionableFiles.Add(selectedItemPath); } if (selectedVersionableFiles.Count < 1) { return(false); } return(true); }
protected override bool CanShowMenu() { return(Helios.IsInstalled && SelectedItemPaths.Count() == 1 && Profile.GetAllProfiles().Any() && Path.GetExtension(SelectedItemPaths.First())?.ToLower() == @".exe"); }
protected override bool CanShowMenu() { if (SelectedItemPaths.Count() != 1) { return(false); } return(isGitDir(SelectedItemPaths.First()) || isSvnDir(SelectedItemPaths.First())); }
protected override bool CanShowMenu() { if (SelectedItemPaths.Count() >= 1) { this.UpdateMenu(); return(true); } return(false); }
private void OnEnlargeImage(object sender, EventArgs args) { Logger.NewLog += Logging.Log; Logger.Log($"Found {SelectedItemPaths.Count()} images to enlarge"); foreach (var path in SelectedItemPaths) { CreateEnlargeJob.CreateLargeImageJob(path); } }
/// <summary> /// 是否显示上下文菜单 /// </summary> /// <returns></returns> protected override bool CanShowMenu() { if (SelectedItemPaths.Count() == 1 && File.Exists(SelectedItemPaths.First())) { return(true); } else { return(false); } }
protected override bool CanShowMenu() { if (SelectedItemPaths.Count() == 1 && IsGitDirectory(SelectedItemPaths.First()))//选中一个目录时构建菜单并显示 { this.UpdateMenu(); return(true); } else { return(false); } }
protected override bool CanShowMenu() { if (SelectedItemPaths.Count() != 1) { return(false); } string path = SelectedItemPaths.First(); return(File.Exists(path + "\\CMakeLists.txt") || File.Exists(path + "\\CMakeCache.txt") || Control.ModifierKeys == Keys.Shift); }
protected override bool CanShowMenu() { // Only show the menu when application is installed, there is just one executable // file selected and some network interface to select from return(SelectedItemPaths.Count() == 1 && Path.GetExtension(SelectedItemPaths.First())?.ToLower() == ".exe" && !string.IsNullOrWhiteSpace(GetNetworkAdapterSelectorAddress()) && NetworkInterface.GetAllNetworkInterfaces() .Any(networkInterface => networkInterface.SupportsMulticast && networkInterface.OperationalStatus == OperationalStatus.Up)); }
/// <summary> /// Determines whether the menu item can be shown for the selected item. /// </summary> /// <returns> /// <c>true</c> if item can be shown for the selected item for this instance.; /// otherwise, <c>false</c>. /// </returns> protected override bool CanShowMenu() { // We can show the item only for a single selection. if (SelectedItemPaths.Count() == 1) { this.UpdateMenu(); return(true); } else { return(false); } }
private void ZipFile(bool encrypt) { try { if (SelectedItemPaths.Count() == 0) { return; } string destination = this.GetZipFileNamePath(SelectedItemPaths.First()); var window = new Compressor(destination, encrypt, SelectedItemPaths.ToArray()); window.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message, "ZipMagikLITE: Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
protected override bool CanShowMenu() { try { if (SelectedItemPaths.Count() != 1) { return(false); } var client = Novaroma.Helper.CreateShellServiceClient(TimeSpan.FromMilliseconds(50)); client.Test(); return(true); } catch { return(false); } }
private ToolStripItem[] GetFileMenu() { if (SelectedItemPaths.Count() > 1) { var mItems = new List <ToolStripItem> { new ToolStripMenuItem("Download Files", null, FileDownload), new ToolStripMenuItem("Remove local contents", null, FileRemove), new ToolStripMenuItem("Upload files", null, FileUpload) }; return(mItems.ToArray()); } if (SelectedItemPaths.Count() == 1) { var mItems = new List <ToolStripItem>(); var file = SelectedItemPaths.First(); if (_fileStatus[file] == FileStatus.Directory) { mItems.Add(new ToolStripMenuItem("Download Files", null, FileDownload)); mItems.Add(new ToolStripMenuItem("Remove local contents", null, FileRemove)); mItems.Add(new ToolStripMenuItem("Upload files", null, FileUpload)); } if (_fileStatus[file] == FileStatus.InAnnex || _fileStatus[file] == FileStatus.InAnnexModified) { mItems.Add(new ToolStripMenuItem("Download File", null, FileDownload)); } if (_fileStatus[file] == FileStatus.OnDiskModified || _fileStatus[file] == FileStatus.Unknown) { mItems.Add(new ToolStripMenuItem("Upload file", null, FileUpload)); } if (_fileStatus[file] == FileStatus.OnDisk) { mItems.Add(new ToolStripMenuItem("Remove local content", null, FileRemove)); mItems.Add(new ToolStripMenuItem("Get older version", null, FileHistory)); } return(mItems.ToArray()); } return(new ToolStripItem[0]); }
// <summary> // Determines whether the menu item can be shown for the selected item. // </summary> // <returns> // <c>true</c> if item can be shown for the selected item for this instance.; // otherwise, <c>false</c>. // </returns> protected override bool CanShowMenu() { // We can show the item only for a single selection. // Make it only show for J, K and L mapped drives. var MappedDriveCheck = SelectedItemPaths.First().ToString().Substring(0, 1); if (SelectedItemPaths.Count() == 1 && (MappedDriveCheck == "J" || MappedDriveCheck == "K" || MappedDriveCheck == "L")) // if (SelectedItemPaths.Count() == 1) { this.UpdateMenu(); return(true); } else { return(false); } }
/// <summary> /// The click event for the Gist File Item. /// </summary> /// <param name="sender">The ToolStripMenuItem that triggered the event</param> /// <param name="e">The event arguments</param> protected void DownloadGist(object sender, EventArgs e) { var item = (ToolStripMenuItem)sender; var url = item.Tag.ToString(); var fileContents = GetGist(url); if (fileContents == null) { MessageBox.Show("There was an un-expected error while retrieving your file...", "WinGitter", MessageBoxButtons.OK, MessageBoxIcon.Error); } string selectedPath; if (SelectedItemPaths.Count() > 0) { selectedPath = SelectedItemPaths.First(); } else { selectedPath = this.FolderPath; } FileAttributes attr = File.GetAttributes(selectedPath); if (attr.HasFlag(FileAttributes.Directory)) { // DOES FILE ALREADY EXIST? var filePath = Path.Combine(selectedPath, item.Text); if (File.Exists(filePath)) { DialogResult dialogResult = MessageBox.Show("Would you like to overwrite the existing file?", "WinGitter", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.No) { return; } } File.WriteAllText(filePath, fileContents); } else { MessageBox.Show("Unexpected bahavior...", "WinGitter", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void UnZipFiles() { try { if (SelectedItemPaths.Count() == 0) { return; } string[] aFilePath = SelectedItemPaths.First().Split('.'); string destinationFolder = string.Join(".", aFilePath.Take(aFilePath.Length - 1)); var window = new Compressor(destinationFolder, SelectedItemPaths.First()); window.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message, "ZipMagikLITE: Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void ProcessFiles(EncryptionMode mode) { try { string space = " "; StringBuilder sb = new StringBuilder(); sb.Append(mode); sb.Append(space); if (SelectedItemPaths.Count() > 0) { foreach (string file in SelectedItemPaths) { sb.Append("\""); sb.Append(file); sb.Append("\""); sb.Append(space); } } else { // if no file selected (user right-click in the foler background), add the folder sb.Append("\""); sb.Append(FolderPath); sb.Append("\""); } string dllPath = new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath; string appFullPath = Path.GetDirectoryName(dllPath) + APP_EXE; ProcessStartInfo startInfo = new ProcessStartInfo { FileName = appFullPath, Arguments = sb.ToString(), UseShellExecute = false }; Process.Start(startInfo); } catch (Exception ex) { MessageBox.Show(ex.Message, caption: "PanMi"); } }
/// <summary> /// Decide which menu items to display /// </summary> /// <returns>1: encrypt menu item; 2: decrypt items; 3: both encrypt/decrypt menu items</returns> private int GetMenuOption() { // user right-clicked on the current folder background, so no file was selected. In this case, user can // either encrypt or decrypt all files in current folder if (SelectedItemPaths.Count() == 0) { return(3); } int mode = 0; foreach (string file in SelectedItemPaths) { // when one or more folders were selected, user can either encrypt or decrypt all files in the selected folder(s) FileAttributes attr = File.GetAttributes(file); if (attr.HasFlag(FileAttributes.Directory)) { mode = 3; break; } string fileExt = Path.GetExtension(file); if (String.Compare(fileExt, ".pxx", StringComparison.CurrentCultureIgnoreCase) == 0) { mode |= 2; } else { mode |= 1; } if (mode == 3) { break; } } return(mode); }
/// <summary> /// Determines whether this instance can a shell context show menu, given the specified selected file list. /// </summary> /// <returns> /// <c>true</c> if this instance should show a shell context menu for the specified file list; otherwise, <c>false</c>. /// </returns> protected override bool CanShowMenu() { // We will support the dll extension only if we have one file, and it is a dll. return(SelectedItemPaths.Count() == 1 && Path.GetExtension(SelectedItemPaths.First()).ToLower() == ".dll"); }
protected override ContextMenuStrip CreateMenu() { CreateBitmapsForMenuItems(); int mode = GetMenuOption(); ToolStripMenuItem mainMenu = new ToolStripMenuItem { Text = APP_NAME, Image = Properties.Resources.panda24, // _bmpMainMenu, ImageScaling = ToolStripItemImageScaling.SizeToFit, }; if ((mode & 2) == 2) { var subMenu1 = new ToolStripMenuItem { Text = "Open", Image = _bmpOpen, ImageScaling = ToolStripItemImageScaling.SizeToFit, Enabled = false }; subMenu1.Click += (sender, args) => ProcessFiles(EncryptionMode.Open); if (SelectedItemPaths.Count() == 1) { FileAttributes attr = File.GetAttributes(SelectedItemPaths.First()); if (!attr.HasFlag(FileAttributes.Directory)) { subMenu1.Enabled = true; } } mainMenu.DropDownItems.Add(subMenu1); var subMenu2 = new ToolStripMenuItem { Text = "Decrypt", Image = _bmpUnlock, ImageScaling = ToolStripItemImageScaling.SizeToFit }; subMenu2.Click += (sender, args) => ProcessFiles(EncryptionMode.Decrypt); mainMenu.DropDownItems.Add(subMenu2); } if ((mode & 1) == 1) { var subMenu1 = new ToolStripMenuItem { Text = "Encrypt", Image = _bmpLock, ImageScaling = ToolStripItemImageScaling.SizeToFit }; subMenu1.Click += (sender, args) => ProcessFiles(EncryptionMode.Encrypt); mainMenu.DropDownItems.Add(subMenu1); } if (mode != 0) { mainMenu.DropDownItems.Add(new ToolStripSeparator()); } var subMenu4 = new ToolStripMenuItem { Text = "Create Key File", Image = _bmpKeyFile, ImageScaling = ToolStripItemImageScaling.SizeToFit }; subMenu4.Click += (sender, args) => CreateKeyFile(); mainMenu.DropDownItems.Add(subMenu4); mainMenu.DropDownItems.Add(new ToolStripSeparator()); var subMenu5 = new ToolStripMenuItem { Text = "About " + APP_NAME, Image = _bmpAbout, ImageScaling = ToolStripItemImageScaling.SizeToFit }; subMenu5.Click += (sender, args) => ShowAbout(); mainMenu.DropDownItems.Add(subMenu5); _menu.Items.Clear(); _menu.Items.Add(mainMenu); return(_menu); }
protected override ContextMenuStrip CreateMenu() { var menu = new ContextMenuStrip(); var menuRoot = new ToolStripMenuItem { Text = Constants.Novaroma, Image = Resources.Img_Logo_16x16 }; var client = Novaroma.Helper.CreateShellServiceClient(); Helper.SetCulture(client); if (SelectedItemPaths.Count() == 1) { var singleSelection = SelectedItemPaths.First(); var media = client.GetMedia(singleSelection).Result; var movie = media as Movie; if (movie != null) { var updateWatchStatus = new ToolStripMenuItem { Text = Resources.IsWatched, Image = Resources.Img_Watch_16x16, Checked = movie.IsWatched }; updateWatchStatus.Click += (sender, args) => UpdateWatchStatus(singleSelection, !movie.IsWatched); menuRoot.DropDownItems.Add(updateWatchStatus); var download = new ToolStripMenuItem { Text = Resources.Download, Image = Resources.Img_Download_16x16 }; download.Click += (sender, args) => Download(singleSelection); menuRoot.DropDownItems.Add(download); if (!string.IsNullOrEmpty(movie.FilePath) && File.Exists(movie.FilePath)) { var downloadSubtitle = new ToolStripMenuItem { Text = Resources.DownloadSubtitle, Image = Resources.Img_DownloadSubtitle_16x16 }; downloadSubtitle.Click += (sender, args) => DownloadSubtitle(singleSelection); menuRoot.DropDownItems.Add(downloadSubtitle); } } else { if (media != null) { var editMedia = new ToolStripMenuItem { Text = Resources.Edit, Image = Resources.Img_Edit_16x16 }; editMedia.Click += (sender, args) => EditMedia(singleSelection); menuRoot.DropDownItems.Add(editMedia); } var dirStatus = client.GetDirectoryWatchStatus(singleSelection).Result; if (media == null) { if (dirStatus != DirectoryWatchStatus.Direct) { var addMedia = new ToolStripMenuItem { Text = Resources.Add, Image = Resources.Img_AddMedia_16x16 }; addMedia.Click += (sender, args) => AddMedia(SelectedItemPaths); menuRoot.DropDownItems.Add(addMedia); } var newMedia = new ToolStripMenuItem { Text = Resources.New, Image = Resources.Img_NewMedia_16x16 }; newMedia.Click += (sender, args) => NewMedia(singleSelection); menuRoot.DropDownItems.Add(newMedia); } if (dirStatus == DirectoryWatchStatus.None) { if (Directory.GetDirectories(singleSelection).Any()) { var watchDirectory = new ToolStripMenuItem { Text = Resources.AddSubdirectories, Image = Resources.Img_AddSubdirectories_16x16 }; watchDirectory.Click += (sender, args) => WatchDirectory(singleSelection); menuRoot.DropDownItems.Add(watchDirectory); } } } } else { var addMedia = new ToolStripMenuItem { Text = Resources.Add, Image = Resources.Img_AddMedia_16x16 }; addMedia.Click += (sender, args) => AddMedia(SelectedItemPaths); menuRoot.DropDownItems.Add(addMedia); } if (menuRoot.HasDropDownItems) { menu.Items.Add(menuRoot); } return(menu); }
/// <summary> /// Configures the shell extension menu and sets on click events /// </summary> /// <param name="menu">The menu.</param> /// <exception cref="System.Exception">Unable to setup cntent menu : + creationError.Message</exception> private void ConfigureShellExtension(ContextMenuStrip menu) // throws Exception[ { /* Create content menu */ try { try { var cloudcopyandpaste = new ToolStripMenuItem { Text = "Cloud copy/paste" }; cloudcopyandpaste.Image = Images.cloud16; menu.Items.Add(cloudcopyandpaste); var cloudclipboard = new ToolStripMenuItem { Text = "Clipboard" }; cloudclipboard.Image = Images.clipboard_empty; if (CommonFunctionality.processIsRunning("ClipboardMonitor")) { CommonFunctionality.Instance.logger.LogIt("Found ClipboardMonitor, using it..."); isUsingClipboardMonitor = true; } else { // first give the user the ability to manually copy the clkipboard contents... var cloudClipboardCopyMenuItem = new ToolStripMenuItem { Text = "Clipboard copy" }; cloudClipboardCopyMenuItem.Image = Images.clipboard_copy; cloudclipboard.DropDownItems.Add(cloudClipboardCopyMenuItem); cloudClipboardCopyMenuItem.Click += (sender, args) => CloudClipboardCopy(); isUsingClipboardMonitor = false; } var cloudClipboardPasteMenuItem = new ToolStripMenuItem { Text = "Clipboard paste" }; cloudClipboardPasteMenuItem.Image = Images.clipboard_paste; var cloudfilestorage = new ToolStripMenuItem { Text = "File" }; cloudfilestorage.Image = Images.file; var cloudCopyMenuItem = new ToolStripMenuItem { Text = "File copy" }; cloudCopyMenuItem.Image = Images.clipboard_copy; var cloudPasteMenuItem = new ToolStripMenuItem { Text = "File paste" }; cloudPasteMenuItem.Image = Images.clipboard_paste; PopulateDynamicMenuItems(cloudPasteMenuItem, cloudClipboardPasteMenuItem); /* Setup event handlers for the various options in the content menu. */ cloudCopyMenuItem.Click += (sender, args) => CloudCopyItem(); bool click_on_empty_space = SelectedItemPaths.Count<string>() > 0; // If we clicked on background of folder? // Finally add the menu items to the context menu. if (click_on_empty_space) // can only copy selected items cloudfilestorage.DropDownItems.Add(cloudCopyMenuItem); if (cloudClipboardPasteMenuItem.DropDownItems.Count > 0) cloudclipboard.DropDownItems.Add(cloudClipboardPasteMenuItem); if (cloudPasteMenuItem.DropDownItems.Count > 0) cloudfilestorage.DropDownItems.Add(cloudPasteMenuItem); cloudcopyandpaste.DropDownItems.Add(cloudclipboard); cloudcopyandpaste.DropDownItems.Add(cloudfilestorage); } catch (System.Net.WebException webex) { throw new System.Net.WebException("Problem configuring the shell extension:" + webex.Message); } catch (Exception) { // last ditch effort is to reauthenticate CommonFunctionality.Instance.Authenticate(true); ConfigureShellExtension(menu); } } catch (Exception creationError) { // throw it up higher throw new Exception( "Unable to setup cloud copy and paste shell extension menu : " + creationError.Message, creationError); } }
/// <summary> /// Determines whether this instance can a shell context show menu, given the specified selected file list. /// </summary> /// <returns> /// <c>true</c> if this instance should show a shell context menu for the specified file list; otherwise, <c>false</c>. /// </returns> protected override bool CanShowMenu() { // We can show the item only for a single selection. return(SelectedItemPaths.Count() == 1); }
/// <summary> /// Determines whether this instance can show a shell property sheet, given the specified selected file list. /// </summary> /// <returns> /// <c>true</c> if this instance should show a shell property sheet for the specified file list; otherwise, <c>false</c>. /// </returns> protected override bool CanShowSheet() { // We can show the properties only if we have a single text file selected. return(SelectedItemPaths.Count() == 1); }
/// <summary> /// Determines whether this instance can show a shell property sheet, given the specified selected file list. /// </summary> /// <returns> /// <c>true</c> if this instance should show a shell property sheet for the specified file list; otherwise, <c>false</c>. /// </returns> protected override bool CanShowSheet() { // We will only show the resources pages if we have ONE file selected. return(SelectedItemPaths.Count() == 1); }
protected override bool CanShowMenu() => SelectedItemPaths.Count() == 1 && File.Exists(SelectedItemPaths.Single());
protected override bool CanShowMenu() { return(SelectedItemPaths.Count() > 0); }
protected override bool CanShowSheet() { return(SelectedItemPaths.Count() == 1); }