Skip to content

Commit

Permalink
Revert "design changes"
Browse files Browse the repository at this point in the history
This reverts commit c33259f.
  • Loading branch information
borseno committed Feb 7, 2019
1 parent c33259f commit 2b95891
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 98 deletions.
6 changes: 0 additions & 6 deletions BorsenoTextEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CellSelectionDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CellSelectionDialog.Designer.cs">
<DependentUpon>CellSelectionDialog.cs</DependentUpon>
</Compile>
<Compile Include="ChooseFileFromDBForm.cs">
<SubType>Form</SubType>
</Compile>
Expand Down
39 changes: 0 additions & 39 deletions CellSelectionDialog.Designer.cs

This file was deleted.

21 changes: 0 additions & 21 deletions CellSelectionDialog.cs

This file was deleted.

2 changes: 1 addition & 1 deletion ChooseFileFromDBForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 3 additions & 27 deletions ChooseFileFromDBForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@ public partial class ChooseFileFromDBForm : Form
private readonly string _connectionString;
private readonly string _tableName;
private readonly string _nameColumnName;
private CellSelectionDialog csd = null;

public bool IsSelected { get; private set; } = false;
private bool _isSelected = false;

public string SelectedFileName
{
get
{
if (IsSelected)
if (_isSelected)
return filesDBdataGridView.SelectedCells[0].ToString();
return null;
}
Expand All @@ -51,36 +49,14 @@ private void OnLoad(object sender, EventArgs e)
dataAdapter.Fill(dataSet);
filesDBdataGridView.DataSource = dataSet.Tables[0];
}
csd = new CellSelectionDialog();
csd.FormClosing += CellSelectionDialog_FormClosing;
csd.Show();
}

private void OnSelected(object sender, EventArgs e)
{
if (filesDBdataGridView.SelectedCells.Count == 1)
IsSelected = true;
_isSelected = true;
else
MessageBox.Show(@"You can choose only one cell");
}

private void OnSelectionChanged(object sender, EventArgs e)
{
if (csd != null)
{
csd.Cells = filesDBdataGridView.SelectedCells;
csd.BringToFront();
}
}
private void CellSelectionDialog_FormClosing(object sender, FormClosingEventArgs e)
{
if (csd.DialogResult == DialogResult.OK)
{
//Do something with csd.cells
MessageBox.Show(csd.Cells[0].Value.ToString());
//set the form to null;
csd = null;
}
}
}
}
16 changes: 12 additions & 4 deletions DBFilePicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,23 @@ public DBFilePicker

public string GetFile()
{
// ??? I know it's a bad idea... I Tried to inherit from CommonDialog
while (!_chooseForm.IsSelected)
;
return _chooseForm.SelectedFileName;
_chooseForm.FormClosed += OnFormClosed;
_chooseForm.Show();



throw new NotImplementedException();
}

public string GetOrCreateFile()
{
throw new NotImplementedException();
}

private void OnFormClosed(object sender, EventArgs e)
{
_name = ((ChooseFileFromDBForm) sender).SelectedFileName;
GetFile();
}
}
}

0 comments on commit 2b95891

Please sign in to comment.