예제 #1
0
        /// <summary>
        /// Loads up the recent file
        /// </summary>
        /// <param name="file">The recent file information to load.</param>
        internal void LoadRecentFile(Model.RecentFile file)
        {
            if (System.IO.File.Exists(file.Filename))
            {
                this.Cursor = Cursors.Wait;

                if (System.IO.Path.GetExtension(file.Filename) == ".ldproj")
                {
                    LiveDocumentorFile.Load(file.Filename);
                }
                else
                {
                    LiveDocumentorFile.Singleton.Open(file.Filename);
                }

                Model.UserApplicationStore.Store.RecentFiles.AddFile(file);
                this.UpdateView();
                this.userViewingHistory.ClearHistory();

                this.Cursor = null;
            }
            else
            {
                MessageBox.Show(string.Format(
                                    "The {0} does not exist at the specified location.", System.IO.Path.GetFileName(file.Filename)),
                                "File Not Found"
                                );
            }

            GC.Collect();
        }
예제 #2
0
        /// <summary>
        /// Event handler for all recent file menu items, handled by the parent menu item. When we recieve
        /// this event we need to load the selected recent file for the user.
        /// </summary>
        /// <param name="sender">The calling object</param>
        /// <param name="e">The event arguments.</param>
        private void recentFiles_Click(object sender, RoutedEventArgs e)
        {
            MenuItem s = (MenuItem)e.OriginalSource;

            if (s == this.recentFiles)
            {
                return; // causes exceptions when we process top level with no children
            }
            if (s.DataContext != null)
            {
                Model.RecentFile f = (Model.RecentFile)s.DataContext;
                this.LoadRecentFile(f);

                if (this.startpage.Visibility == Visibility.Visible)
                {
                    this.startpage.Visibility    = Visibility.Hidden;
                    this.documentpage.Visibility = Visibility.Visible;
                }
            }
        }