Added detection for design mode
This commit is contained in:
parent
aa641770d2
commit
3dfaccc99f
@ -62,6 +62,9 @@ public partial class LoaderStart : UserControl
|
|||||||
|
|
||||||
private void buttonOpen_Click(object sender, EventArgs e)
|
private void buttonOpen_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if(this.DesignMode)
|
||||||
|
return;
|
||||||
|
|
||||||
if(this.areRecentProjectsVisible)
|
if(this.areRecentProjectsVisible)
|
||||||
{
|
{
|
||||||
this.areRecentProjectsVisible = false;
|
this.areRecentProjectsVisible = false;
|
||||||
@ -91,6 +94,9 @@ public partial class LoaderStart : UserControl
|
|||||||
|
|
||||||
private void buttonNew_Click(object sender, EventArgs e)
|
private void buttonNew_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if(this.DesignMode)
|
||||||
|
return;
|
||||||
|
|
||||||
var saveDialog = new SaveFileDialog
|
var saveDialog = new SaveFileDialog
|
||||||
{
|
{
|
||||||
AddExtension = true,
|
AddExtension = true,
|
||||||
|
@ -13,6 +13,8 @@ public partial class SectionTree : UserControl
|
|||||||
public SectionTree()
|
public SectionTree()
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
this.InitializeComponent();
|
||||||
|
if(this.DesignMode)
|
||||||
|
return;
|
||||||
|
|
||||||
// Get the DI context from the main form:
|
// Get the DI context from the main form:
|
||||||
this.db = Program.SERVICE_PROVIDER.GetService<DataContext>()!;
|
this.db = Program.SERVICE_PROVIDER.GetService<DataContext>()!;
|
||||||
@ -35,6 +37,9 @@ public partial class SectionTree : UserControl
|
|||||||
|
|
||||||
private async void LoadNodes(object? sender, EventArgs e)
|
private async void LoadNodes(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if(this.DesignMode)
|
||||||
|
return;
|
||||||
|
|
||||||
// A dictionary to cache all known tree nodes:
|
// A dictionary to cache all known tree nodes:
|
||||||
var treeNodes = new Dictionary<string, TreeNode>();
|
var treeNodes = new Dictionary<string, TreeNode>();
|
||||||
|
|
||||||
@ -112,6 +117,9 @@ public partial class SectionTree : UserControl
|
|||||||
|
|
||||||
private async void buttonAdd_Click(object sender, EventArgs e)
|
private async void buttonAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if(this.DesignMode)
|
||||||
|
return;
|
||||||
|
|
||||||
var result = InputDialog.Show(new InputDialog.Options(
|
var result = InputDialog.Show(new InputDialog.Options(
|
||||||
Message: "Please type the desired section name.",
|
Message: "Please type the desired section name.",
|
||||||
Title: "Add a section",
|
Title: "Add a section",
|
||||||
@ -151,6 +159,9 @@ public partial class SectionTree : UserControl
|
|||||||
|
|
||||||
private async void buttonRemove_Click(object sender, EventArgs e)
|
private async void buttonRemove_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if(this.DesignMode)
|
||||||
|
return;
|
||||||
|
|
||||||
// Get the currently selected section, which will be removed:
|
// Get the currently selected section, which will be removed:
|
||||||
var selectedNode = this.treeView.SelectedNode;
|
var selectedNode = this.treeView.SelectedNode;
|
||||||
|
|
||||||
@ -175,6 +186,9 @@ public partial class SectionTree : UserControl
|
|||||||
|
|
||||||
private void treeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
|
private void treeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
|
||||||
{
|
{
|
||||||
|
if(this.DesignMode)
|
||||||
|
return;
|
||||||
|
|
||||||
// Get the currently selected section:
|
// Get the currently selected section:
|
||||||
var selectedNode = this.treeView.SelectedNode;
|
var selectedNode = this.treeView.SelectedNode;
|
||||||
|
|
||||||
@ -184,6 +198,9 @@ public partial class SectionTree : UserControl
|
|||||||
|
|
||||||
private async void buttonRename_Click(object sender, EventArgs e)
|
private async void buttonRename_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if(this.DesignMode)
|
||||||
|
return;
|
||||||
|
|
||||||
// Ask the user if he really wants to rename the section:
|
// 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)
|
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;
|
return;
|
||||||
|
@ -48,6 +48,9 @@ public partial class InputDialog : Form
|
|||||||
|
|
||||||
private void buttonOk_Click(object sender, EventArgs e)
|
private void buttonOk_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if(this.DesignMode)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(this.textBoxInput.Text))
|
if (!string.IsNullOrWhiteSpace(this.textBoxInput.Text))
|
||||||
{
|
{
|
||||||
this.DialogResult = DialogResult.OK;
|
this.DialogResult = DialogResult.OK;
|
||||||
|
@ -11,6 +11,9 @@ public partial class Loader : Form
|
|||||||
|
|
||||||
private void loaderStart_LoadProject(object sender, string projectFilePath)
|
private void loaderStart_LoadProject(object sender, string projectFilePath)
|
||||||
{
|
{
|
||||||
|
if(this.DesignMode)
|
||||||
|
return;
|
||||||
|
|
||||||
this.DataFile = projectFilePath;
|
this.DataFile = projectFilePath;
|
||||||
this.DialogResult = DialogResult.OK;
|
this.DialogResult = DialogResult.OK;
|
||||||
this.Close();
|
this.Close();
|
||||||
|
Loading…
Reference in New Issue
Block a user