Added some error handling to the section tree
This commit is contained in:
2 files changed
+45
-15
No files matched your search
@@ -141,11 +141,15 @@ public partial class SectionTree : UserControl
|
||||
// Add the new section to the database:
|
||||
var addedSection = await SectionProcessor.AddSection(this.db, result.Text, addRootNode ? null : selectedNode?.Name);
|
||||
|
||||
addedSection.ProcessError();
|
||||
if(!addedSection.Successful)
|
||||
return;
|
||||
|
||||
// Add the new section to the tree control:
|
||||
var node = new TreeNode
|
||||
{
|
||||
Name = addedSection.DataKey, // [sic] name is the key
|
||||
Text = addedSection.Name,
|
||||
Name = addedSection.Result!.DataKey, // [sic] name is the key
|
||||
Text = addedSection.Result.Name,
|
||||
StateImageIndex = 1,
|
||||
};
|
||||
|
||||
@@ -233,8 +237,12 @@ public partial class SectionTree : UserControl
|
||||
// Rename the section:
|
||||
var alteredSection = await SectionProcessor.RenameSection(this.db, selectedNode.Name, result.Text);
|
||||
|
||||
alteredSection.ProcessError();
|
||||
if(!alteredSection.Successful)
|
||||
return;
|
||||
|
||||
// Rename the selected node:
|
||||
selectedNode.Text = alteredSection.Name;
|
||||
selectedNode.Name = alteredSection.DataKey; // [sic] name is the key
|
||||
selectedNode.Text = alteredSection.Result!.Name;
|
||||
selectedNode.Name = alteredSection.Result.DataKey; // [sic] name is the key
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user