Skip to content

Commit

Permalink
Allow Edit of Data / Disk Name #12
Browse files Browse the repository at this point in the history
- Add double click and menu to edit 'Name'
- MessageBox warning before proceeding
  • Loading branch information
Smurf-IV committed Jan 27, 2019
1 parent 3a4e6f5 commit 5efd9d7
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 16 deletions.
10 changes: 3 additions & 7 deletions Elucidate/Elucidate/Controls/ProtectedDrivesDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,21 @@ public void FormClosing()
{
// have to stop "any" processes that might be refreshing as this is now closing
cancelTokenSrc.Cancel();
if (Interlocked.Exchange(ref useWaitCursor, 0) > 0)
{
UseWaitCursor = false;
}
}

private void IncrementWaitCursor()
{
if (Interlocked.Increment(ref useWaitCursor) == 1)
{
UseWaitCursor = true;
BeginInvoke((MethodInvoker) delegate { UseWaitCursor = true; });
}
}

private void DecrementWaitCursor()
{
if (Interlocked.Decrement(ref useWaitCursor) == 0)
{
UseWaitCursor = false;
BeginInvoke((MethodInvoker) delegate { UseWaitCursor = false; });
}
}

Expand Down Expand Up @@ -147,7 +143,7 @@ private void ProcessProtectedSpace(DataGridViewRow row, DriveInfo driveInfo,
});
}

BeginInvoke((MethodInvoker) delegate { DecrementWaitCursor(); });
DecrementWaitCursor();
}

/// <summary>
Expand Down
22 changes: 16 additions & 6 deletions Elucidate/Elucidate/Forms/Settings.Designer.cs

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

43 changes: 43 additions & 0 deletions Elucidate/Elucidate/Forms/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ public Settings()

snapShotSources.driveGrid.DragDrop += snapShotSourcesTreeView_DragDrop;
snapShotSources.driveGrid.DragOver += snapShotSourcesTreeView_DragOver;
snapShotSources.driveGrid.CellEndEdit += DriveGridOnCellEndEdit;
snapShotSources.driveGrid.DoubleClick += editName_Click;

ResizeRedraw = true;
SetStyle(ControlStyles.UserPaint, true);
Expand All @@ -100,6 +102,7 @@ public Settings()
}
}


private void Settings_Load(object sender, EventArgs e)
{
StartTree();
Expand Down Expand Up @@ -502,6 +505,46 @@ private void DRUnit_NewNode_MenuItem_Click(object sender, EventArgs e)
PerformSnapShotSourceAddNode(tvwChild);
}

private void editName_Click(object sender, EventArgs e)
{
DataGridViewRow selected = snapShotSources.driveGrid.SelectedRows[0];
if ((selected != null)
&& (selected.Index < snapShotSources.driveGrid.RowCount)
)
{
if (DialogResult.Yes == KryptonMessageBox.Show(this,
@"Changing a 'Name' will require a 'Full Sync' to be run.\nDo you wish to continue?",
@"Name Change Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
{
DataGridViewCell cell = selected.Cells[1];
snapShotSources.driveGrid.CurrentCell = cell;
snapShotSources.driveGrid.BeginEdit(true);
}
}
else
{
SystemSounds.Beep.Play();
}

ValidateFormData();
}

private void DriveGridOnCellEndEdit(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex != 1)
{
return;
}
DataGridViewRow selected = snapShotSources.driveGrid.Rows[e.RowIndex];
CoveragePath coveragePath = selected.Tag as CoveragePath;
string value = (string)selected.Cells[1].Value;
if (coveragePath.Name != value)
{
coveragePath.Name = value;
UnsavedChangesMade = true;
}
}

#endregion snapShotSourcesTreeView

public List<CoveragePath> GetPathsOfInterest()
Expand Down
2 changes: 1 addition & 1 deletion Elucidate/Elucidate/Forms/Settings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACS
KQAAAk1TRnQBSQFMAgEBCwEAAbQBBQG0AQUBEgEAARIBAAT/AREBAAj/AUIBTQE2BwABNgMAASgDAAFI
KQAAAk1TRnQBSQFMAgEBCwEAAcwBBQHMAQUBEgEAARIBAAT/AREBAAj/AUIBTQE2BwABNgMAASgDAAFI
AwABNgMAAQEBAAEQBQABYAEePAAB9wFeARABQgGMATEBqQE9AeIBVQHiAVUBwgFVAYsBMQGMATEBzgE5
AbUBVgFaAWsQAAHWAV4B7wFFAYwBPQH3AV4BWgFrAYwBPQGtAT0B1gFaMAABWgFrAdYBWgHWAVoBGAFj
ATkBZwFaAWscAAHWAVoBcwFOAVIBSgGQAVYBCwFzAQoBcwHgAVkBUAFKAVICSgEpAe8BPQEYAWMIAAEY
Expand Down
4 changes: 2 additions & 2 deletions Elucidate/Elucidate/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
// Build Number - Increment
// Revision - Day
//
[assembly: AssemblyVersion("2019.1.779.27")]
[assembly: AssemblyFileVersion("19.1.779.27")]
[assembly: AssemblyVersion("2019.1.783.27")]
[assembly: AssemblyFileVersion("19.1.783.27")]
[assembly: NeutralResourcesLanguage("en-US")]
// TODO: Add more relevant hints here
[assembly: Dependency("System", LoadHint.Always)]
Expand Down

0 comments on commit 5efd9d7

Please sign in to comment.