コード例 #1
0
 void DisposeSelf()
 {
     try { this.Disconnect(); }
     catch (Exception ex) { CtkLog.Write(ex); }
     //斷線不用清除Event, 但Dispsoe需要, 因為即使斷線此物件仍存活著
     CtkEventUtil.RemoveEventHandlersOfOwnerByFilter(this, (dlgt) => true);
 }
コード例 #2
0
        public void Disconnect()
        {
            if (this.threadNonStopConnect != null)
            {
                this.threadNonStopConnect.Abort();
            }

            foreach (var tc in this.TcpClientList)
            {
                if (tc == null)
                {
                    continue;
                }
                try { tc.Close(); }
                catch (Exception ex) { CtkLog.Write(ex); }
            }

            if (this.m_tcpListener != null)
            {
                this.m_tcpListener.Stop();
            }

            //一旦結束就死了, 需要重new, 所以清掉event沒問題
            CtkEventUtil.RemoveEventHandlersFromOwningByFilter(this, (dlgt) => true);
        }
コード例 #3
0
 public virtual void Close()
 {
     using (var obj = this.ChannelFactory)
     {
         obj.Abort();
         obj.Close();
     }
     CtkEventUtil.RemoveEventHandlersOfOwnerByFilter(this, (dlgt) => true);//關閉就代表此類別不用了
 }
コード例 #4
0
 void DisposeSelf()
 {
     try
     {
         this.Disconnect();
         //一旦結束就死了, 需要重new, 所以清掉event沒問題
         CtkEventUtil.RemoveEventHandlersOfOwnerByFilter(this, (dlgt) => true);
     }
     catch (Exception ex) { CtkLog.Write(ex); }
 }
コード例 #5
0
        public void Disconnect()
        {
            if (this.threadNonStopConnect != null)
            {
                this.threadNonStopConnect.Abort();
                this.threadNonStopConnect = null;
            }
            CtkNetUtil.DisposeTcpClient(this.activeWorkClient);

            //一旦結束就死了, 需要重new, 所以清掉event沒問題
            CtkEventUtil.RemoveEventHandlersFromOwningByFilter(this, (dlgt) => true);
        }
コード例 #6
0
        public virtual void Close()
        {
            if (this.host != null)
            {
                using (var obj = this.host)
                {
                    obj.Abort();
                    obj.Close();
                }
            }

            CtkEventUtil.RemoveEventHandlersOfOwnerByFilter(this, (dlgt) => true);//關閉就代表此類別不用了
        }
コード例 #7
0
        public void Disconnect()
        {
            this.AbortNonStopConnect();
            if (this.ChannelFactory != null)
            {
                using (var obj = this.ChannelFactory)
                {
                    obj.Abort();
                    obj.Close();
                }
            }

            CtkEventUtil.RemoveEventHandlersFromOwningByFilter(this, (dlgt) => true);
        }
コード例 #8
0
        public void Disconnect()
        {
            if (this.threadNonStopConnect != null)
            {
                this.threadNonStopConnect.Abort();
            }
            if (this.serialPort != null)
            {
                this.serialPort.Close();
                this.serialPort.Dispose();
            }

            //一旦結束就死了, 需要重new, 所以清掉event沒問題
            CtkEventUtil.RemoveEventHandlersFromOwningByFilter(this, (dlgt) => true);
        }
コード例 #9
0
        public virtual void Close()
        {
            foreach (var chinfo in this.channelMapper)
            {
                var ch = chinfo.Value.Channel;
                ch.Abort();
                ch.Close();
            }

            if (this.host != null)
            {
                using (var obj = this.host)
                {
                    obj.Abort();
                    obj.Close();
                }
            }

            CtkEventUtil.RemoveEventHandlersFromOwningByFilter(this, (dlgt) => true);//關閉就代表此類別不用了
        }
コード例 #10
0
        public void Close()
        {
            this.CfIsRunning = false;
            this.areMsg.Set();//若在等訊號也通知結束等待

            if (this.taskRun != null)
            {
                this.taskRun.Cancel();//取消執行Task
                this.taskRun.Wait(1000);
                this.taskRun.Dispose();
                this.taskRun = null;
            }
            if (this.ProtoConn != null)
            {
                this.ProtoConn.Disconnect();
                this.ProtoConn.Dispose();
                this.ProtoConn = null;
            }
            CtkEventUtil.RemoveEventHandlersOfOwnerByFilter(this, (dlgt) => true);
        }
コード例 #11
0
        void DisposeSelf()
        {
            this.CloseStream(ref this.fwriter);

            CtkEventUtil.RemoveEventHandlersOfOwnerByFilter(this, (dlgt) => true);
        }
コード例 #12
0
 void DisposeSelf()
 {
     this.Disconnect();
     CtkEventUtil.RemoveEventHandlersOfOwnerByFilter(this, (dlgt) => true);
 }
コード例 #13
0
 void CleanHost()
 {
     //CtkEventUtil.RemoveEventHandlersFromOwningByFilter(this, (dlgt) => true);//不用清除自己的
     CtkEventUtil.RemoveEventHandlersOfOwnerByTarget(this.host, this);
 }
コード例 #14
0
 void DisposeSelf()
 {
     try { this.Disconnect(); }
     catch (Exception ex) { CtkLog.Write(ex); }
     CtkEventUtil.RemoveEventHandlersFromOwningByFilter(this, (dlgt) => true);
 }
コード例 #15
0
 protected virtual void DisposeSelf()
 {
     //Hal統一由HalContext釋放
     //MvUtil.DisposeObjTry(this.halAssembly);
     CtkEventUtil.RemoveEventHandlersOfOwnerByFilter(this, (dlgt) => true);
 }
コード例 #16
0
ファイル: SNetTdNode.cs プロジェクト: tsaiyca/MvAssistant
 protected virtual void DisposeSelf()
 {
     CtkEventUtil.RemoveEventHandlersOfOwnerByFilter(this, (dlgt) => true);//移除自己的Event Delegate
 }