From e156c957016243c5267a567a97a0245c1c31337a Mon Sep 17 00:00:00 2001 From: IgorVskpsn Date: Mon, 16 Mar 2015 16:21:06 +0200 Subject: [PATCH 1/6] in the events the grids are now checked not to be null --- .../CandidatesBrowser/Forms/CandidateForm.cs | 38 ++++++++++++------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/sources/CandidatesBrowser/Forms/CandidateForm.cs b/sources/CandidatesBrowser/Forms/CandidateForm.cs index c7f14a3..a926180 100644 --- a/sources/CandidatesBrowser/Forms/CandidateForm.cs +++ b/sources/CandidatesBrowser/Forms/CandidateForm.cs @@ -55,17 +55,23 @@ private void RenewPhoto() private void commentsGridView_InitNewRow(object sender, DevExpress.XtraGrid.Views.Grid.InitNewRowEventArgs e) { - var newContact = (ContactWithCandidate)((GridView)sender).GetRow(e.RowHandle); - newContact.Date = DateTime.Now; - newContact.Type = ContactTypes.Call; - newContact.Comment = ""; + if (sender != null) + { + var newContact = (ContactWithCandidate)((GridView)sender).GetRow(e.RowHandle); + newContact.Date = DateTime.Now; + newContact.Type = ContactTypes.Call; + newContact.Comment = ""; + } } private void RowsDeletion(object sender, KeyEventArgs e) { - var gridView = (GridView)sender; - if (e.KeyCode == Keys.Delete) - gridView.DeleteSelectedRows(); + if (sender != null) + { + var gridView = (GridView)sender; + if (e.KeyCode == Keys.Delete) + gridView.DeleteSelectedRows(); + } } private void commentsGridView_KeyDown(object sender, KeyEventArgs e) @@ -75,9 +81,12 @@ private void commentsGridView_KeyDown(object sender, KeyEventArgs e) private void phonesGridView_InitNewRow(object sender, DevExpress.XtraGrid.Views.Grid.InitNewRowEventArgs e) { - var newPhone = (Phone)((GridView)sender).GetRow(e.RowHandle); - newPhone.Type = PhoneType.Mobile; - newPhone.PhoneNumber = ""; + if (sender != null) + { + var newPhone = (Phone)((GridView)sender).GetRow(e.RowHandle); + newPhone.Type = PhoneType.Mobile; + newPhone.PhoneNumber = ""; + } } private void phonesGridView_KeyDown(object sender, KeyEventArgs e) @@ -87,9 +96,12 @@ private void phonesGridView_KeyDown(object sender, KeyEventArgs e) private void socialNetworksGridView_InitNewRow(object sender, InitNewRowEventArgs e) { - var newSocNetowrk = (SocialNetwork)((GridView)sender).GetRow(e.RowHandle); - newSocNetowrk.Type = SocialNetworkType.Facebook; - newSocNetowrk.Link = ""; + if (sender != null) + { + var newSocNetowrk = (SocialNetwork)((GridView)sender).GetRow(e.RowHandle); + newSocNetowrk.Type = SocialNetworkType.Facebook; + newSocNetowrk.Link = ""; + } } private void socialNetworksGridView_KeyDown(object sender, KeyEventArgs e) From 831c3e061fad1b3323be7aa9d00b1c7c8d0ad34f Mon Sep 17 00:00:00 2001 From: IgorVskpsn Date: Mon, 16 Mar 2015 17:09:53 +0200 Subject: [PATCH 2/6] Save button just became Save and Close button --- .../Forms/CandidateForm.Designer.cs | 56 +++++++++---------- .../CandidatesBrowser/Forms/CandidateForm.cs | 20 +++++-- 2 files changed, 44 insertions(+), 32 deletions(-) diff --git a/sources/CandidatesBrowser/Forms/CandidateForm.Designer.cs b/sources/CandidatesBrowser/Forms/CandidateForm.Designer.cs index a4176ca..99b8cde 100644 --- a/sources/CandidatesBrowser/Forms/CandidateForm.Designer.cs +++ b/sources/CandidatesBrowser/Forms/CandidateForm.Designer.cs @@ -36,7 +36,7 @@ private void InitializeComponent() this.contactInformationLabel = new DevExpress.XtraEditors.LabelControl(); this.generalInforLabel = new DevExpress.XtraEditors.LabelControl(); this.cancelButton = new DevExpress.XtraEditors.SimpleButton(); - this.saveButton = new DevExpress.XtraEditors.SimpleButton(); + this.saveAndCloseButton = new DevExpress.XtraEditors.SimpleButton(); this.socialNetworksLabel = new DevExpress.XtraEditors.LabelControl(); this.phonesLabel = new DevExpress.XtraEditors.LabelControl(); this.commentsLabel = new DevExpress.XtraEditors.LabelControl(); @@ -90,7 +90,7 @@ private void InitializeComponent() this.genderLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); this.spaceBetweenEnglishAndGender = new DevExpress.XtraLayout.EmptySpaceItem(); this.englishLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); - this.saveButtonLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); + this.saveAndCloseButtonLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); this.cancelButtonLayoutControlItem = new DevExpress.XtraLayout.LayoutControlItem(); this.spaceAtFormBottom = new DevExpress.XtraLayout.EmptySpaceItem(); this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem(); @@ -143,7 +143,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.genderLayoutControlItem)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.spaceBetweenEnglishAndGender)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.englishLayoutControlItem)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.saveButtonLayoutControlItem)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.saveAndCloseButtonLayoutControlItem)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.cancelButtonLayoutControlItem)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.spaceAtFormBottom)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).BeginInit(); @@ -156,7 +156,7 @@ private void InitializeComponent() this.rootLayout.Controls.Add(this.contactInformationLabel); this.rootLayout.Controls.Add(this.generalInforLabel); this.rootLayout.Controls.Add(this.cancelButton); - this.rootLayout.Controls.Add(this.saveButton); + this.rootLayout.Controls.Add(this.saveAndCloseButton); this.rootLayout.Controls.Add(this.socialNetworksLabel); this.rootLayout.Controls.Add(this.phonesLabel); this.rootLayout.Controls.Add(this.commentsLabel); @@ -241,23 +241,23 @@ private void InitializeComponent() // // cancelButton // - this.cancelButton.Location = new System.Drawing.Point(739, 457); + this.cancelButton.Location = new System.Drawing.Point(718, 457); this.cancelButton.Name = "cancelButton"; - this.cancelButton.Size = new System.Drawing.Size(65, 22); + this.cancelButton.Size = new System.Drawing.Size(86, 22); this.cancelButton.StyleController = this.rootLayout; this.cancelButton.TabIndex = 21; this.cancelButton.Text = "Cancel"; this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click); // - // saveButton + // saveAndCloseButton // - this.saveButton.Location = new System.Drawing.Point(670, 457); - this.saveButton.Name = "saveButton"; - this.saveButton.Size = new System.Drawing.Size(65, 22); - this.saveButton.StyleController = this.rootLayout; - this.saveButton.TabIndex = 20; - this.saveButton.Text = "Save"; - this.saveButton.Click += new System.EventHandler(this.saveButton_Click); + this.saveAndCloseButton.Location = new System.Drawing.Point(628, 457); + this.saveAndCloseButton.Name = "saveAndCloseButton"; + this.saveAndCloseButton.Size = new System.Drawing.Size(86, 22); + this.saveAndCloseButton.StyleController = this.rootLayout; + this.saveAndCloseButton.TabIndex = 20; + this.saveAndCloseButton.Text = "Save and Close"; + this.saveAndCloseButton.Click += new System.EventHandler(this.saveAndCloseButton_Click); // // socialNetworksLabel // @@ -526,7 +526,7 @@ private void InitializeComponent() this.commentsLayoutGroup, this.contactsLayoutGroup, this.generalInfoLayoutGroup, - this.saveButtonLayoutControlItem, + this.saveAndCloseButtonLayoutControlItem, this.cancelButtonLayoutControlItem, this.spaceAtFormBottom, this.emptySpaceItem1}); @@ -771,21 +771,21 @@ private void InitializeComponent() this.englishLayoutControlItem.Text = "English level:"; this.englishLayoutControlItem.TextSize = new System.Drawing.Size(63, 13); // - // saveButtonLayoutControlItem + // saveAndCloseButtonLayoutControlItem // - this.saveButtonLayoutControlItem.Control = this.saveButton; - this.saveButtonLayoutControlItem.Location = new System.Drawing.Point(668, 455); - this.saveButtonLayoutControlItem.Name = "saveButtonLayoutControlItem"; - this.saveButtonLayoutControlItem.Size = new System.Drawing.Size(69, 26); - this.saveButtonLayoutControlItem.TextSize = new System.Drawing.Size(0, 0); - this.saveButtonLayoutControlItem.TextVisible = false; + this.saveAndCloseButtonLayoutControlItem.Control = this.saveAndCloseButton; + this.saveAndCloseButtonLayoutControlItem.Location = new System.Drawing.Point(626, 455); + this.saveAndCloseButtonLayoutControlItem.Name = "saveAndCloseButtonLayoutControlItem"; + this.saveAndCloseButtonLayoutControlItem.Size = new System.Drawing.Size(90, 26); + this.saveAndCloseButtonLayoutControlItem.TextSize = new System.Drawing.Size(0, 0); + this.saveAndCloseButtonLayoutControlItem.TextVisible = false; // // cancelButtonLayoutControlItem // this.cancelButtonLayoutControlItem.Control = this.cancelButton; - this.cancelButtonLayoutControlItem.Location = new System.Drawing.Point(737, 455); + this.cancelButtonLayoutControlItem.Location = new System.Drawing.Point(716, 455); this.cancelButtonLayoutControlItem.Name = "cancelButtonLayoutControlItem"; - this.cancelButtonLayoutControlItem.Size = new System.Drawing.Size(69, 26); + this.cancelButtonLayoutControlItem.Size = new System.Drawing.Size(90, 26); this.cancelButtonLayoutControlItem.TextSize = new System.Drawing.Size(0, 0); this.cancelButtonLayoutControlItem.TextVisible = false; // @@ -794,7 +794,7 @@ private void InitializeComponent() this.spaceAtFormBottom.AllowHotTrack = false; this.spaceAtFormBottom.Location = new System.Drawing.Point(0, 455); this.spaceAtFormBottom.Name = "spaceAtFormBottom"; - this.spaceAtFormBottom.Size = new System.Drawing.Size(668, 26); + this.spaceAtFormBottom.Size = new System.Drawing.Size(626, 26); this.spaceAtFormBottom.TextSize = new System.Drawing.Size(0, 0); // // emptySpaceItem1 @@ -863,7 +863,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.genderLayoutControlItem)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.spaceBetweenEnglishAndGender)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.englishLayoutControlItem)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.saveButtonLayoutControlItem)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.saveAndCloseButtonLayoutControlItem)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.cancelButtonLayoutControlItem)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.spaceAtFormBottom)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).EndInit(); @@ -914,9 +914,9 @@ private void InitializeComponent() private DevExpress.XtraLayout.LayoutControlItem socialNetworksLabelLayoutControlItem; private DevExpress.XtraEditors.LabelControl generalInforLabel; private DevExpress.XtraEditors.SimpleButton cancelButton; - private DevExpress.XtraEditors.SimpleButton saveButton; + private DevExpress.XtraEditors.SimpleButton saveAndCloseButton; private DevExpress.XtraLayout.LayoutControlItem generalInfoLabelLayoutControlItem; - private DevExpress.XtraLayout.LayoutControlItem saveButtonLayoutControlItem; + private DevExpress.XtraLayout.LayoutControlItem saveAndCloseButtonLayoutControlItem; private DevExpress.XtraLayout.LayoutControlItem cancelButtonLayoutControlItem; private DevExpress.XtraLayout.EmptySpaceItem spaceAtFormBottom; private DevExpress.XtraLayout.EmptySpaceItem spaceBetweenEnglishAndGender; diff --git a/sources/CandidatesBrowser/Forms/CandidateForm.cs b/sources/CandidatesBrowser/Forms/CandidateForm.cs index a926180..e112602 100644 --- a/sources/CandidatesBrowser/Forms/CandidateForm.cs +++ b/sources/CandidatesBrowser/Forms/CandidateForm.cs @@ -53,6 +53,9 @@ private void RenewPhoto() private Candidate candidate, candidateCopy; + // Added to avoid double checking that candidate == candidateCopy when Save and Close button is pressed. + private bool saved = false; + private void commentsGridView_InitNewRow(object sender, DevExpress.XtraGrid.Views.Grid.InitNewRowEventArgs e) { if (sender != null) @@ -108,10 +111,14 @@ private void socialNetworksGridView_KeyDown(object sender, KeyEventArgs e) { RowsDeletion(sender, e); } - - private void saveButton_Click(object sender, EventArgs e) + + private void saveAndCloseButton_Click(object sender, EventArgs e) { - SaveCandidate(); + if (!this.candidate.Equals(this.candidateCopy)) + SaveCandidate(); + saved = true; + + Close(); } private void cancelButton_Click(object sender, EventArgs e) @@ -121,7 +128,12 @@ private void cancelButton_Click(object sender, EventArgs e) private void CandidateForm_FormClosing(object sender, FormClosingEventArgs e) { - if (!this.candidate.Equals(this.candidateCopy)) + // if Save and Close button was pressed, everything is already up to date and we don't need to check it. + if (saved) + { + saved = false; + } + else if (!this.candidate.Equals(this.candidateCopy)) { var result = MessageBox.Show("Record has been changed but not saved.\nDo you want to save changes?", "Warning", MessageBoxButtons.YesNoCancel); From 3407819afc324656297106ae2b42a9a79b23edfa Mon Sep 17 00:00:00 2001 From: IgorVskpsn Date: Mon, 16 Mar 2015 17:24:21 +0200 Subject: [PATCH 3/6] candidate form now closes when escape button is pressed --- sources/CandidatesBrowser/Forms/CandidateForm.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/CandidatesBrowser/Forms/CandidateForm.cs b/sources/CandidatesBrowser/Forms/CandidateForm.cs index e112602..7b1c70a 100644 --- a/sources/CandidatesBrowser/Forms/CandidateForm.cs +++ b/sources/CandidatesBrowser/Forms/CandidateForm.cs @@ -20,6 +20,8 @@ public CandidateForm() InitializeComponent(); englishLevelComboBox.Properties.Items.AddRange(typeof (HumanResourcesLibrary.DataClasses.EnglishLevel).GetEnumValues()); genderComboBox.Properties.Items.AddRange(typeof(HumanResourcesLibrary.DataClasses.Gender).GetEnumValues()); + + this.CancelButton = this.cancelButton; // pressing ESC is now equivalent to pressing Cancel } // TODO: you are free to change this name if you have a better one. From e1cf3e29f46f5bce625a52b2710cd500fcb0effa Mon Sep 17 00:00:00 2001 From: IgorVskpsn Date: Mon, 16 Mar 2015 17:44:54 +0200 Subject: [PATCH 4/6] closing dialog's text was added to resource file --- .../CandidatesBrowser/Forms/CandidateForm.cs | 32 +++++++++++-------- .../Forms/CandidateForm.resx | 23 ++++++++----- 2 files changed, 34 insertions(+), 21 deletions(-) diff --git a/sources/CandidatesBrowser/Forms/CandidateForm.cs b/sources/CandidatesBrowser/Forms/CandidateForm.cs index 7b1c70a..a949ff0 100644 --- a/sources/CandidatesBrowser/Forms/CandidateForm.cs +++ b/sources/CandidatesBrowser/Forms/CandidateForm.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using System.Windows.Forms; using System.IO; +using System.Resources; using HumanResourcesLibrary.DataClasses; // for Candidate using DevExpress.XtraGrid.Views.Grid; @@ -55,7 +56,7 @@ private void RenewPhoto() private Candidate candidate, candidateCopy; - // Added to avoid double checking that candidate == candidateCopy when Save and Close button is pressed. + // Added to avoid double checking that candidate equals candidateCopy when Save and Close button is pressed. private bool saved = false; private void commentsGridView_InitNewRow(object sender, DevExpress.XtraGrid.Views.Grid.InitNewRowEventArgs e) @@ -137,21 +138,26 @@ private void CandidateForm_FormClosing(object sender, FormClosingEventArgs e) } else if (!this.candidate.Equals(this.candidateCopy)) { - var result = MessageBox.Show("Record has been changed but not saved.\nDo you want to save changes?", - "Warning", MessageBoxButtons.YesNoCancel); - - switch (result) + using (var resources = new ResXResourceSet("..\\..\\Forms\\CandidateForm.resx")) { - case DialogResult.Yes: - SaveCandidate(); - break; + var message = resources.GetString("ClosingMessage"); + var title = resources.GetString("ClosingMBoxTitle"); - case DialogResult.No: - break; + var result = MessageBox.Show(message, title, MessageBoxButtons.YesNoCancel); - case DialogResult.Cancel: - e.Cancel = true; - break; + switch (result) + { + case DialogResult.Yes: + SaveCandidate(); + break; + + case DialogResult.No: + break; + + case DialogResult.Cancel: + e.Cancel = true; + break; + } } } } diff --git a/sources/CandidatesBrowser/Forms/CandidateForm.resx b/sources/CandidatesBrowser/Forms/CandidateForm.resx index 65cb962..47715f4 100644 --- a/sources/CandidatesBrowser/Forms/CandidateForm.resx +++ b/sources/CandidatesBrowser/Forms/CandidateForm.resx @@ -117,16 +117,23 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + + 25, 7 - - + + 395, 17 - - + + 201, 17 - - + + 626, 17 - + + + Warning + + + Record has been changed but not saved.\nDo you want to save changes? + \ No newline at end of file From e48ab9217bf458d9360754ac8e00a15241c7a7d8 Mon Sep 17 00:00:00 2001 From: IgorVskpsn Date: Mon, 16 Mar 2015 17:52:32 +0200 Subject: [PATCH 5/6] the resources' location was fixed --- .../CandidatesBrowser.csproj | 1 + .../CandidatesBrowser/Forms/CandidateForm.cs | 6 +- .../Forms/CandidateForm.resx | 23 +++---- .../Properties/Resources.Designer.cs | 62 +++++++++++-------- .../Properties/Resources.resx | 19 ++++-- 5 files changed, 62 insertions(+), 49 deletions(-) diff --git a/sources/CandidatesBrowser/CandidatesBrowser.csproj b/sources/CandidatesBrowser/CandidatesBrowser.csproj index ffc684b..ed2c688 100644 --- a/sources/CandidatesBrowser/CandidatesBrowser.csproj +++ b/sources/CandidatesBrowser/CandidatesBrowser.csproj @@ -82,6 +82,7 @@ True Resources.resx + True diff --git a/sources/CandidatesBrowser/Forms/CandidateForm.cs b/sources/CandidatesBrowser/Forms/CandidateForm.cs index a949ff0..727be55 100644 --- a/sources/CandidatesBrowser/Forms/CandidateForm.cs +++ b/sources/CandidatesBrowser/Forms/CandidateForm.cs @@ -138,10 +138,10 @@ private void CandidateForm_FormClosing(object sender, FormClosingEventArgs e) } else if (!this.candidate.Equals(this.candidateCopy)) { - using (var resources = new ResXResourceSet("..\\..\\Forms\\CandidateForm.resx")) + using (var resources = new ResXResourceSet("..\\..\\Properties\\Resources.resx")) { - var message = resources.GetString("ClosingMessage"); - var title = resources.GetString("ClosingMBoxTitle"); + var message = resources.GetString("CandidateFormClosingMessage"); + var title = resources.GetString("CandidateFormClosingMBoxTitle"); var result = MessageBox.Show(message, title, MessageBoxButtons.YesNoCancel); diff --git a/sources/CandidatesBrowser/Forms/CandidateForm.resx b/sources/CandidatesBrowser/Forms/CandidateForm.resx index 47715f4..65cb962 100644 --- a/sources/CandidatesBrowser/Forms/CandidateForm.resx +++ b/sources/CandidatesBrowser/Forms/CandidateForm.resx @@ -117,23 +117,16 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - + 25, 7 - - + + 395, 17 - - + + 201, 17 - - + + 626, 17 - - - Warning - - - Record has been changed but not saved.\nDo you want to save changes? - + \ No newline at end of file diff --git a/sources/CandidatesBrowser/Properties/Resources.Designer.cs b/sources/CandidatesBrowser/Properties/Resources.Designer.cs index 4b0a56a..71ed2b6 100644 --- a/sources/CandidatesBrowser/Properties/Resources.Designer.cs +++ b/sources/CandidatesBrowser/Properties/Resources.Designer.cs @@ -1,17 +1,17 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18063 +// Runtime Version:4.0.30319.18444 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ -namespace CandidatesBrowser.Properties -{ - - +namespace CandidatesBrowser.Properties { + using System; + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -22,50 +22,60 @@ namespace CandidatesBrowser.Properties [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - + internal class Resources { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { + internal Resources() { } - + /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CandidatesBrowser.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } + + /// + /// Looks up a localized string similar to Warning. + /// + internal static string CandidateFormClosingMBoxTitle { + get { + return ResourceManager.GetString("CandidateFormClosingMBoxTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Record has been changed but not saved. Do you want to save changes?. + /// + internal static string CandidateFormClosingMessage { + get { + return ResourceManager.GetString("CandidateFormClosingMessage", resourceCulture); + } + } } } diff --git a/sources/CandidatesBrowser/Properties/Resources.resx b/sources/CandidatesBrowser/Properties/Resources.resx index af7dbeb..cce0f59 100644 --- a/sources/CandidatesBrowser/Properties/Resources.resx +++ b/sources/CandidatesBrowser/Properties/Resources.resx @@ -46,7 +46,7 @@ mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with - : System.Serialization.Formatters.Binary.BinaryFormatter + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 @@ -60,6 +60,7 @@ : and then encoded with base64 encoding. --> + @@ -68,9 +69,10 @@ - + + @@ -85,9 +87,10 @@ - + + @@ -109,9 +112,15 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Warning + + + Record has been changed but not saved. Do you want to save changes? + \ No newline at end of file From bcf30f0549e98fae31dbf3961db7dbb7b9bd0090 Mon Sep 17 00:00:00 2001 From: IgorVskpsn Date: Mon, 16 Mar 2015 18:17:27 +0200 Subject: [PATCH 6/6] more checks to null --- .../CandidatesBrowser/Forms/CandidatesBrowserMainForm.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sources/CandidatesBrowser/Forms/CandidatesBrowserMainForm.cs b/sources/CandidatesBrowser/Forms/CandidatesBrowserMainForm.cs index df7bca0..9523a07 100644 --- a/sources/CandidatesBrowser/Forms/CandidatesBrowserMainForm.cs +++ b/sources/CandidatesBrowser/Forms/CandidatesBrowserMainForm.cs @@ -38,14 +38,17 @@ private void addButton_Click(object sender, EventArgs e) private void editButton_Click(object sender, EventArgs e) { - if (mainGridView.SelectedRowsCount == 1) + if (mainGridView != null && mainGridView.SelectedRowsCount == 1) this.mainGridView_DoubleClick(mainGridView, e); } private void mainGridView_DoubleClick(object sender, EventArgs e) { - candidateForm.FormCandidate = (Candidate)((GridView)sender).GetRow(((GridView)sender).FocusedRowHandle); - candidateForm.ShowDialog(); + if (sender != null) + { + candidateForm.FormCandidate = (Candidate)((GridView)sender).GetRow(((GridView)sender).FocusedRowHandle); + candidateForm.ShowDialog(); + } } } }