diff --git a/I18N Commander/UI WinForms/Components/LoaderStart.cs b/I18N Commander/UI WinForms/Components/LoaderStart.cs index 052fe29..9a18582 100644 --- a/I18N Commander/UI WinForms/Components/LoaderStart.cs +++ b/I18N Commander/UI WinForms/Components/LoaderStart.cs @@ -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, diff --git a/I18N Commander/UI WinForms/Components/SectionTree.cs b/I18N Commander/UI WinForms/Components/SectionTree.cs index a3479b3..196facd 100644 --- a/I18N Commander/UI WinForms/Components/SectionTree.cs +++ b/I18N Commander/UI WinForms/Components/SectionTree.cs @@ -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()!; @@ -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(); @@ -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; diff --git a/I18N Commander/UI WinForms/Dialogs/InputDialog.cs b/I18N Commander/UI WinForms/Dialogs/InputDialog.cs index 25afee0..eb92d63 100644 --- a/I18N Commander/UI WinForms/Dialogs/InputDialog.cs +++ b/I18N Commander/UI WinForms/Dialogs/InputDialog.cs @@ -48,6 +48,9 @@ public partial class InputDialog : Form private void buttonOk_Click(object sender, EventArgs e) { + if(this.DesignMode) + return; + if (!string.IsNullOrWhiteSpace(this.textBoxInput.Text)) { this.DialogResult = DialogResult.OK; diff --git a/I18N Commander/UI WinForms/Loader.cs b/I18N Commander/UI WinForms/Loader.cs index 38065c7..6a6ca87 100644 --- a/I18N Commander/UI WinForms/Loader.cs +++ b/I18N Commander/UI WinForms/Loader.cs @@ -11,6 +11,9 @@ public partial class Loader : Form private void loaderStart_LoadProject(object sender, string projectFilePath) { + if(this.DesignMode) + return; + this.DataFile = projectFilePath; this.DialogResult = DialogResult.OK; this.Close(); diff --git a/I18N Commander/UI WinForms/Main.Designer.cs b/I18N Commander/UI WinForms/Main.Designer.cs index 3189ccc..2944fd8 100644 --- a/I18N Commander/UI WinForms/Main.Designer.cs +++ b/I18N Commander/UI WinForms/Main.Designer.cs @@ -3,12 +3,12 @@ partial class Main { /// - /// Required designer variable. + /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// - /// Clean up any resources being used. + /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) @@ -23,8 +23,8 @@ #region Windows Form Designer generated code /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. /// private void InitializeComponent() {