Skip to content

Commit 94e1288

Browse files
committed
Fixed minor issue with opening directories.
1 parent 03f32e1 commit 94e1288

File tree

2 files changed

+19
-41
lines changed

2 files changed

+19
-41
lines changed

Virtual_EDW/CustomTabPage.cs

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ class CustomTabPage : TabPage
4343
// Objects on main Tab Page
4444
readonly CheckBox _localCheckBoxSelectAll;
4545
readonly CheckedListBox _localCheckedListBox;
46-
readonly RichTextBox _localRichTextBox;
4746
readonly TextBox _localTextBoxFilter;
4847

4948
// Objects on the sub Tab Control (on the main Tab Page)
@@ -164,28 +163,18 @@ public CustomTabPage(string classification, string notes, Dictionary<string, VDW
164163
_localCheckBoxSelectAll.Name = "checkBoxSelectAll";
165164
_localCheckBoxSelectAll.Checked = true;
166165
_localCheckBoxSelectAll.Text = "Select all";
167-
_localCheckBoxSelectAll.CheckedChanged += new EventHandler(SelectAllCheckBoxItems);
166+
_localCheckBoxSelectAll.CheckedChanged += SelectAllCheckBoxItems;
168167

169168
// Add Checked List Box
170169
_localCheckedListBox = new CheckedListBox();
171170
localPanel.Controls.Add(_localCheckedListBox);
172171
_localCheckedListBox.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left);
173172
_localCheckedListBox.Location = new Point(17, 31);
174-
_localCheckedListBox.Size = new Size(393, 377);
173+
_localCheckedListBox.Size = new Size(393, 510);
175174
_localCheckedListBox.BorderStyle = BorderStyle.FixedSingle;
176175
_localCheckedListBox.CheckOnClick = true;
177176
_localCheckedListBox.Name = $"checkedListBox{classification}";
178177

179-
// Add User feedback RichTextBox (left hand side of form)
180-
_localRichTextBox = new RichTextBox();
181-
localPanel.Controls.Add(_localRichTextBox);
182-
_localRichTextBox.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
183-
_localRichTextBox.Location = new Point(17, 402);
184-
_localRichTextBox.Size = new Size(393, 120);
185-
_localRichTextBox.BorderStyle = BorderStyle.None;
186-
_localRichTextBox.BackColor = SystemColors.Window;
187-
_localRichTextBox.TextChanged += ScrollToCaret;
188-
189178
// Add 'Filter' Group Box
190179
var localGroupBoxFilter = new GroupBox();
191180
localPanel.Controls.Add(localGroupBoxFilter);
@@ -346,13 +335,13 @@ public CustomTabPage(string classification, string notes, Dictionary<string, VDW
346335
// Report back to the user if there is not metadata available
347336
if (itemList == null || itemList.Count == 0)
348337
{
349-
_localRichTextBox.Text = $"There was no metadata available to display {_inputNiceName} content. Please check the associated metadata schema (are there any {_inputNiceName} records available?) or the database connection.\r\n\r\n";
338+
RaiseOnChangeMainText($"There was no metadata available to display {_inputNiceName} content. Please check the associated metadata schema (are there any {_inputNiceName} records available?) or the database connection.\r\n\r\n");
350339
}
351340

352341
// Initial documentation as per the definition notes
353342
if (notes != null)
354343
{
355-
_localRichTextBox.AppendText(notes);
344+
RaiseOnChangeMainText(notes);
356345
}
357346

358347
// Set the tab pages back to what they were before reload
@@ -430,17 +419,6 @@ private void SubTabClick(object sender, EventArgs args)
430419
}
431420
}
432421

