示例#1
0
 private void RefreshEntryDetail()
 {
     try
     {
         _scrollableContainer.SuspendLayout();
         // We can't suspend layout for _detailListControl here because
         // that causes occasional display layout failures.  Unfortunately, not
         // suspending layout allows a good deal of flicker on Linux/Mono.  But
         // making _detailListControl invisible gets rid of the flicker at the
         // cost of a noticeable pause before the display changes on Linux/Mono.
         // A possible hack for Linux/Mono would be to #ifdef __MonoCS__ do the
         // following:
         // 1) add _detailListControl.SuspendLayout()/ResumeLayout() here.
         // 2) at the end of this function, put in a timer that asynchonously
         //    invokes _detailListControl.PerformLayout() after a short pause.
         // There would still be a bit of flicker possibly, but not as much as
         // seen without the visibility hack, and probably less overall computing
         // and thus less overall delay.
         _detailListControl.Visible = false;
         if (_detailListControl.RowCount > 0)
         {
             _detailListControl.Controls.Clear();
             _detailListControl.RowStyles.Clear();
             _detailListControl.RowCount = 0;
         }
         if (_record != null)
         {
             VerifyHasLexEntryRepository();
             _layout = new LexEntryLayouter(
                 _detailListControl,
                 0,
                 ViewTemplate,
                 _lexEntryRepository,
                 WeSayWordsProject.Project.ServiceLocator,
                 _record,
                 _senseDeletionEnabled,
                 _confirmDeleteFactory,
                 _showMinorMeaningLabel
                 )
             {
                 ShowNormallyHiddenFields = ShowNormallyHiddenFields
             };
             _layout.AddWidgets(_record, 0);
         }
         _detailListControl.Visible = true;
         _scrollableContainer.ResumeLayout();
     }
     catch (ConfigurationException e)
     {
         ErrorReport.NotifyUserOfProblem(e.Message);
     }
 }
示例#2
0
		private void RefreshEntryDetail()
		{
			try
			{
				_panelEntry.SuspendLayout();
				DetailList oldDetailList = _detailListControl;
				if (oldDetailList != null)
				{
					oldDetailList.ChangeOfWhichItemIsInFocus -= OnChangeOfWhichItemIsInFocus;
					oldDetailList.KeyDown -= _detailListControl_KeyDown;
				}

				DetailList detailList = new DetailList();
				_detailListControl = detailList;

				detailList.SuspendLayout();
				//
				// _detailListControl
				//
				detailList.BackColor = BackColor;
				detailList.Dock = DockStyle.Fill;
				detailList.Name = "_detailListControl";
				detailList.Size = _panelEntry.Size;
				detailList.TabIndex = 1;

				if (_record != null)
				{
					VerifyHasLexEntryRepository();
					LexEntryLayouter layout = new LexEntryLayouter(detailList,
																   ViewTemplate,
																   _lexEntryRepository);
					layout.ShowNormallyHiddenFields = ShowNormallyHiddenFields;
					layout.AddWidgets(_record);
				}
				detailList.Visible = false;
				_panelEntry.Controls.Add(detailList);
				detailList.ResumeLayout(true);
				detailList.Visible = true;
				_panelEntry.Controls.SetChildIndex(detailList, 0);

				if (oldDetailList != null)
				{
					_panelEntry.Controls.Remove(oldDetailList);
					oldDetailList.Dispose();
				}

				detailList.ChangeOfWhichItemIsInFocus += OnChangeOfWhichItemIsInFocus;
				detailList.KeyDown += _detailListControl_KeyDown;
				_panelEntry.ResumeLayout(false);
			}
			catch (ConfigurationException e)
			{
				ErrorReport.ReportNonFatalMessage(e.Message);
			}
		}