public static void Add(string FileName, RecentItemType Type) { var I = new RecentItem(FileName); if (Type == RecentItemType.Image) I.PrintButton.Visibility = Visibility.Visible; I.Remove += () => _RecentList.Remove(I); _RecentList.Add(I); }
public RecentItemViewModel Add(string FilePath, RecentItemType ItemType, bool IsSaving) { var item = new RecentItemViewModel(FilePath, ItemType, IsSaving); // Insert on Top _recentList.Insert(0, item); item.OnRemove += () => _recentList.Remove(item); return(item); }
public RecentItemViewModel(string FilePath, RecentItemType ItemType, bool IsSaving) { this.FilePath = FilePath; Display = ItemType == RecentItemType.Link ? FilePath : Path.GetFileName(FilePath); this.IsSaving = IsSaving; this.ItemType = ItemType; InitCommands(); }
public static void Add(string FileName, RecentItemType Type) { var I = new RecentItem(FileName); if (Type == RecentItemType.Image) { I.PrintButton.Visibility = Visibility.Visible; } I.Remove += () => _RecentList.Remove(I); _RecentList.Add(I); }
public void Add(string FileName, RecentItemType Type) { var I = new RecentItem(FileName); // Show Print Command for Images if (Type == RecentItemType.Image) { I.PrintButton.Visibility = Visibility.Visible; } I.Remove += () => RecentList.Remove(I); // Insert on top RecentList.Insert(0, I); // Refresh the Enabled state of RecentItems CommandManager.InvalidateRequerySuggested(); }
public RecentItemViewModel(string FilePath, RecentItemType ItemType, bool IsSaving) { this.FilePath = FilePath; FileName = Path.GetFileName(FilePath); this.IsSaving = IsSaving; this.ItemType = ItemType; RemoveCommand = new DelegateCommand(() => OnRemove?.Invoke(), !IsSaving); OpenCommand = new DelegateCommand(() => { ServiceProvider.LaunchFile(new ProcessStartInfo(FilePath)); }, !IsSaving); PrintCommand = new DelegateCommand(() => { ServiceProvider.LaunchFile(new ProcessStartInfo(FilePath) { Verb = "Print" }); }, CanPrint); DeleteCommand = new DelegateCommand(() => { if (!ServiceProvider.Messenger.ShowYesNo($"Are you sure you want to Delete: {FileName}?", "Confirm Deletion")) { return; } try { File.Delete(FilePath); // Remove from List OnRemove?.Invoke(); } catch (Exception E) { ServiceProvider.Messenger.ShowError($"Could not Delete file: {FilePath}\n\n\n{E}"); } }, !IsSaving); }
public static ImageMoniker ToImageMoniker(this RecentItemType itemType) { switch (itemType) { case RecentItemType.Unknown: return(KnownMonikers.QuestionMark); case RecentItemType.Folder: return(KnownMonikers.FolderOpened); case RecentItemType.Solution: return(KnownMonikers.Solution); case RecentItemType.CsProject: return(KnownMonikers.CSProjectNode); default: return(KnownMonikers.QuestionMark); } }
public RecentItemModel(string FilePath, RecentItemType ItemType, string DeleteHash) { this.FilePath = FilePath; this.ItemType = ItemType; this.DeleteHash = DeleteHash; }
public RecentItemModel(string FilePath, RecentItemType ItemType) { this.FilePath = FilePath; this.ItemType = ItemType; }