Example #1
0
        private void _OpenDocument(String fPath)
        {
            if (_CheckKeepCurrentDocument())
            {
                return;
            }

            var filePath = new PathString(fPath);

            // if there's plugins already loaded, we need to load the new document with an application's restart
            var plugins = Client.PluginLoader.Instance.GetPlugins();

            if (plugins != null && plugins.Count() > 0)
            {
                (System.Windows.Application.Current as App).RestartAndLoad(filePath);
                return;
            }

            // load normally;

            var doc = ProjectVIEW.OpenFile(this, filePath);

            if (doc == null)
            {
                RecentFilesManager.RemoveFile(filePath); return;
            }

            RecentFilesManager.InsertFile(doc.DocumentPath);

            DocumentView = doc;
        }
Example #2
0
        private void _CreateNewDocument()
        {
            if (_CheckKeepCurrentDocument())
            {
                return;
            }

            var plugins = Client.PluginLoader.Instance.GetPlugins();

            if (plugins != null && plugins.Count() > 0)
            {
                (System.Windows.Application.Current as App).Restart();
                return;
            }

            var doc = ProjectVIEW.CreateNew(this);

            if (doc == null)
            {
                return;
            }

            RecentFilesManager.InsertFile(doc.DocumentPath);

            _Document = doc;

            RaiseChanged(nameof(DocumentView));
        }
        private string GetMenuItemText(int index, string filepath, string displaypath)
        {
            var delegateGetMenuItemText = GetMenuItemTextHandler;

            if (delegateGetMenuItemText != null)
            {
                return(delegateGetMenuItemText(index, filepath));
            }

            string format = index < 10 ? MenuItemFormatOneToNine : MenuItemFormatTenPlus;

            string shortPath = RecentFilesManager.ShortenPathName(displaypath, MaxPathLength);

            return(String.Format(format, index, filepath, shortPath));
        }
Example #4
0
        protected override void OnStartup(StartupEventArgs e)
        {
            RecentFilesManager.UseXmlPersister();

            base.OnStartup(e);
        }