Index: Application/Application.Ringtoets/App.xaml.cs
===================================================================
diff -u -r0ab59c91f6c95e37a30403463b626d5c762496bd -r6a30be3a0a6f87e97e5144b981180aaba1609e54
--- Application/Application.Ringtoets/App.xaml.cs (.../App.xaml.cs) (revision 0ab59c91f6c95e37a30403463b626d5c762496bd)
+++ Application/Application.Ringtoets/App.xaml.cs (.../App.xaml.cs) (revision 6a30be3a0a6f87e97e5144b981180aaba1609e54)
@@ -280,7 +280,7 @@
{
if (gui != null && gui.MainWindow != null)
{
- var exceptionDialog = new ExceptionDialog(gui.MainWindow, exception)
+ using (var exceptionDialog = new ExceptionDialog(gui.MainWindow, exception)
{
OpenLogClicked = () =>
{
@@ -289,13 +289,14 @@
gui.CommandHandler.OpenLogFileExternal();
}
}
- };
-
- if (exceptionDialog.ShowDialog() == DialogResult.OK)
+ })
{
- Restart();
+ if (exceptionDialog.ShowDialog() == DialogResult.OK)
+ {
+ Restart();
- return;
+ return;
+ }
}
}
Index: Core/Common/src/Core.Common.Controls/Core.Common.Controls.csproj
===================================================================
diff -u -r40fa1903d03d65aa0020127802c42294bb46ef94 -r6a30be3a0a6f87e97e5144b981180aaba1609e54
--- Core/Common/src/Core.Common.Controls/Core.Common.Controls.csproj (.../Core.Common.Controls.csproj) (revision 40fa1903d03d65aa0020127802c42294bb46ef94)
+++ Core/Common/src/Core.Common.Controls/Core.Common.Controls.csproj (.../Core.Common.Controls.csproj) (revision 6a30be3a0a6f87e97e5144b981180aaba1609e54)
@@ -129,6 +129,7 @@
ExceptionDialog.cs
+ Designer
ResXFileCodeGenerator
Index: Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs
===================================================================
diff -u -rd1a8aeaa05c36dfe386de7586dd129819594ee97 -r6a30be3a0a6f87e97e5144b981180aaba1609e54
--- Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs (.../MainWindow.xaml.cs) (revision d1a8aeaa05c36dfe386de7586dd129819594ee97)
+++ Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs (.../MainWindow.xaml.cs) (revision 6a30be3a0a6f87e97e5144b981180aaba1609e54)
@@ -997,10 +997,12 @@
private void OnFileOptionsClicked(object sender, RoutedEventArgs e)
{
- var optionsDialog = new OptionsDialog(this, Gui.UserSettings);
- if (optionsDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+ using (var optionsDialog = new OptionsDialog(this, Gui.UserSettings))
{
- SetColorTheme((ColorTheme) Gui.UserSettings["colorTheme"]);
+ if (optionsDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+ {
+ SetColorTheme((ColorTheme)Gui.UserSettings["colorTheme"]);
+ }
}
}
Index: Core/Common/src/Core.Common.Gui/Forms/ProgressDialog/ActivityProgressDialogRunner.cs
===================================================================
diff -u -rc182637ac2a2d3edf48d2c204259898e84e365b5 -r6a30be3a0a6f87e97e5144b981180aaba1609e54
--- Core/Common/src/Core.Common.Gui/Forms/ProgressDialog/ActivityProgressDialogRunner.cs (.../ActivityProgressDialogRunner.cs) (revision c182637ac2a2d3edf48d2c204259898e84e365b5)
+++ Core/Common/src/Core.Common.Gui/Forms/ProgressDialog/ActivityProgressDialogRunner.cs (.../ActivityProgressDialogRunner.cs) (revision 6a30be3a0a6f87e97e5144b981180aaba1609e54)
@@ -13,9 +13,10 @@
public static void Run(IWin32Window owner, IEnumerable activities)
{
- var activityProgressDialog = new ActivityProgressDialog(owner, activities);
-
- activityProgressDialog.ShowDialog();
+ using (var activityProgressDialog = new ActivityProgressDialog(owner, activities))
+ {
+ activityProgressDialog.ShowDialog();
+ }
}
}
}
Index: Core/Common/src/Core.Common.Gui/Forms/ViewManager/ViewResolver.cs
===================================================================
diff -u -r18e78f440e1df8cd03e3e337ef385b58266a34a5 -r6a30be3a0a6f87e97e5144b981180aaba1609e54
--- Core/Common/src/Core.Common.Gui/Forms/ViewManager/ViewResolver.cs (.../ViewResolver.cs) (revision 18e78f440e1df8cd03e3e337ef385b58266a34a5)
+++ Core/Common/src/Core.Common.Gui/Forms/ViewManager/ViewResolver.cs (.../ViewResolver.cs) (revision 6a30be3a0a6f87e97e5144b981180aaba1609e54)
@@ -260,29 +260,30 @@
: null;
var viewTypeDictionary = viewInfoList.ToDictionary(vi => vi.Description ?? vi.ViewType.Name);
- var viewSelector = new SelectViewDialog(owner)
+ using (var viewSelector = new SelectViewDialog(owner)
{
DefaultViewName = defaultViewName,
Items = viewTypeDictionary.Keys.ToList()
- };
-
- if (viewSelector.ShowDialog() != DialogResult.OK)
+ })
{
- return null;
- }
- var selectedViewInfo = viewTypeDictionary[viewSelector.SelectedItem];
+ if (viewSelector.ShowDialog() != DialogResult.OK)
+ {
+ return null;
+ }
+ var selectedViewInfo = viewTypeDictionary[viewSelector.SelectedItem];
- if (viewSelector.DefaultViewName == null)
- {
- ClearDefaultView(data);
- }
- else
- {
- var defaultViewInfo = viewTypeDictionary[viewSelector.DefaultViewName];
- SetDefaultView(defaultViewInfo.ViewType, data);
- }
+ if (viewSelector.DefaultViewName == null)
+ {
+ ClearDefaultView(data);
+ }
+ else
+ {
+ var defaultViewInfo = viewTypeDictionary[viewSelector.DefaultViewName];
+ SetDefaultView(defaultViewInfo.ViewType, data);
+ }
- return selectedViewInfo;
+ return selectedViewInfo;
+ }
}
private IEnumerable GetOpenViewsFor(IEnumerable viewsToCheck, object data, Func extraCheck = null)
Index: Core/Common/src/Core.Common.Gui/GuiCommandHandler.cs
===================================================================
diff -u -r9d2bb4d5618592132638e924593253ad8caee1b0 -r6a30be3a0a6f87e97e5144b981180aaba1609e54
--- Core/Common/src/Core.Common.Gui/GuiCommandHandler.cs (.../GuiCommandHandler.cs) (revision 9d2bb4d5618592132638e924593253ad8caee1b0)
+++ Core/Common/src/Core.Common.Gui/GuiCommandHandler.cs (.../GuiCommandHandler.cs) (revision 6a30be3a0a6f87e97e5144b981180aaba1609e54)
@@ -220,13 +220,14 @@
public object AddNewChildItem(object parent, IEnumerable childItemValueTypes)
{
- var selectDataDialog = CreateSelectionDialogWithItems(GetSupportedDataItemInfosByValueTypes(parent, childItemValueTypes).ToList());
-
- if (selectDataDialog.ShowDialog() == DialogResult.OK)
+ using (var selectDataDialog = CreateSelectionDialogWithItems(GetSupportedDataItemInfosByValueTypes(parent, childItemValueTypes).ToList()))
{
- return GetNewDataObject(selectDataDialog, parent);
+ if (selectDataDialog.ShowDialog() == DialogResult.OK)
+ {
+ return GetNewDataObject(selectDataDialog, parent);
+ }
+ return null;
}
- return null;
}
public void AddNewItem(object parent)
@@ -236,16 +237,17 @@
Log.Error(Resources.GuiCommandHandler_AddNewItem_There_needs_to_be_a_project_to_add_an_item);
}
- var selectDataDialog = CreateSelectionDialogWithItems(gui.ApplicationCore.GetSupportedDataItemInfos(parent).ToList());
-
- if (selectDataDialog.ShowDialog() == DialogResult.OK)
+ using (var selectDataDialog = CreateSelectionDialogWithItems(gui.ApplicationCore.GetSupportedDataItemInfos(parent).ToList()))
{
- var newItem = GetNewItem(selectDataDialog, parent);
-
- if (newItem != null)
+ if (selectDataDialog.ShowDialog() == DialogResult.OK)
{
- gui.Selection = newItem;
- OpenViewForSelection();
+ var newItem = GetNewItem(selectDataDialog, parent);
+
+ if (newItem != null)
+ {
+ gui.Selection = newItem;
+ OpenViewForSelection();
+ }
}
}
}
Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Commands/MapChangeCoordinateSystemCommand.cs
===================================================================
diff -u -re8aaaf3808e54e4f075eab6f6c58bedf35e0890e -r6a30be3a0a6f87e97e5144b981180aaba1609e54
--- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Commands/MapChangeCoordinateSystemCommand.cs (.../MapChangeCoordinateSystemCommand.cs) (revision e8aaaf3808e54e4f075eab6f6c58bedf35e0890e)
+++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Commands/MapChangeCoordinateSystemCommand.cs (.../MapChangeCoordinateSystemCommand.cs) (revision 6a30be3a0a6f87e97e5144b981180aaba1609e54)
@@ -20,21 +20,22 @@
{
var activeView = SharpMapGisGuiPlugin.GetFocusedMapView();
- var selectCoordinateSystemDialog = new SelectCoordinateSystemDialog(Gui.MainWindow, OgrCoordinateSystemFactory.SupportedCoordinateSystems, GIS.SharpMap.Map.Map.CoordinateSystemFactory.CustomCoordinateSystems);
-
- if (selectCoordinateSystemDialog.ShowDialog() == DialogResult.OK)
+ using (var selectCoordinateSystemDialog = new SelectCoordinateSystemDialog(Gui.MainWindow, OgrCoordinateSystemFactory.SupportedCoordinateSystems, GIS.SharpMap.Map.Map.CoordinateSystemFactory.CustomCoordinateSystems))
{
- try
+ if (selectCoordinateSystemDialog.ShowDialog() == DialogResult.OK)
{
- activeView.Map.CoordinateSystem = selectCoordinateSystemDialog.SelectedCoordinateSystem;
- activeView.Map.NotifyObservers();
- activeView.Map.ZoomToExtents();
+ try
+ {
+ activeView.Map.CoordinateSystem = selectCoordinateSystemDialog.SelectedCoordinateSystem;
+ activeView.Map.NotifyObservers();
+ activeView.Map.ZoomToExtents();
+ }
+ catch (CoordinateTransformException e)
+ {
+ var message = string.Format(Resources.MapChangeCoordinateSystemCommand_OnExecute_Cannot_convert_map_to_selected_coordinate_system_0_, e.Message);
+ MessageBox.Show(message, Resources.MapChangeCoordinateSystemCommand_OnExecute_Map_coordinate_system, MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
}
- catch (CoordinateTransformException e)
- {
- var message = string.Format(Resources.MapChangeCoordinateSystemCommand_OnExecute_Cannot_convert_map_to_selected_coordinate_system_0_,e.Message);
- MessageBox.Show(message, Resources.MapChangeCoordinateSystemCommand_OnExecute_Map_coordinate_system, MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
}
}
}
Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/GridProperties/CoordinateSystemTypeEditor.cs
===================================================================
diff -u -re95dbee6ea6b002476a7827a03f6584b779ad594 -r6a30be3a0a6f87e97e5144b981180aaba1609e54
--- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/GridProperties/CoordinateSystemTypeEditor.cs (.../CoordinateSystemTypeEditor.cs) (revision e95dbee6ea6b002476a7827a03f6584b779ad594)
+++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/GridProperties/CoordinateSystemTypeEditor.cs (.../CoordinateSystemTypeEditor.cs) (revision 6a30be3a0a6f87e97e5144b981180aaba1609e54)
@@ -38,14 +38,15 @@
return base.EditValue(provider, value);
}
- var selectCoordinateSystemDialog = new SelectCoordinateSystemDialog(mapProperties.Owner, new List(Map.CoordinateSystemFactory.SupportedCoordinateSystems), Map.CoordinateSystemFactory.CustomCoordinateSystems);
-
- if (selectCoordinateSystemDialog.ShowDialog() == DialogResult.OK)
+ using (var selectCoordinateSystemDialog = new SelectCoordinateSystemDialog(mapProperties.Owner, new List(Map.CoordinateSystemFactory.SupportedCoordinateSystems), Map.CoordinateSystemFactory.CustomCoordinateSystems))
{
- return selectCoordinateSystemDialog.SelectedCoordinateSystem;
- }
+ if (selectCoordinateSystemDialog.ShowDialog() == DialogResult.OK)
+ {
+ return selectCoordinateSystemDialog.SelectedCoordinateSystem;
+ }
- return value;
+ return value;
+ }
}
}
}
\ No newline at end of file
Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/MapLegendView/MapLegendView.cs
===================================================================
diff -u -r8cae5d69ac2d4cf678486ac2b457c0dfe97089d5 -r6a30be3a0a6f87e97e5144b981180aaba1609e54
--- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/MapLegendView/MapLegendView.cs (.../MapLegendView.cs) (revision 8cae5d69ac2d4cf678486ac2b457c0dfe97089d5)
+++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/MapLegendView/MapLegendView.cs (.../MapLegendView.cs) (revision 6a30be3a0a6f87e97e5144b981180aaba1609e54)
@@ -241,7 +241,7 @@
private void ButtonAddWmsLayerClick(object sender, EventArgs e)
{
- var openUrlDialog = new OpenUrlDialog(gui.MainWindow)
+ using (var openUrlDialog = new OpenUrlDialog(gui.MainWindow)
{
Urls = new[]
{
@@ -260,11 +260,12 @@
// see aso http://geoservices.rijkswaterstaat.nl/services-index.html
},
Url = "http://openstreetmap.org"
- };
-
- if (openUrlDialog.ShowDialog() == DialogResult.OK)
+ })
{
- AddLayerFromExternalSource(openUrlDialog.Url);
+ if (openUrlDialog.ShowDialog() == DialogResult.OK)
+ {
+ AddLayerFromExternalSource(openUrlDialog.Url);
+ }
}
}