Ejemplo n.º 1
0
        /// <summary>
        /// 現在アクティブなタブ以外を全て閉じる
        /// </summary>
        /// <returns></returns>
        public bool CloseFileOtherAll()
        {
            IEditorDocContent editor = ActiveDocument;

            if (editor == null)
            {
                //現在アクティブなエディタがないので何もせずに終了
                return(true);
            }

            //現在アクティブなエディタの位置を取得する
            int docLen = 0;

            IDockContent[] docList           = m_mainPanel.Documents;
            int            activeEditorIndex = 0;

            for (int i = 0; i < docList.Length; i++)
            {
                if (editor == docList[i])
                {
                    activeEditorIndex = i;
                }
                if (docList[i] is IEditorDocContent)
                {
                    docLen++;
                }
            }

            //ドッキングウィンドウからエディタを検索する
            for (int i = 0; i < docList.Length; i++)
            {
                if (i != activeEditorIndex)                     //アクティブだったエディタではないとき
                {
                    if (docList[i] is IEditorDocContent)
                    {
                        //エディタを閉じる
                        editor = (IEditorDocContent)docList[i];
                        editor.ActivateForm();
                        editor.CloseForm();

                        if (editor.IsClosed == false)
                        {
                            //閉じることができなかったので失敗を返す
                            return(false);
                        }
                    }
                }
            }

            //すべて閉じれたので成功を返す
            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// すべてのエディタを閉じる
        /// すべて閉じたらtrueを返す
        /// </summary>
        public bool CloseFileAll()
        {
            //ドッキングウィンドウからエディタを検索する
            IDockContent[] docList = m_mainPanel.Documents;
            foreach (IDockContent doc in docList)
            {
                if (doc is IEditorDocContent)
                {
                    //エディタを閉じる
                    IEditorDocContent editor = (IEditorDocContent)doc;
                    editor.ActivateForm();
                    editor.CloseForm();

                    if (editor.IsClosed == false)
                    {
                        //閉じることができなかったので失敗を返す
                        return(false);
                    }
                }
            }

            //すべて閉じれたので成功を返す
            return(true);
        }