433-
/// <summary>
434-
/// Automatically scroll to the end of the text.
435-
/// </summary>
436-
/// <param name="sender"></param>
437-
/// <param name="e"></param>
438-
public void ScrollToCaret(object sender, EventArgs e)
439-
{
440-
_localRichTextBox.SelectionStart = _localRichTextBox.Text.Length;
441-
_localRichTextBox.ScrollToCaret();
442-
}
443-
444422
public void FilterItemList(object o, EventArgs e)
445423
{
446424
SetItemList(ItemList);
@@ -469,7 +447,7 @@ public void SetItemList(Dictionary<string, VDW_DataObjectMappingList> itemList)
469447
// Report back to the user if there is not metadata available
470448
if (_localCheckedListBox.Items.Count == 0)
471449
{
472-
_localRichTextBox.Text = $"There was no metadata available to display {_inputNiceName} content. Please check the associated metadata schema (are there any {_inputNiceName} records available?) or the database connection.";
450+
RaiseOnChangeMainText($"There was no metadata available to display {_inputNiceName} content. Please check the associated metadata schema (are there any {_inputNiceName} records available?) or the database connection.");
473451
}
474452

475453
// Set all the Check Boxes to 'checked'
@@ -533,7 +511,6 @@ private void DisplayPattern(object o, EventArgs e)
533511
if (StartUpIndicator == false)
534512
{
535513
ApplySyntaxHighlightingForHandlebars();
536-
//TextHandling.SyntaxHighlightHandlebars(localRichTextBoxGenerationPattern, localRichTextBoxGenerationPattern.Text);
537514
}
538515
}
539516

@@ -583,7 +560,6 @@ void Generate(object o, EventArgs e)
583560

584561
void DoWork()
585562
{
586-
_localRichTextBox.Clear();
587563
GenerateFromPattern();
588564
}
589565

@@ -605,7 +581,7 @@ private void GenerateFromPattern()
605581
for (int x = 0; x <= _localCheckedListBox.CheckedItems.Count - 1; x++)
606582
{
607583
var targetTableName = _localCheckedListBox.CheckedItems[x].ToString();
608-
_localRichTextBox.AppendText(@"Processing generation for " + targetTableName + ".\r\n");
584+
RaiseOnChangeMainText(@"Processing generation for " + targetTableName + ".\r\n");
609585

610586
// Only process the selected items in the total of available source-to-target mappings
611587
ItemList.TryGetValue(targetTableName, out var dataObjectMappingList);
@@ -686,7 +662,7 @@ private void GenerateFromPattern()
686662
}
687663
else
688664
{
689-
_localRichTextBox.AppendText($"There was no metadata selected to generate {_inputNiceName} code. Please check the metadata schema - are there any {_inputNiceName} objects selected?");
665+
RaiseOnChangeMainText($"There was no metadata selected to generate {_inputNiceName} code. Please check the metadata schema - are there any {_inputNiceName} objects selected?");
690666
}
691667

692668
// Report back to the user

