Skip to content

Commit 63d5dcf

Browse files
committed
Added double buffering to grid.
1 parent abc70d5 commit 63d5dcf

File tree

5 files changed

+40
-32
lines changed

5 files changed

+40
-32
lines changed

Virtual_EDW/App.config

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<runtime>
44
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
55
<dependentAssembly>
6-
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
7-
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
6+
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
7+
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0"/>
88
</dependentAssembly>
99
<dependentAssembly>
10-
<assemblyIdentity name="System.Data.SqlClient" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
11-
<bindingRedirect oldVersion="0.0.0.0-4.6.1.2" newVersion="4.6.1.2" />
10+
<assemblyIdentity name="System.Data.SqlClient" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
11+
<bindingRedirect oldVersion="0.0.0.0-4.6.1.2" newVersion="4.6.1.2"/>
1212
</dependentAssembly>
1313
<dependentAssembly>
14-
<assemblyIdentity name="System.Security.Principal.Windows" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
15-
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
14+
<assemblyIdentity name="System.Security.Principal.Windows" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
15+
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0"/>
1616
</dependentAssembly>
1717
<dependentAssembly>
18-
<assemblyIdentity name="System.Security.Cryptography.ProtectedData" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
19-
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
18+
<assemblyIdentity name="System.Security.Cryptography.ProtectedData" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
19+
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0"/>
2020
</dependentAssembly>
2121
<dependentAssembly>
22-
<assemblyIdentity name="Microsoft.Identity.Client" publicKeyToken="0a613f4dd989e8ae" culture="neutral" />
23-
<bindingRedirect oldVersion="0.0.0.0-4.23.0.0" newVersion="4.23.0.0" />
22+
<assemblyIdentity name="Microsoft.Identity.Client" publicKeyToken="0a613f4dd989e8ae" culture="neutral"/>
23+
<bindingRedirect oldVersion="0.0.0.0-4.23.0.0" newVersion="4.23.0.0"/>
2424
</dependentAssembly>
2525
</assemblyBinding>
2626
</runtime>
27-
</configuration>
27+
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>

Virtual_EDW/Form_Main.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ namespace Virtual_Data_Warehouse
1818
{
1919
public partial class FormMain : FormBase
2020
{
21-
internal bool startUpIndicator = true;
22-
23-
private readonly List<CustomTabPage> localCustomTabPageList = new List<CustomTabPage>();
24-
21+
internal bool startUpIndicator;
22+
private readonly List<CustomTabPage> localCustomTabPageList;
2523
private readonly BindingSource _bindingSourceLoadPatternCollection = new BindingSource();
2624

2725
FormAlert _alertEventLog;
@@ -33,11 +31,11 @@ public FormMain()
3331
InitializeComponent();
3432

3533
// Set the version of the build for everything
36-
const string versionNumberForApplication = "v1.6.7";
34+
const string versionNumberForApplication = "v1.6.8";
3735

3836
Text = $"Virtual Data Warehouse - {versionNumberForApplication}";
3937
labelWelcome.Text = $"{labelWelcome.Text} - { versionNumberForApplication}";
40-
;
38+
4139
VdwConfigurationSettings.VdwEventLog.Add(Event.CreateNewEvent(EventTypes.Information, $"{Text}."));
4240

4341
#region Root Paths
@@ -162,15 +160,15 @@ public sealed override string Text
162160
public void PopulateLoadPatternCollectionDataGrid()
163161
{
164162
// Convert into data table
165-
DataTable dt = VdwConfigurationSettings.patternList.ToDataTable();
163+
DataTable patternDataTable = VdwConfigurationSettings.patternList.ToDataTable();
166164

167165
// Accept changes
168-
dt.AcceptChanges();
166+
patternDataTable.AcceptChanges();
169167

170168
// Handle unknown combobox values, by setting them to empty.
171169
var localConnectionKeyList = LocalTeamConnection.TeamConnectionKeyList(TeamConfigurationSettings.ConnectionDictionary);
172170
List<string> userFeedbackList = new List<string>();
173-
foreach (DataRow row in dt.Rows)
171+
foreach (DataRow row in patternDataTable.Rows)
174172
{
175173
var comboBoxValueConnectionKey = row["LoadPatternConnectionKey"].ToString();
176174

@@ -195,16 +193,16 @@ public void PopulateLoadPatternCollectionDataGrid()
195193
}
196194

197195
//Make sure the changes are seen as committed, so that changes can be detected later on.
198-
dt.AcceptChanges();
196+
patternDataTable.AcceptChanges();
199197

200198
// Tidy-up headers
201-
dt.Columns[0].ColumnName = "Name";
202-
dt.Columns[1].ColumnName = "Type";
203-
dt.Columns[2].ColumnName = "Connection Key";
204-
dt.Columns[3].ColumnName = "Path";
205-
dt.Columns[4].ColumnName = "Notes";
199+
patternDataTable.Columns[0].ColumnName = "Name";
200+
patternDataTable.Columns[1].ColumnName = "Type";
201+
patternDataTable.Columns[2].ColumnName = "Connection Key";
202+
patternDataTable.Columns[3].ColumnName = "Path";
203+
patternDataTable.Columns[4].ColumnName = "Notes";
206204

207-
_bindingSourceLoadPatternCollection.DataSource = dt;
205+
_bindingSourceLoadPatternCollection.DataSource = patternDataTable;
208206
dataGridViewLoadPatternCollection.DataSource = _bindingSourceLoadPatternCollection;
209207

210208

@@ -219,6 +217,8 @@ public void CreateLoadPatternCollectionDataGrid()
219217
dataGridViewLoadPatternCollection.ColumnHeadersVisible = true;
220218
dataGridViewLoadPatternCollection.EditMode = DataGridViewEditMode.EditOnEnter;
221219

220+
dataGridViewLoadPatternCollection.DoubleBuffered(true);
221+
222222
DataGridViewTextBoxColumn loadPatternName = new DataGridViewTextBoxColumn
223223
{
224224
Name = "LoadPatternName",

Virtual_EDW/Properties/Resources.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Virtual_EDW/VdwUtility.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
using System;
22
using Microsoft.Data.SqlClient;
33
using System.IO;
4+
using System.Reflection;
45
using System.Text;
6+
using System.Windows.Forms;
57
using Microsoft.SqlServer.Management.Common;
68
using Microsoft.SqlServer.Management.Smo;
79
using TEAM;
810

11+
912
namespace Virtual_Data_Warehouse
1013
{
11-
public class VdwUtility
14+
public static class VdwUtility
1215
{
1316

1417
/// <summary>
@@ -293,8 +296,13 @@ public static void SaveOutputToDisk(string targetFile, string textContent)
293296
{
294297
FormBase.VdwConfigurationSettings.VdwEventLog.Add(Event.CreateNewEvent(EventTypes.Error, "There was an issue saving the output to disk. The message is: " + ex.Message + "\r\n\r\n"));
295298
}
299+
}
296300

297-
301+
public static void DoubleBuffered(this DataGridView dgv, bool setting)
302+
{
303+
Type dgvType = dgv.GetType();
304+
PropertyInfo pi = dgvType.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
305+
pi.SetValue(dgv, setting, null);
298306
}
299307
}
300308
}

Virtual_EDW/Virtual_Data_Warehouse.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>Virtual_Data_Warehouse</RootNamespace>
1111
<AssemblyName>Virtual_Data_Warehouse</AssemblyName>
12-
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
12+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<TargetFrameworkProfile />
1515
<IsWebBootstrapper>false</IsWebBootstrapper>

0 commit comments

Comments
 (0)