private void ResortGrid(BindingSource bindingSource, DoubleBufferedDataGridView dataGrid, FrameType frameType) { /*switch (frameType) * { * case FrameType.MethodJ: * case FrameType.MethodK: * IFrameCaptureComparer iframeCaptureComparer = new IFrameCaptureComparer { CompareType = "Seed" }; * ((List<IFrameCapture>)bindingSource.DataSource).Sort(iframeCaptureComparer); * dataGrid.Columns["CapSeed.HeaderCell.SortGlyphDirection = SortOrder.Ascending; * break; * }*/ dataGrid.DataSource = bindingSource; bindingSource.ResetBindings(false); }
private void ResortGrid(BindingSource bindingSource, DoubleBufferedDataGridView dataGrid, FrameType frameType) { switch (frameType) { case FrameType.Method5Standard: case FrameType.Method5Natures: case FrameType.Wondercard5thGen: case FrameType.Wondercard5thGenFixed: var iframeCaptureComparer = new IFrameCaptureComparer {CompareType = "TimeDate"}; ((List<IFrameCapture>) bindingSource.DataSource).Sort(iframeCaptureComparer); CapDateTime.HeaderCell.SortGlyphDirection = SortOrder.Ascending; break; case FrameType.BWBred: case FrameType.BWBredInternational: iframeCaptureComparer = new IFrameCaptureComparer {CompareType = "TimeDate"}; ((List<IFrameCapture>) bindingSource.DataSource).Sort(iframeCaptureComparer); ColumnEggDate.HeaderCell.SortGlyphDirection = SortOrder.Ascending; break; } dataGrid.DataSource = bindingSource; bindingSource.ResetBindings(false); }
private void ManageProgress(BindingSource bindingSource, DoubleBufferedDataGridView grid, FrameType frameType, int sleepTimer) { var progress = new Progress(); progress.SetupAndShow(this, 0, 0, false, true, waitHandle); progressSearched = 0; progressFound = 0; UpdateGridDelegate gridUpdater = UpdateGrid; var updateParams = new object[] {bindingSource}; ResortGridDelegate gridSorter = ResortGrid; var sortParams = new object[] {bindingSource, grid, frameType}; ThreadDelegate enableGenerateButton = EnableCapGenerate; try { bool alive = true; while (alive) { progress.ShowProgress(progressSearched/(float) progressTotal, progressSearched, progressFound); if (refreshQueue) { Invoke(gridUpdater, updateParams); refreshQueue = false; } if (jobs != null) { foreach (Thread job in jobs) { if (job != null && job.IsAlive) { alive = true; break; } alive = false; } } if (sleepTimer > 0) Thread.Sleep(sleepTimer); } } catch (ObjectDisposedException) { // This keeps the program from crashing when the Time Finder progress box // is closed from the Windows taskbar. } catch (Exception exception) { if (exception.Message != "Operation Cancelled") { throw; } } finally { progress.Finish(); if (jobs != null) { foreach (Thread t in jobs) { if (t != null) { t.Abort(); } } } Invoke(enableGenerateButton); Invoke(gridSorter, sortParams); } }
private void ManageProgress(BindingSource bindingSource, DoubleBufferedDataGridView grid, FrameType frameType, int sleepTimer) { var progress = new Progress(); progress.SetupAndShow(this, 0, 0, false, true, waitHandle); progressSearched = 0; progressFound = 0; UpdateGridDelegate gridUpdater = UpdateGrid; var updateParams = new object[] { bindingSource }; ResortGridDelegate gridSorter = ResortGrid; var sortParams = new object[] { bindingSource, grid, frameType }; ThreadDelegate enableGenerateButton = EnableSeedGenerate; try { bool alive = true; while (alive) { progress.ShowProgress(progressSearched / (float)progressTotal, progressSearched, progressFound); if (refreshQueue) { Invoke(gridUpdater, updateParams); refreshQueue = false; } if (jobs != null) { foreach (Thread job in jobs) { if (job != null && job.IsAlive) { alive = true; break; } alive = false; } } if (sleepTimer > 0) { Thread.Sleep(sleepTimer); } } } catch (ObjectDisposedException) { // This keeps the program from crashing when the Time Finder progress box // is closed from the Windows taskbar. } catch (Exception exception) { if (exception.Message != "Operation Cancelled") { throw; } } finally { progress.Finish(); if (jobs != null) { for (int i = 0; i < jobs.Length; i++) { if (jobs[i] != null) { jobs[i].Abort(); } } } Invoke(enableGenerateButton); Invoke(gridSorter, sortParams); } }
private void ResortGrid(BindingSource bindingSource, DoubleBufferedDataGridView dataGrid, FrameType frameType) { switch (frameType) { case FrameType.MethodJ: case FrameType.MethodK: var iframeCaptureComparer = new IFrameCaptureComparer {CompareType = "Seed"}; ((List<IFrameCapture>) bindingSource.DataSource).Sort(iframeCaptureComparer); CapSeed.HeaderCell.SortGlyphDirection = SortOrder.Ascending; break; } dataGrid.DataSource = bindingSource; bindingSource.ResetBindings(false); }
private void ResortGrid(BindingSource bindingSource, DoubleBufferedDataGridView dataGrid, FrameType frameType) { switch (frameType) { case FrameType.EBredPID: var iframeComparer = new IFrameEEggPIDComparer {CompareType = "Frame"}; ((List<IFrameEEggPID>) bindingSource.DataSource).Sort(iframeComparer); EPIDFrame.HeaderCell.SortGlyphDirection = SortOrder.Ascending; break; } dataGrid.DataSource = bindingSource; bindingSource.ResetBindings(false); }