public void RenameFile(string oldFilename, string newFilename, string newEntryname) { if (newFilename == null) { throw new ArgumentNullException("newFilename"); } if (newFilename.Length == 0) { throw new ArgumentException("newFilename"); } if (numEntries > 0) { int index = FindFilenameMenuIndex(oldFilename); if (index >= 0) { MruMenuItem menuItem = (MruMenuItem)MenuItems[index]; menuItem.Text = FixupEntryname(0, newEntryname); menuItem.Filename = newFilename; return; } } AddFile(newFilename, newEntryname); }
protected void OnClick(object sender, System.EventArgs e) { MruMenuItem menuItem = (MruMenuItem)sender; String fileNameCopy = (String)menuItem.Filename.Clone(); clickedHandler(menuItem.Index - StartIndex, fileNameCopy); }
public void AddFile(string filename, string entryname) { if (filename == null) { throw new ArgumentNullException("filename"); } if (filename.Length == 0) { throw new ArgumentException("filename"); } if (numEntries > 0) { int index = FindFilenameMenuIndex(filename); if (index >= 0) { SetFirstFile(index - StartIndex); return; } } if (numEntries < maxEntries) { MruMenuItem menuItem = new MruMenuItem(filename, FixupEntryname(0, entryname), new System.EventHandler(OnClick)); MenuItems.Insert(StartIndex, menuItem); SetFirstFile(menuItem); if (numEntries++ == 0) { Enable(); } else { FixupPrefixes(1); } } else if (numEntries > 1) { MruMenuItem menuItem = (MruMenuItem)MenuItems[StartIndex + numEntries - 1]; MenuItems.RemoveAt(StartIndex + numEntries - 1); menuItem.Text = FixupEntryname(0, entryname); menuItem.Filename = filename; menuItem.ToolTipText = filename; MenuItems.Insert(StartIndex, menuItem); SetFirstFile(menuItem); FixupPrefixes(1); } }
public void SetFirstFile(int number) { if (number > 0 && numEntries > 1 && number < numEntries) { MruMenuItem menuItem = (MruMenuItem)MenuItems[StartIndex + number]; MenuItems.RemoveAt(StartIndex + number); MenuItems.Insert(StartIndex, menuItem); SetFirstFile(menuItem); FixupPrefixes(0); } }
protected void OnClick(object sender, System.EventArgs e) { MruMenuItem menuItem = (MruMenuItem)sender; if (onClicked != null) { try { onClicked(menuItem.Index - StartIndex, menuItem.fileName); } catch { //TODO: should we display an error message here? } } }
protected override void SetFirstFile(MruMenuItem menuItem) { firstMenuItem = menuItem; }
protected virtual void SetFirstFile(MruMenuItem menuItem) { }
protected void OnClick(object sender, System.EventArgs e) { MruMenuItem menuItem = (MruMenuItem)sender; clickedHandler(MenuItems.IndexOf(menuItem) - StartIndex, menuItem.Filename); }
protected override void SetFirstFile(MruMenuItem menuItem) { firstMenuItem = menuItem; }
protected virtual void SetFirstFile(MruMenuItem menuItem) { }
public void AddFile(string filename, string entryname) { if (filename == null) throw new ArgumentNullException("filename"); if (filename.Length == 0) throw new ArgumentException("filename"); if (numEntries > 0) { int index = FindFilenameMenuIndex(filename); if (index >= 0) { SetFirstFile(index - StartIndex); return; } } if (numEntries < maxEntries) { MruMenuItem menuItem = new MruMenuItem(filename, FixupEntryname(0, entryname), new System.EventHandler(OnClick)); MenuItems.Insert(StartIndex, menuItem); SetFirstFile(menuItem); if (numEntries++ == 0) { Enable(); } else { FixupPrefixes(1); } } else if (numEntries > 1) { MruMenuItem menuItem = (MruMenuItem)MenuItems[StartIndex + numEntries - 1]; MenuItems.RemoveAt(StartIndex + numEntries - 1); menuItem.Text = FixupEntryname(0, entryname); menuItem.Filename = filename; MenuItems.Insert(StartIndex, menuItem); SetFirstFile(menuItem); FixupPrefixes(1); } }
private async void _projectMru_MruItemSelected(object sender, MruMenuItem e) { await Controller.OpenProjectAsync(e.FileName); }
private async void _sessionMru_MruItemSelected(object sender, MruMenuItem e) { await Controller.OpenSessionAsync(e.FileName); }