예제 #1
0
파일: VictorForm.cs 프로젝트: RobAmos/osla
 private void Form1_Load(object sender, EventArgs e)
 {
     //StartVictor();
     if (CurrentStatus != InstrumentState.Busted)
     {
         InstrumentServ = new InstrumentServerClass();
         InstrumentServ.OnError += new IInstrumentEvents_OnErrorEventHandler(InstrumentServ_OnError);
     }
 }
예제 #2
0
파일: VictorForm.cs 프로젝트: RobAmos/osla
        protected void InternalDispose(bool disposing)
        {
            // If you need thread safety, use a lock around these
            // operations, as well as in your methods that use the resource.
            if (!_disposed)
            {
                if (disposing)
                {
                    if (Victor != null)
                    {
                        try
                        {
                            Victor.StopServer();
                            System.Runtime.InteropServices.Marshal.ReleaseComObject(InstrumentServ);
                            Thread.Sleep(1000);//give it time to close
                            System.Runtime.InteropServices.Marshal.ReleaseComObject(Victor);
                        }
                        catch { }
                    }
                    if (ProtocolTree != null)
                    {
                        try
                        {
                            Marshal.ReleaseComObject(ProtocolTree);
                        }
                        catch { }

                    }
                    if (m_Assay != null)
                    {
                        try
                        {
                            Marshal.ReleaseComObject(m_Assay);
                        }
                        catch { }
                    }
                    Victor = null;
                    ProtocolTree = null;
                    m_Assay = null;
                    InstrumentServ = null;
                    GC.Collect();//call disposers
                    GC.Collect();//finalize
                    _disposed = true;
                }

            }
        }