示例#1
0
        /// <summary>
        /// Free resources linked to this instance
        /// </summary>

        public void Dispose()
        {
            try
            {
                DisposeOfControls();

                if (Query != null)
                {
                    Query.FreeControlReferences();                                // just free control references
                }
                if (MoleculeGrid != null)
                {
                    MoleculeGrid.Dispose();
                }
                if (QueryEngine != null)
                {
                    QueryEngine.Dispose();
                }
                if (DataTableManager != null)
                {
                    DataTableManager.Dispose();
                }

                if (ResultsFormat != null)
                {
                    ResultsFormat.QueryManager = null;
                }
                if (ResultsFormatter != null)
                {
                    ResultsFormatter.QueryManager = null;
                }
                if (StatusBarManager != null)
                {
                    StatusBarManager.QueryManager = null;
                }
                if (QueryExec != null)
                {
                    QueryExec.QueryManager = null;
                }

                QueryResultsControl = null;
                Query            = null;
                DataTableManager = null;
                DataTable        = null;
                ResultsFormat    = null;
                ResultsFormatter = null;
                StatusBarManager = null;
                MoleculeGrid     = null;
                QueryExec        = null;
                QueryEngine      = null;
            }

            catch (Exception ex)
            {
                DebugLog.Message(DebugLog.FormatExceptionMessage(ex));
            }
        }
示例#2
0
/// <summary>
/// Set the percentage value on the zoom slider in the tool bar
/// </summary>
/// <param name="zoomPct"></param>

        internal void SetZoomSliderPct(int zoomPct)
        {
            StatusBarManager sbm = SessionManager.Instance.StatusBarManager;

            if (zoomPct >= 0)
            {
                sbm.ZoomControlVisible = true;
                sbm.ZoomSliderPct      = zoomPct;
            }

            else
            {
                sbm.ZoomControlVisible = false;
            }
        }
示例#3
0
        public void Initialize(QueryManager qm)
        {
            Qm = qm;
            StatusBarManager sbm = new StatusBarManager();

            qm.LinkMember(sbm);

            sbm.SetupViewZoomControls(null, ZoomPctBarItem, ZoomSlider);
            sbm.ZoomSliderPct = 100;             // set to 100% initially

            if (LastGridCreated != null && LastGridCreated.WindowState == FormWindowState.Normal)
            {
                try { Size = LastGridCreated.Size; }
                catch (Exception ex) { ex = ex; }
            }

            LastGridCreated = this;
        }
示例#4
0
        /// <summary>
        /// Link in QueryManager member
        /// </summary>
        /// <param name="m"></param>

        public void LinkMember(StatusBarManager m)
        {
            StatusBarManager = m;
            m.QueryManager   = this;
        }
示例#5
0
        /// <summary>
        /// End table caching by writing out remaining records & opening file reader
        /// </summary>

        public void EndCaching()
        {
            if (!AllowCaching)
            {
                return;
            }

            if (CacheStartPosition < 0 || CacheWriter == null)
            {
                return;                                                            // caching active
            }
            if (RowsRemovedFromDataTable == 0)
            {
                if (CacheWriter != null)
                {
                    CacheWriter.Close();
                    CacheWriter = null;
                }
                CacheStartPosition = -1;
                return;
            }

            if (RowRetrievalState == RowRetrievalState.Running || RowRetrievalState == RowRetrievalState.Paused)
            {
                CancelRowRetrieval();            // cancel if not complete
            }
            WriteRowsToCache(false);             // write out remaining rows
            CacheWriter.Close();
            CacheWriter = null;

            CacheReader        = new StreamReader(CacheFile);
            CacheStartPosition = -1;

            //RowCount = CacheStartRowCount; // restore counts (todo: fix this: gives zero for export count with this code)
            //KeyCount = CacheStartKeyCount;

            RowRetrievalState = RowRetrievalState.Paused;
            if (DebugDetails)
            {
                ClientLog.Message("RowRetrievalState.Paused 3");
            }

            if (QueryManager.MoleculeGrid != null)
            {
                QueryManager.MoleculeGrid.EndUpdate();
                QueryManager.MoleculeGrid.Refresh();
                Application.DoEvents();
            }

            if (StatusBarManager != null)
            {                                           // update status bar, may process an event that generates a request for more rows
                StatusBarManager.DisplayRetrievalProgressState(RowRetrievalState);
                StatusBarManager.DisplayFilterCounts(); // update count display
            }

            if (DebugCaching)
            {
                ClientLog.Message("EndCaching: " + DataTableMx.Rows.Count);
            }

            return;
        }