Index: Application/Ringtoets/src/Application.Ringtoets/App.xaml.cs =================================================================== diff -u -r1eed3e3f652618c52a462edc502cfd4250772314 -rfa3a16496921649188ae04c0df6392dad64e100b --- Application/Ringtoets/src/Application.Ringtoets/App.xaml.cs (.../App.xaml.cs) (revision 1eed3e3f652618c52a462edc502cfd4250772314) +++ Application/Ringtoets/src/Application.Ringtoets/App.xaml.cs (.../App.xaml.cs) (revision fa3a16496921649188ae04c0df6392dad64e100b) @@ -316,7 +316,7 @@ { if (gui != null && gui.MainWindow != null) { - using (var exceptionDialog = new ExceptionDialog(gui.MainWindow, exception) + using (var exceptionDialog = new ExceptionDialog(gui.MainWindow, gui, exception) { OpenLogClicked = () => { Index: Application/Ringtoets/src/Application.Ringtoets/Application.Ringtoets.csproj =================================================================== diff -u -r1eed3e3f652618c52a462edc502cfd4250772314 -rfa3a16496921649188ae04c0df6392dad64e100b --- Application/Ringtoets/src/Application.Ringtoets/Application.Ringtoets.csproj (.../Application.Ringtoets.csproj) (revision 1eed3e3f652618c52a462edc502cfd4250772314) +++ Application/Ringtoets/src/Application.Ringtoets/Application.Ringtoets.csproj (.../Application.Ringtoets.csproj) (revision fa3a16496921649188ae04c0df6392dad64e100b) @@ -243,6 +243,7 @@ ResXFileCodeGenerator Resources.Designer.cs + Designer Index: Application/Ringtoets/src/Application.Ringtoets/ExceptionDialog.Designer.cs =================================================================== diff -u -r34af24d6bf23796e627fd03b7532d4abe6fc715c -rfa3a16496921649188ae04c0df6392dad64e100b --- Application/Ringtoets/src/Application.Ringtoets/ExceptionDialog.Designer.cs (.../ExceptionDialog.Designer.cs) (revision 34af24d6bf23796e627fd03b7532d4abe6fc715c) +++ Application/Ringtoets/src/Application.Ringtoets/ExceptionDialog.Designer.cs (.../ExceptionDialog.Designer.cs) (revision fa3a16496921649188ae04c0df6392dad64e100b) @@ -56,6 +56,7 @@ this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.buttonExit = new System.Windows.Forms.Button(); this.buttonOpenLog = new System.Windows.Forms.Button(); + this.buttonSaveProject = new System.Windows.Forms.Button(); this.SuspendLayout(); // // buttonRestart @@ -104,6 +105,13 @@ this.buttonOpenLog.UseVisualStyleBackColor = true; this.buttonOpenLog.Click += new System.EventHandler(this.ButtonOpenLogClick); // + // buttonSaveProject + // + resources.ApplyResources(this.buttonSaveProject, "buttonSaveProject"); + this.buttonSaveProject.Name = "buttonSaveProject"; + this.buttonSaveProject.UseVisualStyleBackColor = true; + this.buttonSaveProject.Click += new System.EventHandler(this.ButtonSaveProjectClick); + // // ExceptionDialog // this.AcceptButton = this.buttonRestart; @@ -114,6 +122,7 @@ this.Controls.Add(this.richTextBox1); this.Controls.Add(this.buttonCopyTextToClipboard); this.Controls.Add(this.buttonRestart); + this.Controls.Add(this.buttonSaveProject); this.Name = "ExceptionDialog"; this.ResumeLayout(false); } @@ -126,5 +135,6 @@ private System.Windows.Forms.RichTextBox richTextBox1; private System.Windows.Forms.Button buttonExit; private System.Windows.Forms.Button buttonOpenLog; + private System.Windows.Forms.Button buttonSaveProject; } } \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets/ExceptionDialog.cs =================================================================== diff -u -r34af24d6bf23796e627fd03b7532d4abe6fc715c -rfa3a16496921649188ae04c0df6392dad64e100b --- Application/Ringtoets/src/Application.Ringtoets/ExceptionDialog.cs (.../ExceptionDialog.cs) (revision 34af24d6bf23796e627fd03b7532d4abe6fc715c) +++ Application/Ringtoets/src/Application.Ringtoets/ExceptionDialog.cs (.../ExceptionDialog.cs) (revision fa3a16496921649188ae04c0df6392dad64e100b) @@ -24,6 +24,7 @@ using System.Windows.Forms; using Application.Ringtoets.Properties; using Core.Common.Controls.Dialogs; +using Core.Common.Gui.Commands; namespace Application.Ringtoets { @@ -41,15 +42,18 @@ /// public partial class ExceptionDialog : DialogBase { + private readonly ICommandsOwner commands; private Action openLogClicked; /// /// Constructs a new . /// /// The owner of the dialog. + /// The commands available in the application. /// The exception to show in the dialog. - public ExceptionDialog(IWin32Window dialogParent, Exception exception) : base(dialogParent, (Icon) Resources.bug__exclamation, 470, 200) + public ExceptionDialog(IWin32Window dialogParent, ICommandsOwner commands, Exception exception) : base(dialogParent, (Icon) Resources.bug__exclamation, 470, 200) { + this.commands = commands; InitializeComponent(); buttonOpenLog.Enabled = false; @@ -102,5 +106,19 @@ { OpenLogClicked(); } + + private void ButtonSaveProjectClick(object sender, EventArgs e) + { + var saved = commands.StorageCommands.SaveProjectAs(); + + ShowMessageDialog( + saved ? Resources.ExceptionDialog_ButtonSaveProjectClick_Succesfully_saved_project : Resources.ExceptionDialog_ButtonSaveProjectClick_Saving_project_failed, + saved ? Resources.ExceptionDialog_ButtonSaveProjectClick_Succesfully_saved_project_caption : Resources.ExceptionDialog_ButtonSaveProjectClick_Saving_project_failed_caption); + } + + private void ShowMessageDialog(string message, string caption) + { + MessageBox.Show(message, caption, MessageBoxButtons.OK); + } } } \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets/ExceptionDialog.resx =================================================================== diff -u -r34af24d6bf23796e627fd03b7532d4abe6fc715c -rfa3a16496921649188ae04c0df6392dad64e100b --- Application/Ringtoets/src/Application.Ringtoets/ExceptionDialog.resx (.../ExceptionDialog.resx) (revision 34af24d6bf23796e627fd03b7532d4abe6fc715c) +++ Application/Ringtoets/src/Application.Ringtoets/ExceptionDialog.resx (.../ExceptionDialog.resx) (revision fa3a16496921649188ae04c0df6392dad64e100b) @@ -282,15 +282,36 @@ 0 + + 287, 242 + + + 75, 23 + + + 7 + + + Opslaan + + + buttonSaveProject + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 6 + True 536, 273 - - NoControl - CenterParent Index: Application/Ringtoets/src/Application.Ringtoets/Properties/AssemblyInfo.cs =================================================================== diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -rfa3a16496921649188ae04c0df6392dad64e100b --- Application/Ringtoets/src/Application.Ringtoets/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71) +++ Application/Ringtoets/src/Application.Ringtoets/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision fa3a16496921649188ae04c0df6392dad64e100b) @@ -20,10 +20,12 @@ // All rights reserved. using System.Reflection; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using log4net.Config; [assembly: XmlConfigurator(Watch = true)] [assembly: AssemblyTitle("Ringtoets")] [assembly: AssemblyProduct("Ringtoets")] -[assembly: Guid("a4036982-77b5-4a89-84be-0c05301f28a6")] \ No newline at end of file +[assembly: Guid("a4036982-77b5-4a89-84be-0c05301f28a6")] +[assembly: InternalsVisibleTo("Application.Ringtoets.Test")] \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets/Properties/Resources.Designer.cs =================================================================== diff -u -r34af24d6bf23796e627fd03b7532d4abe6fc715c -rfa3a16496921649188ae04c0df6392dad64e100b --- Application/Ringtoets/src/Application.Ringtoets/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 34af24d6bf23796e627fd03b7532d4abe6fc715c) +++ Application/Ringtoets/src/Application.Ringtoets/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision fa3a16496921649188ae04c0df6392dad64e100b) @@ -1,25 +1,4 @@ -// Copyright (C) Stichting Deltares 2016. All rights reserved. -// -// This file is part of Ringtoets. -// -// Ringtoets is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// All names, logos, and references to "Deltares" are registered trademarks of -// Stichting Deltares and remain full property of Stichting Deltares at all times. -// All rights reserved. - -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.17929 @@ -90,5 +69,41 @@ return ((System.Drawing.Icon)(obj)); } } + + /// + /// Looks up a localized string similar to Het Ringtoetsproject is niet opgeslagen.. + /// + internal static string ExceptionDialog_ButtonSaveProjectClick_Saving_project_failed { + get { + return ResourceManager.GetString("ExceptionDialog_ButtonSaveProjectClick_Saving_project_failed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Kon project niet opslaan. + /// + internal static string ExceptionDialog_ButtonSaveProjectClick_Saving_project_failed_caption { + get { + return ResourceManager.GetString("ExceptionDialog_ButtonSaveProjectClick_Saving_project_failed_caption", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Het Ringtoetsproject is succesvol opgeslagen.. + /// + internal static string ExceptionDialog_ButtonSaveProjectClick_Succesfully_saved_project { + get { + return ResourceManager.GetString("ExceptionDialog_ButtonSaveProjectClick_Succesfully_saved_project", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Project opgeslagen. + /// + internal static string ExceptionDialog_ButtonSaveProjectClick_Succesfully_saved_project_caption { + get { + return ResourceManager.GetString("ExceptionDialog_ButtonSaveProjectClick_Succesfully_saved_project_caption", resourceCulture); + } + } } } Index: Application/Ringtoets/src/Application.Ringtoets/Properties/Resources.resx =================================================================== diff -u -r34af24d6bf23796e627fd03b7532d4abe6fc715c -rfa3a16496921649188ae04c0df6392dad64e100b --- Application/Ringtoets/src/Application.Ringtoets/Properties/Resources.resx (.../Resources.resx) (revision 34af24d6bf23796e627fd03b7532d4abe6fc715c) +++ Application/Ringtoets/src/Application.Ringtoets/Properties/Resources.resx (.../Resources.resx) (revision fa3a16496921649188ae04c0df6392dad64e100b) @@ -121,4 +121,16 @@ ..\Resources\bug--exclamation.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + Het Ringtoetsproject is niet opgeslagen. + + + Het Ringtoetsproject is succesvol opgeslagen. + + + Project opgeslagen + + + Kon project niet opslaan + \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Test/Application.Ringtoets.Test.csproj =================================================================== diff -u -r34af24d6bf23796e627fd03b7532d4abe6fc715c -rfa3a16496921649188ae04c0df6392dad64e100b --- Application/Ringtoets/test/Application.Ringtoets.Test/Application.Ringtoets.Test.csproj (.../Application.Ringtoets.Test.csproj) (revision 34af24d6bf23796e627fd03b7532d4abe6fc715c) +++ Application/Ringtoets/test/Application.Ringtoets.Test/Application.Ringtoets.Test.csproj (.../Application.Ringtoets.Test.csproj) (revision fa3a16496921649188ae04c0df6392dad64e100b) @@ -46,6 +46,7 @@ ..\..\..\..\lib\NUnitForms.dll + ..\..\..\..\packages\RhinoMocks.3.6.1\lib\net\Rhino.Mocks.dll True @@ -54,6 +55,8 @@ + + @@ -70,6 +73,10 @@ {9a2d67e6-26ac-4d17-b11a-2b4372f2f572} Core.Common.Controls + + {30e4c2ae-719e-4d70-9fa9-668a9767fbfa} + Core.Common.Gui + {4A7D6720-4AA1-4F0B-A796-A0436DB3D7D7} Application.Ringtoets Index: Application/Ringtoets/test/Application.Ringtoets.Test/ExceptionDialogTest.cs =================================================================== diff -u -r34af24d6bf23796e627fd03b7532d4abe6fc715c -rfa3a16496921649188ae04c0df6392dad64e100b --- Application/Ringtoets/test/Application.Ringtoets.Test/ExceptionDialogTest.cs (.../ExceptionDialogTest.cs) (revision 34af24d6bf23796e627fd03b7532d4abe6fc715c) +++ Application/Ringtoets/test/Application.Ringtoets.Test/ExceptionDialogTest.cs (.../ExceptionDialogTest.cs) (revision fa3a16496921649188ae04c0df6392dad64e100b) @@ -40,7 +40,7 @@ mocks.ReplayAll(); // Call - using (var dialog = new ExceptionDialog(window, null)) + using (var dialog = new ExceptionDialog(window, null, null)) { // Assert Assert.IsNotNull(dialog.Icon); @@ -73,7 +73,7 @@ openedDialog.Close(); }; - using (var dialog = new ExceptionDialog(window, null)) + using (var dialog = new ExceptionDialog(window, null, null)) { // Call dialog.ShowDialog(); @@ -106,7 +106,7 @@ var exception = new Exception("Test", new Exception("Test inner")); - using (var dialog = new ExceptionDialog(window, exception)) + using (var dialog = new ExceptionDialog(window, null, exception)) { // Call dialog.ShowDialog(); @@ -136,7 +136,7 @@ openedDialog.Close(); }; - using (var dialog = new ExceptionDialog(window, null)) + using (var dialog = new ExceptionDialog(window, null, null)) { // Call dialog.ShowDialog(); @@ -166,7 +166,7 @@ openedDialog.Close(); }; - using (var dialog = new ExceptionDialog(window, null)) + using (var dialog = new ExceptionDialog(window, null, null)) { // Call dialog.ShowDialog(); @@ -196,7 +196,7 @@ openedDialog.Close(); }; - using (var dialog = new ExceptionDialog(window, null) + using (var dialog = new ExceptionDialog(window, null, null) { OpenLogClicked = () => { } }) @@ -225,7 +225,7 @@ button.Click(); }; - using (var dialog = new ExceptionDialog(window, null)) + using (var dialog = new ExceptionDialog(window, null, null)) { // Call dialog.ShowDialog(); @@ -251,7 +251,7 @@ button.Click(); }; - using (var dialog = new ExceptionDialog(window, null)) + using (var dialog = new ExceptionDialog(window, null, null)) { // Call dialog.ShowDialog(); @@ -281,7 +281,7 @@ openedDialog.Close(); }; - using (var dialog = new ExceptionDialog(window, null) + using (var dialog = new ExceptionDialog(window, null, null) { OpenLogClicked = () => counter++ }) @@ -310,7 +310,7 @@ }; var exception = new Exception("Test"); - using (var dialog = new ExceptionDialog(new UserControl(), exception)) + using (var dialog = new ExceptionDialog(new UserControl(), null, exception)) { // Call dialog.ShowDialog();