PKStudio.Helpers.EditorsFormsController.ShowLibraryCategoryEditorByGuid C# (CSharp) Method

ShowLibraryCategoryEditorByGuid() protected method

protected ShowLibraryCategoryEditorByGuid ( string guid ) : IEventComponent
guid string
return IEventComponent
        protected IEventComponent ShowLibraryCategoryEditorByGuid(string guid)
        {
            bool exist = false;
            foreach (DockContent item in DockPanel.Contents)
            {
                if (item.GetType() == typeof(PKStudio.Forms.Editors.LibraryCategoryEditor))
                {
                    LibraryCategoryEditor editor = (LibraryCategoryEditor)item;
                    if (editor.LibraryCategory.Guid == guid)
                    {
                        editor.Show();
                        exist = true;
                    }
                }
            }

            if (!exist)
            {
                LibraryCategoryWrapper libcat = PK.Wrapper.FindLibraryCategory(guid);
                if (libcat != null)
                {
                    LCE = new LibraryCategoryEditor();
                    LCE.OpenContainingFolderEvent += new EventHandler<Forms.BaseForms.PathEventArgs>(OpenContainingFolderEvent);
                    LCE.SetLibCat(libcat);
                    LCE.Show(DockPanel, DockState.Document);
                    return LCE;
                }
            }
            return null;
        }