예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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();
        }
예제 #4
0
        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);
        }
예제 #5
0
        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();
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
            }
        }
예제 #8
0
 public RecentItemModel(string FilePath, RecentItemType ItemType, string DeleteHash)
 {
     this.FilePath   = FilePath;
     this.ItemType   = ItemType;
     this.DeleteHash = DeleteHash;
 }
예제 #9
0
 public RecentItemModel(string FilePath, RecentItemType ItemType)
 {
     this.FilePath = FilePath;
     this.ItemType = ItemType;
 }