Beispiel #1
0
        public void InsertRecentFile(string path, string password = null)
        {
            var recentFileInfo =
                RecentFiles.FirstOrDefault(p => p.FullPath.Equals(path, StringComparison.OrdinalIgnoreCase));

            if (recentFileInfo != null)
            {
                RecentFiles.Remove(recentFileInfo);
            }
            else
            {
                recentFileInfo = new RecentFileInfo(path);
            }

            if (!string.IsNullOrEmpty(password))
            {
                recentFileInfo.ProtectedPassword = DataProtectionProvider.TryProtectPassword(password, out var securePassword) ? securePassword : null;
            }
            else
            {
                recentFileInfo.ProtectedPassword = null;
            }

            recentFileInfo.LastOpenedAt = DateTime.Now;

            RecentFiles.IsNotifying = false;
            RecentFiles.Insert(0, recentFileInfo);
            RecentFiles.IsNotifying = true;

            ReorderRecentFiles(RecentFiles);
        }
Beispiel #2
0
        public void InsertRecentFile(string path)
        {
            var recentFileInfo = RecentFiles.FirstOrDefault(p => p.FullPath.Equals(path, StringComparison.OrdinalIgnoreCase));

            if (recentFileInfo != null)
            {
                RecentFiles.Remove(recentFileInfo);
            }
            else
            {
                recentFileInfo = new RecentFileInfo(path);
            }

            recentFileInfo.LastOpenedAt = DateTime.Now;

            RecentFiles.IsNotifying = false;
            RecentFiles.Insert(0, recentFileInfo);
            RecentFiles.IsNotifying = true;

            ReorderRecentFiles(RecentFiles);
        }