Ejemplo n.º 1
0
 /// <summary>
 /// Notification that the tab control has got the focus
 /// </summary>
 private void FilterFindTabGotFocus(object sender, EventArgs e)
 {
     FPetraUtilsObject.WriteToStatusBar("Use the left or right arrow keys to switch between Filter and Find.");
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Enables and disables the UI. Invokes setting up of the Grid after a
        /// successful search operation.
        /// </summary>
        private void EnableDisableUI(bool AEnable)
        {
            String SearchTarget;

            pnlBtnOKCancelHelpLayout.Enabled = Convert.ToBoolean(AEnable);

            if (Convert.ToBoolean(AEnable))
            {
                if (FLocationFindObject.Progress.JobFinished)
                {
                    if (FPagedDataTable.Rows.Count > 0)
                    {
                        /* hide message */
                        Application.DoEvents();

                        this.Cursor = Cursors.Default;

                        /*
                         * Setup result DataGrid
                         */
                        SetupResultDataGrid();

                        grdResult.Visible = true;

                        grdResult.BringToFront();

                        // Make the Grid respond on updown keys
                        grdResult.Focus();
                        // this is needed so that the next 'Enter' press acts as if the the 'Accept' Button got pressed
                        grdResult.Selection.Focus(new Position(1, 2), true);

                        // Display the number of found Locations
                        if (grdResult.TotalRecords > 1)
                        {
                            SearchTarget = StrSearchTargetPluralText;
                        }
                        else
                        {
                            SearchTarget = StrSearchTargetText;
                        }

                        grpResult.Text = MPartnerResourcestrings.StrSearchResult + ": " + grdResult.TotalRecords.ToString() + ' ' + SearchTarget +
                                         ' ' +
                                         MPartnerResourcestrings.StrFoundText;

                        btnOK.Enabled = true;
                    }
                    else
                    {
                        this.Cursor = Cursors.Default;

                        /* no results, inform user, then no further action */
                        lblSearchInfo.Text = MPartnerResourcestrings.StrNoRecordsFound1Text + ' ' + StrSearchTargetText +
                                             MPartnerResourcestrings.StrNoRecordsFound2Text;
                        lblSearchInfo.BringToFront();
                        btnOK.Enabled     = false;
                        grdResult.Enabled = false;

                        Application.DoEvents();
                    }
                }
                else
                {
                    /* Search operation interrupted by user */
                    this.Cursor        = Cursors.Default;
                    grpResult.Text     = MPartnerResourcestrings.StrSearchResult;
                    lblSearchInfo.Text = MPartnerResourcestrings.StrSearchStopped;

                    btnSearch.Enabled = true;
                    btnOK.Enabled     = false;

                    // StatusBar update
                    FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrGenericReady);
                    FPetraUtilsObject.SetStatusBarText(btnSearch, MPartnerResourcestrings.StrSearchButtonHelpText);
                    Application.DoEvents();

                    // Ensure Client doesn't crash in case user presses <Tab> followed by <Enter>
                    grdResult.Dispose();
                    grdResult = null;
                }
            }

            /* Enable/disable remaining controls */
            btnClearCriteria.Enabled = Convert.ToBoolean(AEnable);
            tlpAllCriteria.Enabled   = Convert.ToBoolean(AEnable);

            /* Set search button text */
            if (Convert.ToBoolean(AEnable))
            {
                btnSearch.Text = MPartnerResourcestrings.StrSearchButtonText;
            }
            else
            {
                btnSearch.Text = MPartnerResourcestrings.StrSearchButtonStopText;
            }
        }