Added detection for design mode
This commit is contained in:
5 files changed
+34
-5
No files matched your search
@@ -62,6 +62,9 @@ public partial class LoaderStart : UserControl
|
||||
|
||||
private void buttonOpen_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(this.DesignMode)
|
||||
return;
|
||||
|
||||
if(this.areRecentProjectsVisible)
|
||||
{
|
||||
this.areRecentProjectsVisible = false;
|
||||
@@ -91,6 +94,9 @@ public partial class LoaderStart : UserControl
|
||||
|
||||
private void buttonNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(this.DesignMode)
|
||||
return;
|
||||
|
||||
var saveDialog = new SaveFileDialog
|
||||
{
|
||||
AddExtension = true,
|
||||
|
||||
@@ -13,7 +13,9 @@ public partial class SectionTree : UserControl
|
||||
public SectionTree()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
if(this.DesignMode)
|
||||
return;
|
||||
|
||||
// Get the DI context from the main form:
|
||||
this.db = Program.SERVICE_PROVIDER.GetService<DataContext>()!;
|
||||
|
||||
@@ -35,6 +37,9 @@ public partial class SectionTree : UserControl
|
||||
|
||||
private async void LoadNodes(object? sender, EventArgs e)
|
||||
{
|
||||
if(this.DesignMode)
|
||||
return;
|
||||
|
||||
// A dictionary to cache all known tree nodes:
|
||||
var treeNodes = new Dictionary<string, TreeNode>();
|
||||
|
||||
@@ -112,6 +117,9 @@ public partial class SectionTree : UserControl
|
||||
|
||||
private async void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(this.DesignMode)
|
||||
return;
|
||||
|
||||
var result = InputDialog.Show(new InputDialog.Options(
|
||||
Message: "Please type the desired section name.",
|
||||
Title: "Add a section",
|
||||
@@ -151,6 +159,9 @@ public partial class SectionTree : UserControl
|
||||
|
||||
private async void buttonRemove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(this.DesignMode)
|
||||
return;
|
||||
|
||||
// Get the currently selected section, which will be removed:
|
||||
var selectedNode = this.treeView.SelectedNode;
|
||||
|
||||
@@ -175,6 +186,9 @@ public partial class SectionTree : UserControl
|
||||
|
||||
private void treeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
|
||||
{
|
||||
if(this.DesignMode)
|
||||
return;
|
||||
|
||||
// Get the currently selected section:
|
||||
var selectedNode = this.treeView.SelectedNode;
|
||||
|
||||
@@ -184,6 +198,9 @@ public partial class SectionTree : UserControl
|
||||
|
||||
private async void buttonRename_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(this.DesignMode)
|
||||
return;
|
||||
|
||||
// Ask the user if he really wants to rename the section:
|
||||
if(MessageBox.Show("Are you sure, you want to rename the selected section? If you are already using this section in your code, you will need to manually refactor your code after renaming it.", "Rename section", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No)
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user