From: <bre...@us...> - 2011-11-20 12:35:29
|
Revision: 3143 http://proteowizard.svn.sourceforge.net/proteowizard/?rev=3143&view=rev Author: brendanx Date: 2011-11-20 12:35:18 +0000 (Sun, 20 Nov 2011) Log Message: ----------- Skyline: Wrap all modified time access in exception handling - Short-circuit dockPanel_ActiveDocumentChanged handling during closing of the main application window Modified Paths: -------------- trunk/pwiz/pwiz_tools/Skyline/FileUI/OpenDataSourceDialog.cs trunk/pwiz/pwiz_tools/Skyline/Skyline.cs trunk/pwiz/pwiz_tools/Skyline/SkylineGraphs.cs Modified: trunk/pwiz/pwiz_tools/Skyline/FileUI/OpenDataSourceDialog.cs =================================================================== --- trunk/pwiz/pwiz_tools/Skyline/FileUI/OpenDataSourceDialog.cs 2011-11-19 04:29:40 UTC (rev 3142) +++ trunk/pwiz/pwiz_tools/Skyline/FileUI/OpenDataSourceDialog.cs 2011-11-20 12:35:18 UTC (rev 3143) @@ -328,7 +328,7 @@ type = type, imageIndex = (SourceInfo.isFolderType(type) ? 0 : 2), name = dirInfo.Name, - dateModified = dirInfo.LastWriteTime + dateModified = GetSafeDateModified(dirInfo) }; if(listView.View != View.Details || @@ -366,7 +366,7 @@ sourceTypeComboBox.SelectedItem.ToString() != sourceInfo.type)) return sourceInfo; sourceInfo.size = (UInt64) fileInfo.Length; - sourceInfo.dateModified = fileInfo.LastWriteTime; + sourceInfo.dateModified = GetSafeDateModified(fileInfo); return sourceInfo; } return null; @@ -430,20 +430,12 @@ if (label != "") name = string.Format("{0} ({1})", label, name); - DateTime? dateModifiedDrive = null; - try - { - dateModifiedDrive = driveInfo.RootDirectory.LastWriteTime; - } - catch (IOException) {} - catch (UnauthorizedAccessException) {} - listSourceInfo.Add(new SourceInfo { type = SourceInfo.FOLDER_TYPE, imageIndex = imageIndex, name = name, - dateModified = dateModifiedDrive + dateModified = GetSafeDateModified(driveInfo.RootDirectory) }); } } @@ -521,6 +513,17 @@ } } + private static DateTime? GetSafeDateModified(FileSystemInfo dirInfo) + { + try + { + return dirInfo.LastWriteTime; + } + catch (IOException) {} + catch (UnauthorizedAccessException) {} + return null; + } + private void populateComboBoxFromDirectory( string directory ) { lookInComboBox.SuspendLayout(); Modified: trunk/pwiz/pwiz_tools/Skyline/Skyline.cs =================================================================== --- trunk/pwiz/pwiz_tools/Skyline/Skyline.cs 2011-11-19 04:29:40 UTC (rev 3142) +++ trunk/pwiz/pwiz_tools/Skyline/Skyline.cs 2011-11-20 12:35:18 UTC (rev 3143) @@ -71,6 +71,7 @@ private SrmDocument _documentUI; private string _savedPath; // Interlocked access only private int _savedVersion; + private bool _closing; private readonly UndoManager _undoManager; private readonly UndoRedoButtons _undoRedoButtons; private readonly LibraryManager _libraryManager; @@ -646,6 +647,8 @@ MessageDlg.Show(this, "An unexpected error has prevented global settings changes from this session from being saved."); } + _closing = true; + base.OnClosing(e); } Modified: trunk/pwiz/pwiz_tools/Skyline/SkylineGraphs.cs =================================================================== --- trunk/pwiz/pwiz_tools/Skyline/SkylineGraphs.cs 2011-11-19 04:29:40 UTC (rev 3142) +++ trunk/pwiz/pwiz_tools/Skyline/SkylineGraphs.cs 2011-11-20 12:35:18 UTC (rev 3143) @@ -81,7 +81,7 @@ private void dockPanel_ActiveDocumentChanged(object sender, EventArgs e) { var settings = DocumentUI.Settings; - if (comboResults.IsDisposed || _inGraphUpdate || !settings.HasResults || + if (_closing || comboResults.IsDisposed || _inGraphUpdate || !settings.HasResults || settings.MeasuredResults.Chromatograms.Count < 2) return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |