Exemple #1
0
        /// <summary>
        /// Show proper row retrieval state image
        /// </summary>
        /// <param name="state"></param>

        public void DisplayRetrievalProgressState(RowRetrievalState state)
        {
            if (RetrievalProgressButton == null || RetrievalProgressBar == null || StatusBarCtl == null)
            {
                return;
            }

            if (state == previousRowRetrievalState)
            {
                return;
            }

            try
            {
                AdjustRetrievalProgressBarLocation();

                if (state == RowRetrievalState.Running)
                {
                    RetrievalProgressBar.Visible    = true;
                    RetrievalProgressButton.Visible = false;
                }

                else if (state == RowRetrievalState.Paused)
                {
                    RetrievalProgressBar.Visible       = false;
                    RetrievalProgressButton.Visible    = true;
                    RetrievalProgressButton.ImageIndex = 1;
                }

                else if (state == RowRetrievalState.Complete)
                {
                    RetrievalProgressBar.Visible       = false;
                    RetrievalProgressButton.Visible    = true;
                    RetrievalProgressButton.ImageIndex = 0;
                }

                else                 // not visible
                {
                    RetrievalProgressButton.Visible = false;
                    RetrievalProgressBar.Visible    = false;
                }

                previousRowRetrievalState = state;

                return;
            }

            catch (Exception ex)
            {
                LastException = ex;
            }

            //if (SS.I.UISetupLevel < 0)
            //  try { Application.DoEvents(); }
            //  catch {}

            return;
        }
Exemple #2
0
        /// <summary>
        /// DisplayRetrievalProgressStateAndFilterCounts
        /// </summary>
        /// <param name="state"></param>

        public void DisplayRetrievalProgressStateAndFilterCounts(RowRetrievalState state)
        {
            DisplayRetrievalProgressState(state);
            DisplayFilterCounts();
        }
Exemple #3
0
        /// <summary>
        /// Display the current row counts in the status bar
        /// </summary>

        public void DisplayFilterCounts(bool show)
        {
            if (!SS.I.Attended)
            {
                return;
            }
            if (RowCountCtl == null)
            {
                return;
            }

            try
            {
                if (!show)
                {
                    RowCountCtl.Visibility = BarItemVisibility.Never;
                    DisplayRetrievalProgressState(RowRetrievalState.Undefined);
                    return;
                }

                QueryManager qm = QueryManager;
                if (qm != null && qm.Query != null && qm.Query.Mode == QueryMode.Browse &&                 // if in browse mode get the query manager for the current view
                    Qrc != null && Qrc.CrvQm != null)
                {
                    qm = Qrc.CrvQm;
                }

                if (qm == null || qm.DataTableManager == null)
                {                 // nothing running
                    DisplayRetrievalProgressState(RowRetrievalState.Undefined);
                    RowCountCtl.Caption = "";
                    return;
                }

                DataTableManager  dtm   = qm.DataTableManager;
                RowRetrievalState state = RowRetrievalState.Complete;
                if (dtm.Query != null && dtm.Query.Mode == QueryMode.Browse)
                {
                    state = dtm.RowRetrievalState;
                }
                else if (dtm.KeyCount < 0)
                {
                    state = RowRetrievalState.Undefined;
                }
                DisplayRetrievalProgressState(state);

                String txt = "";
                if (dtm.KeyCount >= 0)
                {                                                // display count of key values retrieved and total key value count
                    string keyName = MetaTable.PrimaryRootTable; // "Key Value" (start with specific compound id rather than generic "Key Value");
                    if (qm.Query != null && !String.IsNullOrEmpty(qm.Query.KeyColumnLabel))
                    {
                        keyName = qm.Query.KeyColumnLabel;
                    }

                    if (keyName.EndsWith("."))
                    {
                        keyName = keyName.Substring(0, keyName.Length - 1) + "s.";
                    }
                    else
                    {
                        keyName += "s";
                    }
                    txt += keyName + ": ";
                    if (dtm.RowRetrievalComplete && dtm.FiltersEnabled && dtm.PassedFiltersKeyCount >= 0 && dtm.PassedFiltersKeyCount < dtm.KeyCount)
                    {
                        txt += FIC(dtm.PassedFiltersKeyCount) + "/";                         // count of reduced set of keys passing filter
                    }
                    if (MqlUtil.SingleStepExecution(qm.Query) && !LockResultsKeys)           // get accurate list and count of keys since may be out of order for single step with list criteria
                    {
                        dtm.ResultsKeys = dtm.GetResultsKeysFromDataTable();
                        dtm.KeyCount    = dtm.ResultsKeys.Count;
                    }
                    txt += FIC(dtm.KeyCount);                     // count of keys in table

                    //if (dtm.KeyCount > 500) dtm = dtm; // debug

                    if (dtm.ResultsKeys != null && dtm.ResultsKeys.Count > dtm.KeyCount &&                     // include total keys if greater than currently retrieved keys
                        !MqlUtil.SingleStepExecution(qm.Query))
                    {
                        txt += "/" + FIC(dtm.ResultsKeys.Count);
                    }
                }

                if (dtm.RowCount >= 0 && (dtm.RowCount != dtm.KeyCount || dtm.PassedFiltersRowCount != dtm.PassedFiltersKeyCount))
                {                 // display count of rows and total rows
                    if (txt != "")
                    {
                        txt += "; ";
                    }
                    txt += "Rows: ";
                    if (dtm.PassedFiltersRowCount >= 0 && dtm.PassedFiltersRowCount < dtm.RowCount)
                    {
                        txt += FIC(dtm.PassedFiltersRowCount) + "/";
                    }
                    txt += FIC(dtm.RowCount);
                }

                RowCountCtl.Visibility = BarItemVisibility.Always;
                RowCountCtl.Caption    = txt;
                RowCountCtl.Refresh();
            }

            catch (Exception ex)
            {
                LastException = ex;
            }

            return;
        }