Inheritance: PKStudio.Forms.BaseForms.EditorBaseForm
示例#1
0
        private SourceFileEditor OpenTextEditor(string Path)
        {
            bool exist = false;

            foreach (DockContent item in DockPanel.Contents)
            {
                if (item.GetType() == typeof(PKStudio.Forms.Editors.SourceFileEditor))
                {
                    PKStudio.Forms.Editors.SourceFileEditor editor = (PKStudio.Forms.Editors.SourceFileEditor)item;

                    if (editor.EditingFilePath == Path)
                    {
                        editor.Show();
                        return(editor);
                    }
                }
            }

            if (!exist)
            {
                SFE = new Forms.Editors.SourceFileEditor();
                SFE.OpenContainingFolderEvent += new EventHandler <Forms.BaseForms.PathEventArgs>(OpenContainingFolderEvent);
                if (SFE.SetFile(Path))
                {
                    SFE.Show(DockPanel, DockState.Document);
                }
                return(SFE);
            }
            return(null);
        }
示例#2
0
        /// <summary>
        /// Ru: Сохраняет список открытых для редактирования форм
        /// En: Saves edit forms list to file
        /// </summary>
        public void SaveEditorsFormsState()
        {
            PKStudio.Helpers.OpenedDocumentsList modlist = new Helpers.OpenedDocumentsList();

            foreach (DockContent item in DockPanel.Contents)
            {
                if (item.GetType() == typeof(PKStudio.Forms.Editors.SourceFileEditor))
                {
                    PKStudio.Forms.Editors.SourceFileEditor file = (PKStudio.Forms.Editors.SourceFileEditor)item;
                    modlist.Files.Add(file.EditingFilePath);
                }
                else if (item.GetType() == typeof(PKStudio.Forms.Editors.LibraryCategoryEditor))
                {
                    PKStudio.Forms.Editors.LibraryCategoryEditor editor = (PKStudio.Forms.Editors.LibraryCategoryEditor)item;
                    modlist.Components.Add(ComponentWrapper.GetComponentWrapper(editor.LibraryCategory));
                }
                else if (item.GetType() == typeof(PKStudio.Forms.Editors.LibraryEditor))
                {
                    PKStudio.Forms.Editors.LibraryEditor editor = (PKStudio.Forms.Editors.LibraryEditor)item;
                    modlist.Components.Add(ComponentWrapper.GetComponentWrapper(editor.Library));
                }
                else if (item.GetType() == typeof(PKStudio.Forms.Editors.FeatureEditor))
                {
                    PKStudio.Forms.Editors.FeatureEditor editor = (PKStudio.Forms.Editors.FeatureEditor)item;
                    modlist.Components.Add(ComponentWrapper.GetComponentWrapper(editor.Feature));
                }
            }

            string Path = Application.StartupPath + "\\edlist.dat";

            if (File.Exists(Path))
            {
                FileInfo FI = new FileInfo(Path);

                if ((FI.Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
                {
                    FI.Attributes -= FileAttributes.ReadOnly;

                    modlist.Serialize(modlist, Path);
                }
                else
                {
                    modlist.Serialize(modlist, Path);
                }
            }
            else
            {
                modlist.Serialize(modlist, Path);
            }
        }
        private SourceFileEditor OpenTextEditor(string Path)
        {
            bool exist = false;

            foreach (DockContent item in DockPanel.Contents)
            {
                if (item.GetType() == typeof(PKStudio.Forms.Editors.SourceFileEditor))
                {

                    PKStudio.Forms.Editors.SourceFileEditor editor = (PKStudio.Forms.Editors.SourceFileEditor)item;

                    if (editor.EditingFilePath == Path)
                    {
                        editor.Show();
                        return editor;
                    }
                }
            }

            if (!exist)
            {
                SFE = new Forms.Editors.SourceFileEditor();
                SFE.OpenContainingFolderEvent += new EventHandler<Forms.BaseForms.PathEventArgs>(OpenContainingFolderEvent);
                if (SFE.SetFile(Path))
                    SFE.Show(DockPanel, DockState.Document);
                return SFE;
            }
            return null;
        }
 /// <summary>
 /// Ru: Загружает формы для редактирования из списка
 /// En: Loads edit forms from list from file
 /// </summary>
 public void LoadEditorFormsState()
 {
     //Загрузка редакторов
     OpenedDocumentsList modlist = new OpenedDocumentsList();
     if (File.Exists(Application.StartupPath + "\\" + FileName))
     {
         modlist = modlist.Deserialize(Application.StartupPath + "\\" + FileName);
         foreach (string path in modlist.Files)
         {
             SFE = new Forms.Editors.SourceFileEditor();
             SFE.OpenContainingFolderEvent += new EventHandler<Forms.BaseForms.PathEventArgs>(OpenContainingFolderEvent);
             SFE.SetFile(path);
             SFE.Show(DockPanel, DockState.Document);
         }
         foreach (ComponentWrapper comp in modlist.Components)
         {
             this.ShowEditor(comp);
         }
     }
 }