Example #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a wordEntry list grid with the specified cache and adds it to the form.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public void Initialize(WordListCache cache)
        {
            App.MsgMediator.SendMessage("BeforeSearchResultViewInitialized", this);
            Controls.Clear();

            _query = (cache != null ? cache.SearchQuery : null);

            if (cache == null || cache.Count == 0)
            {
                if (_grid != null)
                {
                    _grid.Dispose();
                    _grid = null;
                }

                if (_query != null && _query.Errors.Count > 0)
                {
                    SetupErrorDisplay(_query);
                }

                return;
            }

            // Save the grid we're replacing.
            var tmpgrid = _grid;

            _grid = new PaWordListGrid(cache, _owningViewType);
            _grid.OwningViewType = _owningViewType;
            _grid.TMAdapter      = _tmAdapter;

            // Even though the grid is docked, setting it's size here prevents the user from
            // seeing it during that split second during which the grid goes from it's small,
            // default size to its docked size.
            _grid.Size = Size;

            _grid.Name = Name + "Grid";
            _grid.LoadSettings();
            _grid.Visible = false;
            Controls.Add(_grid);
            _grid.Visible = true;

            // I wait until the new grid is all done building and loading before
            // removing the old so the user cannot see the painting of the new one.
            if (tmpgrid != null)
            {
                Controls.Remove(tmpgrid);
                tmpgrid.Dispose();
            }

            _grid.UseWaitCursor = false;
            _grid.Cursor        = Cursors.Default;

            App.MsgMediator.SendMessage("AfterSearchResultViewInitialized", this);
        }
Example #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a wordEntry list grid with the specified cache and adds it to the form.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public void Initialize(WordListCache cache)
        {
            m_cache = cache;

            if (WordListGrid != null)
            {
                WordListGrid.Cache = m_cache;
            }
            else
            {
                WordListGrid                       = new PaWordListGrid(cache, GetType(), false);
                WordListGrid.BorderStyle           = BorderStyle.None;
                WordListGrid.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.None;
                WordListGrid.TMAdapter             = m_tmAdapter;

                // Even thought the grid is docked, setting it's size here prevents the user
                // from seeing that split second during which time the grid goes from it's
                // small, default size to its docked size.
                WordListGrid.Size = new Size(splitOuter.Panel1.Width, splitOuter.Panel1.Height);

                WordListGrid.Name = Name + "Grid";
                WordListGrid.LoadSettings();
                WordListGrid.RowEnter += m_grid_RowEnter;
                WordListGrid.Visible   = false;
                pnlGrid.Controls.Add(WordListGrid);
                WordListGrid.Visible  = true;
                WordListGrid.TabIndex = 0;
                WordListGrid.Focus();
                WordListGrid.SortOptions           = Project.DataCorpusVwSortOptions;
                WordListGrid.IsCurrentPlaybackGrid = true;
                WordListGrid.UseWaitCursor         = false;
                WordListGrid.Cursor = Cursors.Default;
            }

            // This will enforce an update of the record pane.
            _recView.UpdateRecord(WordListGrid.GetRecord(), true);
        }