示例#1
0
        private async Task SaveClosingEditorAsync(IDiagramEditor diagramEditor)
        {
            var saveTask = diagramEditor.SaveAsync();

            _editorSaveTasks.Add(saveTask);
            _editorsNeedingSaving.Remove(diagramEditor);
            await saveTask;

            _editorSaveTasks.Remove(saveTask);
            RemoveEditor(diagramEditor);
        }
示例#2
0
        private void RemoveEditor(IDiagramEditor editor)
        {
            var diagram = editor.Diagram;

            editor.Closing -= diagramEditor_Closing;
            editor.Closed  -= diagramEditor_Closed;
            editor.Saved   -= diagramEditor_Saved;
            OpenDiagrams.Remove(editor);
            editor.Dispose();

            OnDiagramClosed(diagram);
        }
示例#3
0
        /// <summary>
        /// add the plugin to plugin list.
        /// </summary>
        /// <param name="p">plugin</param>
        public void AddPlugin(IEcellPlugin p)
        {
            EcellException ex = new EcellException(string.Format(MessageResources.ErrAdd, p.GetPluginName(), "Plugin"));
            if (p is IDockOwner)
            {
                if (m_dockOwner != null)
                    throw ex;
                m_dockOwner = (IDockOwner)p;
            }

            if (p is IDiagramEditor)
            {
                if (m_diagramEditor != null)
                    throw ex;
                m_diagramEditor = (IDiagramEditor)p;
            }

            if (p is IRootMenuProvider)
            {
                if (m_rootMenuProvider != null)
                    throw ex;
                m_rootMenuProvider = (IRootMenuProvider)p;
            }

            if (p is IDataHandler)
            {
                m_dataHandlerList.Add((IDataHandler)p);
            }

            if (p is IAnalysis)
            {
                m_analysisList.Add((IAnalysis)p);
            }

            if (p is IRasterizable)
            {
                m_rasterizableList.Add((IRasterizable)p);
            }

            if (p is ILayoutAlgorithm)
            {
                m_layoutAlgorithmList.Add((ILayoutAlgorithm)p);
            }

            if (!m_pluginList.ContainsKey(p.GetPluginName()))
            {
                p.Environment = m_env;
                p.Initialize();
                m_pluginList.Add(p.GetPluginName(), p);
                Dictionary<string, Delegate> plist = p.GetPublicDelegate();
                if (plist == null) return;

                foreach (string key in plist.Keys)
                {
                    m_delegateDic.Add(key, plist[key]);
                }
            }
        }