Virtual_EDW/Form_Main.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,7 @@ private void pictureBox4_Click(object sender, EventArgs e)
938938
{
939939
var fileBrowserDialog = new FolderBrowserDialog();
940940

941+
fileBrowserDialog.RootFolder = Environment.SpecialFolder.MyComputer;
941942
var originalPath = textBoxMetadataPath.Text;
942943
fileBrowserDialog.SelectedPath = textBoxMetadataPath.Text;
943944

@@ -989,14 +990,16 @@ private void pictureBox4_Click(object sender, EventArgs e)
989990
private void pictureBox5_Click(object sender, EventArgs e)
990991
{
991992
var fileBrowserDialog = new FolderBrowserDialog();
993+
994+
fileBrowserDialog.RootFolder = Environment.SpecialFolder.MyComputer;
992995
fileBrowserDialog.SelectedPath = textBoxOutputPath.Text;
993996

994997
DialogResult result = fileBrowserDialog.ShowDialog();
995998

996999
if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fileBrowserDialog.SelectedPath))
9971000
{
998-
9991001
string finalPath;
1002+
10001003
if (fileBrowserDialog.SelectedPath.EndsWith(@"\"))
10011004
{
10021005
finalPath = fileBrowserDialog.SelectedPath;
@@ -1006,13 +1009,9 @@ private void pictureBox5_Click(object sender, EventArgs e)
10061009
finalPath = fileBrowserDialog.SelectedPath + @"\";
10071010
}
10081011

1009-
10101012
textBoxOutputPath.Text = finalPath;
10111013

1012-
1013-
richTextBoxInformationMain.Text =
1014-
"The code generation output will be saved at "+finalPath+".'";
1015-
1014+
richTextBoxInformationMain.Text = "The code generation output will be saved at "+finalPath+".'";
10161015

10171016
}
10181017
}
@@ -1044,6 +1043,8 @@ private void openInputDirectoryToolStripMenuItem_Click(object sender, EventArgs
10441043
private void pictureBoxUpdateLoadPatternPath_Click(object sender, EventArgs e)
10451044
{
10461045
var fileBrowserDialog = new FolderBrowserDialog();
1046+
1047+
fileBrowserDialog.RootFolder = Environment.SpecialFolder.MyComputer;
10471048
fileBrowserDialog.SelectedPath = textBoxLoadPatternPath.Text;
10481049

10491050
DialogResult result = fileBrowserDialog.ShowDialog();
@@ -1076,15 +1077,13 @@ private void pictureBoxUpdateLoadPatternPath_Click(object sender, EventArgs e)
10761077

10771078
if (fileCounter == 0)
10781079
{
1079-
richTextBoxInformationMain.Text =
1080-
"The selected directory does not seem to contain a loadPatternCollection.json file. Did you select a correct Load Pattern directory?";
1080+
richTextBoxInformationMain.Text = "The selected directory does not seem to contain a loadPatternCollection.json file. Did you select a correct Load Pattern directory?";
10811081
}
10821082
else
10831083
{
10841084
richTextBoxInformationMain.Text = "The path now points to a directory that contains the loadPatternCollection.json Load Pattern Collection file.";
10851085
}
10861086

1087-
10881087
// Update the parameters in memory.
10891088
VdwConfigurationSettings.LoadPatternPath = finalPath;
10901089
textBoxLoadPatternPath.Text = finalPath;
@@ -1097,7 +1096,6 @@ private void pictureBoxUpdateLoadPatternPath_Click(object sender, EventArgs e)
10971096
VdwConfigurationSettings.patternList.Clear();
10981097
VdwConfigurationSettings.patternList = LoadPatternFileHandling.LoadPatternCollection();
10991098
PopulateLoadPatternCollectionDataGrid();
1100-
11011099
}
11021100
}
11031101

@@ -1305,6 +1303,8 @@ private void backgroundWorkerEventLog_RunWorkerCompleted(object sender, RunWorke
13051303
private void pictureOpenTeamConfigurationFile_Click(object sender, EventArgs e)
13061304
{
13071305
var fileBrowserDialog = new FolderBrowserDialog();
1306+
1307+
fileBrowserDialog.RootFolder = Environment.SpecialFolder.MyComputer;
13081308
fileBrowserDialog.SelectedPath = textBoxTeamConfigurationPath.Text;
13091309

13101310
DialogResult result = fileBrowserDialog.ShowDialog();
@@ -1448,6 +1448,8 @@ private void comboBoxEnvironments_SelectedIndexChanged(object sender, EventArgs
14481448
private void pictureBoxOpenConnectionFile_Click(object sender, EventArgs e)
14491449
{
14501450
var fileBrowserDialog = new FolderBrowserDialog();
1451+
1452+
fileBrowserDialog.RootFolder = Environment.SpecialFolder.MyComputer;
14511453
fileBrowserDialog.SelectedPath = textBoxTeamConnectionsPath.Text;
14521454

14531455
DialogResult result = fileBrowserDialog.ShowDialog();

0 commit comments

Comments
 (0)