Exemple #1
0
        public PrepareCloseResult CloseMultipleDocuments(ClosingContext context, IPoderosaDocument[] documents)
        {
            List <SessionHost> sessions = CreateSessionHostCollection();

            foreach (SessionHost sh in sessions)
            {
                sh.CMP_ClosingDocumentCount = 0; //カウントリセット
            }
            foreach (IPoderosaDocument doc in documents)
            {
                DocumentHost dh = FindDocumentHost(doc);
                dh.SessionHost.CMP_ClosingDocumentCount++;
            }
            //ここまでで、各SessionHostごとに何個のドキュメントを閉じようとしているかがカウントされた。
            //次にそれぞれについて処理をはじめる
            PrepareCloseResult result = PrepareCloseResult.TerminateSession;

            foreach (SessionHost sh in sessions)
            {
                if (sh.CMP_ClosingDocumentCount == 0)
                {
                    continue;                                        //影響なし
                }
                if (sh.CMP_ClosingDocumentCount == sh.DocumentCount) //セッションの全ドキュメントを閉じる場合
                {
                    PrepareCloseResult r = TerminateSession(sh.Session);
                    sh.CMP_PrepareCloseResult = r;
                    if (r == PrepareCloseResult.TerminateSession)
                    {
                        context.AddClosingSession(sh);
                    }
                    else if (r == PrepareCloseResult.Cancel)
                    {
                        result = PrepareCloseResult.Cancel; //一個でもキャンセルがあれば全体をキャンセルとする
                    }
                }
                else   //一部のドキュメントを閉じる。これが面倒
                       //TODO unsupported
                {
                    Debug.Assert(false, "unsupported");
                }
            }

            //それらについてセッションを閉じる
            foreach (SessionHost sh in context.ClosingSessions)
            {
                CleanupSession(sh);
            }

            return(result);
        }
Exemple #2
0
        public PrepareCloseResult CloseMultipleDocuments(ClosingContext context, IPoderosaDocument[] documents) {
            List<SessionHost> sessions = CreateSessionHostCollection();
            foreach (SessionHost sh in sessions)
                sh.CMP_ClosingDocumentCount = 0; //カウントリセット

            foreach (IPoderosaDocument doc in documents) {
                DocumentHost dh = FindDocumentHost(doc);
                dh.SessionHost.CMP_ClosingDocumentCount++;
            }
            //ここまでで、各SessionHostごとに何個のドキュメントを閉じようとしているかがカウントされた。
            //次にそれぞれについて処理をはじめる
            PrepareCloseResult result = PrepareCloseResult.TerminateSession;
            foreach (SessionHost sh in sessions) {
                if (sh.CMP_ClosingDocumentCount == 0)
                    continue; //影響なし

                if (sh.CMP_ClosingDocumentCount == sh.DocumentCount) { //セッションの全ドキュメントを閉じる場合
                    PrepareCloseResult r = TerminateSession(sh.Session);
                    sh.CMP_PrepareCloseResult = r;
                    if (r == PrepareCloseResult.TerminateSession)
                        context.AddClosingSession(sh);
                    else if (r == PrepareCloseResult.Cancel)
                        result = PrepareCloseResult.Cancel; //一個でもキャンセルがあれば全体をキャンセルとする
                }
                else { //一部のドキュメントを閉じる。これが面倒
                    //TODO unsupported
                    Debug.Assert(false, "unsupported");
                }
            }

            //それらについてセッションを閉じる
            foreach (SessionHost sh in context.ClosingSessions) {
                CleanupSession(sh);
            }

            return result;
        }
Exemple #3
0
        public PrepareCloseResult CloseMultipleDocuments(ClosingContext context, IPoderosaDocument[] documents)
        {
            List<SessionHost> sessions = CreateSessionHostCollection();
            foreach (SessionHost sh in sessions)
                sh.CMP_ClosingDocumentCount = 0; //�J�E���g���Z�b�g

            foreach (IPoderosaDocument doc in documents) {
                DocumentHost dh = FindDocumentHost(doc);
                dh.SessionHost.CMP_ClosingDocumentCount++;
            }
            //�����܂łŁA�eSessionHost���Ƃɉ��‚̃h�L�������g��‚��悤�Ƃ��Ă��邩���J�E���g���ꂽ�B
            //���ɂ��ꂼ��ɂ‚��ď�����͂��߂�
            PrepareCloseResult result = PrepareCloseResult.TerminateSession;
            foreach (SessionHost sh in sessions) {
                if (sh.CMP_ClosingDocumentCount == 0)
                    continue; //�e���Ȃ�

                if (sh.CMP_ClosingDocumentCount == sh.DocumentCount) { //�Z�b�V�����̑S�h�L�������g��‚���ꍇ
                    PrepareCloseResult r = TerminateSession(sh.Session);
                    sh.CMP_PrepareCloseResult = r;
                    if (r == PrepareCloseResult.TerminateSession)
                        context.AddClosingSession(sh);
                    else if (r == PrepareCloseResult.Cancel)
                        result = PrepareCloseResult.Cancel; //��‚ł�L�����Z��������ΑS�̂�L�����Z���Ƃ���
                }
                else { //�ꕔ�̃h�L�������g��‚���B���ꂪ�ʓ|
                    //TODO unsupported
                    Debug.Assert(false, "unsupported");
                }
            }

            //�����ɂ‚��ăZ�b�V������‚���
            foreach (SessionHost sh in context.ClosingSessions) {
                CleanupSession(sh);
            }

            return result;
        }