コード例 #1
0
        private void Backstage_PopulateRecentFiles()
        {
            List <string> paths = RecentFiles.GetFileNames();

            dpRecentFiles.Children.Clear();
            foreach (string path in paths)
            {
                try {
                    RecentFileButton button = new RecentFileButton {
                        DirPath   = Path.GetDirectoryName(path),
                        FileName  = Path.GetFileName(path),
                        IsEnabled = File.Exists(path),
                        Tag       = path,
                        ToolTip   = path
                    };
                    DockPanel.SetDock(button, Dock.Top);

                    dpRecentFiles.Children.Add(button);
                }
                catch (ArgumentException) {
                    RecentFiles.Remove(path);
                }
                catch (PathTooLongException) {
                    RecentFiles.Remove(path);
                }
            }
        }
コード例 #2
0
        private void Backstage_PopulateRecentFiles()
        {
            dpRecentFiles.Children.Clear();
            foreach (string recentFile in recentFiles.GetMaxItems(programSettings.RecentFilesMax))
            {
                try {
                    RecentFileButton button = new RecentFileButton {
                        DirPath   = Path.GetDirectoryName(recentFile),
                        FileName  = Path.GetFileName(recentFile),
                        IsEnabled = File.Exists(recentFile),
                        Tag       = recentFile,
                        ToolTip   = recentFile
                    };
                    DockPanel.SetDock(button, Dock.Top);

                    dpRecentFiles.Children.Add(button);
                }
                catch (ArgumentException) {
                    recentFiles.Remove(recentFile);
                }
                catch (PathTooLongException) {
                    recentFiles.Remove(recentFile);
                }
            }
        }