/// <summary> /// This method prevents the control from painting until the /// <see cref="EndUpdate()" /> method is called. /// </summary> public void BeginUpdate() { if (this.InvokeRequired) { var beginUpdateDelegate = new BeginUpdateDelegate(this.BeginUpdate); this.Invoke(beginUpdateDelegate); return; } User32.SendMessage(this.Handle, User32.WMSETREDRAW, IntPtr.Zero, IntPtr.Zero); }
private void TestIsDone(FileInfo file, HtmlStore[] htmlStore) { string testName = String.Empty; EndConvertingDelegate endConvertingDelegate = new EndConvertingDelegate(EndConverting); if (htmlStore == null) { SystemMessage.ShowErrorMessage("Ошибка конвертации тестов."); _cancel = true; this.Invoke(endConvertingDelegate, new object[] { }); return; } if (_isUpdate) { BeginUpdateDelegate updateDelegate = new BeginUpdateDelegate(UpdateTest); this.Invoke(updateDelegate, new object[] { file.FullName, htmlStore }); return; } TestorData testorData = HtmlStore.GetDataSet(htmlStore, file, out testName); TestHelper testHelper = new TestHelper(ProjectState.DataPackageManager); testHelper.ConvTime = file.LastWriteTime; testHelper.TestId = testorData.CoreTests[0].TestId; testHelper.FullFileName = file.FullName; testHelper.TestorData = testorData; testHelper.TestName = testName; testHelper.QuestCount = testorData.CoreQuestions.Count(); foreach (var test in testorData.CoreTests) { testHelper.TestKey = test.TestKey.ToString(); } _tests.Add(testHelper); RefreshListDelegate refreshListDelegate = new RefreshListDelegate(RefreshList); this.Invoke(refreshListDelegate, new object[] { testHelper.TestName }); lock (this) { _testCount--; if (_testCount == 0 || _cancel) { this.Invoke(endConvertingDelegate, new object[] { }); return; } ConvertNext(); } }