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

ShowLibraryEditorByGuid() protected method

protected ShowLibraryEditorByGuid ( string guid ) : IEventComponent
guid string
return IEventComponent
        protected IEventComponent ShowLibraryEditorByGuid(string guid)
        {
            bool exist = false;
            foreach (DockContent item in DockPanel.Contents)
            {
                if (item.GetType() == typeof(LibraryEditor))
                {
                    LibraryEditor editor = (LibraryEditor)item;
                    if (editor.Library.Guid == guid)
                    {
                        editor.Show();
                        exist = true;
                    }
                }
            }

            if (!exist)
            {
                LibraryWrapper lib = PK.Wrapper.FindLibrary(guid);
                if (lib != null)
                {
                    LE = new LibraryEditor();
                    LE.OpenContainingFolderEvent +=new EventHandler<Forms.BaseForms.PathEventArgs>(OpenContainingFolderEvent);
                    LE.SetLib(lib);
                    LE.Show(DockPanel, DockState.Document);
                    return LE;
                }
            }
            return null;
        }