-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from mukunku/v2.2.1
fix: fill weight overflow when there are too many columns (#22)
- Loading branch information
Showing
8 changed files
with
358 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace ParquetFileViewer | ||
{ | ||
public static class Constants | ||
{ | ||
public const string FILL_WEIGHT_EXCEPTION_MESSAGE = "FillWeight"; | ||
} | ||
} |
144 changes: 72 additions & 72 deletions
144
...quetFileViewer/DelayedOnChangedTextBox.cs → ...iewer/Controls/DelayedOnChangedTextBox.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,72 @@ | ||
using System; | ||
using System.Windows.Forms; | ||
|
||
namespace ParquetFileViewer | ||
{ | ||
public class DelayedOnChangedTextBox : TextBox | ||
{ | ||
private Timer m_delayedTextChangedTimer; | ||
|
||
public event EventHandler DelayedTextChanged; | ||
|
||
public DelayedOnChangedTextBox() | ||
: base() | ||
{ | ||
this.DelayedTextChangedTimeout = 1 * 1000; | ||
} | ||
|
||
public DelayedOnChangedTextBox(int secondsDelay) | ||
: base() | ||
{ | ||
this.DelayedTextChangedTimeout = secondsDelay * 1000; | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
if (m_delayedTextChangedTimer != null) | ||
{ | ||
m_delayedTextChangedTimer.Stop(); | ||
if (disposing) | ||
m_delayedTextChangedTimer.Dispose(); | ||
} | ||
|
||
base.Dispose(disposing); | ||
} | ||
|
||
public int DelayedTextChangedTimeout { get; set; } | ||
|
||
protected virtual void OnDelayedTextChanged(EventArgs e) | ||
{ | ||
this.DelayedTextChanged?.Invoke(this, e); | ||
} | ||
|
||
protected override void OnTextChanged(EventArgs e) | ||
{ | ||
this.InitializeDelayedTextChangedEvent(); | ||
base.OnTextChanged(e); | ||
} | ||
|
||
private void InitializeDelayedTextChangedEvent() | ||
{ | ||
if (m_delayedTextChangedTimer != null) | ||
m_delayedTextChangedTimer.Stop(); | ||
|
||
if (m_delayedTextChangedTimer == null || m_delayedTextChangedTimer.Interval != this.DelayedTextChangedTimeout) | ||
{ | ||
m_delayedTextChangedTimer = new Timer(); | ||
m_delayedTextChangedTimer.Tick += new EventHandler(HandleDelayedTextChangedTimerTick); | ||
m_delayedTextChangedTimer.Interval = this.DelayedTextChangedTimeout; | ||
} | ||
|
||
m_delayedTextChangedTimer.Start(); | ||
} | ||
|
||
private void HandleDelayedTextChangedTimerTick(object sender, EventArgs e) | ||
{ | ||
Timer timer = sender as Timer; | ||
timer.Stop(); | ||
|
||
this.OnDelayedTextChanged(EventArgs.Empty); | ||
} | ||
} | ||
} | ||
using System; | ||
using System.Windows.Forms; | ||
|
||
namespace ParquetFileViewer.Controls | ||
{ | ||
public class DelayedOnChangedTextBox : TextBox | ||
{ | ||
private Timer m_delayedTextChangedTimer; | ||
|
||
public event EventHandler DelayedTextChanged; | ||
|
||
public DelayedOnChangedTextBox() | ||
: base() | ||
{ | ||
this.DelayedTextChangedTimeout = 1 * 1000; | ||
} | ||
|
||
public DelayedOnChangedTextBox(int secondsDelay) | ||
: base() | ||
{ | ||
this.DelayedTextChangedTimeout = secondsDelay * 1000; | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
if (m_delayedTextChangedTimer != null) | ||
{ | ||
m_delayedTextChangedTimer.Stop(); | ||
if (disposing) | ||
m_delayedTextChangedTimer.Dispose(); | ||
} | ||
|
||
base.Dispose(disposing); | ||
} | ||
|
||
public int DelayedTextChangedTimeout { get; set; } | ||
|
||
protected virtual void OnDelayedTextChanged(EventArgs e) | ||
{ | ||
this.DelayedTextChanged?.Invoke(this, e); | ||
} | ||
|
||
protected override void OnTextChanged(EventArgs e) | ||
{ | ||
this.InitializeDelayedTextChangedEvent(); | ||
base.OnTextChanged(e); | ||
} | ||
|
||
private void InitializeDelayedTextChangedEvent() | ||
{ | ||
if (m_delayedTextChangedTimer != null) | ||
m_delayedTextChangedTimer.Stop(); | ||
|
||
if (m_delayedTextChangedTimer == null || m_delayedTextChangedTimer.Interval != this.DelayedTextChangedTimeout) | ||
{ | ||
m_delayedTextChangedTimer = new Timer(); | ||
m_delayedTextChangedTimer.Tick += new EventHandler(HandleDelayedTextChangedTimerTick); | ||
m_delayedTextChangedTimer.Interval = this.DelayedTextChangedTimeout; | ||
} | ||
|
||
m_delayedTextChangedTimer.Start(); | ||
} | ||
|
||
private void HandleDelayedTextChangedTimerTick(object sender, EventArgs e) | ||
{ | ||
Timer timer = sender as Timer; | ||
timer.Stop(); | ||
|
||
this.OnDelayedTextChanged(EventArgs.Empty); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System.Collections.Generic; | ||
using System.Data; | ||
using System.Windows.Forms; | ||
|
||
namespace ParquetFileViewer.Helpers | ||
{ | ||
public static class ExtensionMethods | ||
{ | ||
/// <summary> | ||
/// Returns a list of all column names within a given datatable | ||
/// </summary> | ||
/// <param name="datatable">The datatable to retrieve the column names from</param> | ||
/// <returns></returns> | ||
public static IList<string> GetColumnNames(this DataTable datatable) | ||
{ | ||
List<string> columns = new List<string>(datatable.Columns.Count); | ||
foreach (DataColumn column in datatable.Columns) | ||
{ | ||
columns.Add(column.ColumnName); | ||
} | ||
return columns; | ||
} | ||
} | ||
} |
Oops, something went wrong.