Пример #1
0
 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
        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;
                }

            }
        }