예제 #1
0
        private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            logger.TextAddedEvent -= loggerTextAddedEventHandler;
            logger.FinishLog();

            timer.Tick -= timerTickHandler;
            if (timer.IsRunning)
            {
                timer.Stop();
            }
            timer.Dispose();

            if (gnssEmulatorPort != null)
            {
                if (gnssEmulatorPort.IsOpen)
                {
                    gnssEmulatorPort.Close();
                }

                gnssEmulatorPort.Dispose();
            }

            if (gtrPort.IsOpen)
            {
                gtrPort.NewNMEAMessage -= gtrPortNewNMEAMessageEventHandler;
                gtrPort.PortError      -= gtrPortErrorEventHandler;
                gtrPort.Close();
            }
        }
예제 #2
0
        public void Dispose()
        {
            if (!disposing)
            {
                disposing = true;

                if (port != null)
                {
                    if (port.IsOpen)
                    {
                        try
                        {
                            port.Close();
                        }
                        catch { }
                    }
                    port.Dispose();
                }

                if (timer != null)
                {
                    if (timer.IsRunning)
                    {
                        timer.Stop();
                    }
                    timer.Dispose();
                }

                if (node != null)
                {
                    node.Stop();
                }
            }
        }
예제 #3
0
 // Detaches from events, stops, and disposes of the dump timer. Timers created
 // through the CreateDumpTimer method should be released through this method.
 private void ReleaseDumpTimer(PrecisionTimer dumpTimer)
 {
     if (dumpTimer != null)
     {
         dumpTimer.Tick -= DumpTimer_Tick;
         dumpTimer.Stop();
         dumpTimer.Dispose();
     }
 }
예제 #4
0
파일: APLLBLCore.cs 프로젝트: ucnl/WAYU
        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    #region timer

                    if (timer.IsRunning)
                    {
                        timer.Stop();
                    }
                    timer.Dispose();

                    #endregion

                    #region inPorts

                    if (inPorts != null)
                    {
                        try
                        {
                            inPorts.Close();
                        }
                        catch { }

                        inPorts.Dispose();
                    }

                    #endregion

                    #region outPort

                    if (outPort != null)
                    {
                        if (outPort.IsOpen)
                        {
                            try
                            {
                                outPort.Close();
                            }
                            catch { }
                        }

                        outPort.Dispose();
                    }

                    #endregion
                }

                disposed = true;
            }
        }
예제 #5
0
        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    if (timer.IsRunning)
                    {
                        timer.Stop();
                    }
                    timer.Dispose();

                    if (inPort.IsOpen)
                    {
                        try
                        {
                            inPort.Close();
                        }
                        catch { }
                    }

                    inPort.Dispose();

                    if (AUXGNSSUsed)
                    {
                        try
                        {
                            auxGNSSPort.Close();
                        }
                        catch { }

                        auxGNSSPort.Dispose();
                    }

                    if (OutPortUsed)
                    {
                        if (outPort.IsOpen)
                        {
                            try
                            {
                                outPort.Close();
                            }
                            catch { }
                        }

                        outPort.Dispose();
                    }
                }

                disposed = true;
            }
        }
예제 #6
0
        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    if (IsOpen)
                    {
                        Close();
                    }

                    port.Dispose();
                    timer.Dispose();
                }

                disposed = true;
            }
        }
예제 #7
0
        private void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    if (timer != null)
                    {
                        timer.Dispose();
                    }
                    if (port != null)
                    {
                        port.Dispose();
                    }
                }

                disposed = true;
            }
        }
예제 #8
0
        /// <summary>
        /// Releases the unmanaged resources used by the <see cref="PrecisionInputTimer"/> object and optionally releases the managed resources.
        /// </summary>
        /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
        private void Dispose(bool disposing)
        {
            if (!m_disposed)
            {
                try
                {
                    if (disposing)
                    {
                        if ((object)m_timer != null)
                        {
                            m_timer.Tick -= m_timer_Tick;
                            m_timer.Dispose();
                        }
                        m_timer = null;

                        if ((object)m_frameWaitHandleA != null)
                        {
                            m_frameWaitHandleA.Set();
                            m_frameWaitHandleA.Dispose();
                        }
                        m_frameWaitHandleA = null;

                        if ((object)m_frameWaitHandleB != null)
                        {
                            m_frameWaitHandleB.Set();
                            m_frameWaitHandleB.Dispose();
                        }
                        m_frameWaitHandleB = null;
                    }
                }
                finally
                {
                    m_disposed = true;  // Prevent duplicate dispose.
                }
            }
        }
예제 #9
0
파일: AudioPlayback.cs 프로젝트: avs009/gsf
 // Detaches from events, stops, and disposes of the dump timer. Timers created
 // through the CreateDumpTimer method should be released through this method.
 private void ReleaseDumpTimer(PrecisionTimer dumpTimer)
 {
     if (dumpTimer != null)
     {
         dumpTimer.Tick -= DumpTimer_Tick;
         dumpTimer.Stop();
         dumpTimer.Dispose();
     }
 }