|
|
@ -18,6 +18,7 @@ namespace ICSharpCode.SharpDevelop.Project |
|
|
|
static IProject currentProject; |
|
|
|
static IProject currentProject; |
|
|
|
|
|
|
|
|
|
|
|
public static Solution OpenSolution { |
|
|
|
public static Solution OpenSolution { |
|
|
|
|
|
|
|
[System.Diagnostics.DebuggerStepThrough] |
|
|
|
get { |
|
|
|
get { |
|
|
|
return openSolution; |
|
|
|
return openSolution; |
|
|
|
} |
|
|
|
} |
|
|
@ -218,16 +219,18 @@ namespace ICSharpCode.SharpDevelop.Project |
|
|
|
openSolution = Solution.Load(fileName); |
|
|
|
openSolution = Solution.Load(fileName); |
|
|
|
if (openSolution == null) |
|
|
|
if (openSolution == null) |
|
|
|
return; |
|
|
|
return; |
|
|
|
OnSolutionLoaded(new SolutionEventArgs(openSolution)); |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
string file = GetPreferenceFileName(openSolution.FileName); |
|
|
|
string file = GetPreferenceFileName(openSolution.FileName); |
|
|
|
if (FileUtility.IsValidFileName(file) && File.Exists(file)) { |
|
|
|
if (FileUtility.IsValidFileName(file) && File.Exists(file)) { |
|
|
|
openSolution.Preferences.SetMemento(Properties.Load(file)); |
|
|
|
(openSolution.Preferences as IMementoCapable).SetMemento(Properties.Load(file)); |
|
|
|
} |
|
|
|
} |
|
|
|
ApplyConfigurationAndReadPreferences(); |
|
|
|
ApplyConfigurationAndReadPreferences(); |
|
|
|
} catch (Exception ex) { |
|
|
|
} catch (Exception ex) { |
|
|
|
MessageService.ShowError(ex); |
|
|
|
MessageService.ShowError(ex); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// preferences must be read before OnSolutionLoad is called to enable
|
|
|
|
|
|
|
|
// the event listeners to read e.Solution.Preferences.Properties
|
|
|
|
|
|
|
|
OnSolutionLoaded(new SolutionEventArgs(openSolution)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void ApplyConfigurationAndReadPreferences() |
|
|
|
static void ApplyConfigurationAndReadPreferences() |
|
|
@ -275,8 +278,10 @@ namespace ICSharpCode.SharpDevelop.Project |
|
|
|
solution.Save(solutionFile); |
|
|
|
solution.Save(solutionFile); |
|
|
|
|
|
|
|
|
|
|
|
openSolution = solution; |
|
|
|
openSolution = solution; |
|
|
|
OnSolutionLoaded(new SolutionEventArgs(openSolution)); |
|
|
|
|
|
|
|
ApplyConfigurationAndReadPreferences(); |
|
|
|
ApplyConfigurationAndReadPreferences(); |
|
|
|
|
|
|
|
// preferences must be read before OnSolutionLoad is called to enable
|
|
|
|
|
|
|
|
// the event listeners to read e.Solution.Preferences.Properties
|
|
|
|
|
|
|
|
OnSolutionLoaded(new SolutionEventArgs(openSolution)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void SaveSolution() |
|
|
|
public static void SaveSolution() |
|
|
@ -307,14 +312,13 @@ namespace ICSharpCode.SharpDevelop.Project |
|
|
|
Directory.CreateDirectory(directory); |
|
|
|
Directory.CreateDirectory(directory); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
string fullFileName; |
|
|
|
if (SolutionPreferencesSaving != null) |
|
|
|
Properties memento = openSolution.Preferences.CreateMemento(); |
|
|
|
SolutionPreferencesSaving(null, new SolutionEventArgs(openSolution)); |
|
|
|
if (memento != null) { |
|
|
|
Properties memento = (openSolution.Preferences as IMementoCapable).CreateMemento(); |
|
|
|
fullFileName = GetPreferenceFileName(openSolution.FileName); |
|
|
|
|
|
|
|
|
|
|
|
string fullFileName = GetPreferenceFileName(openSolution.FileName); |
|
|
|
if (FileUtility.IsValidFileName(fullFileName)) { |
|
|
|
if (FileUtility.IsValidFileName(fullFileName)) { |
|
|
|
FileUtility.ObservedSave(new NamedFileOperationDelegate(memento.Save), fullFileName, FileErrorPolicy.Inform); |
|
|
|
FileUtility.ObservedSave(new NamedFileOperationDelegate(memento.Save), fullFileName, FileErrorPolicy.Inform); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
foreach (IProject project in OpenSolution.Projects) { |
|
|
|
foreach (IProject project in OpenSolution.Projects) { |
|
|
@ -474,6 +478,12 @@ namespace ICSharpCode.SharpDevelop.Project |
|
|
|
public static event EventHandler<SolutionEventArgs> SolutionClosing; |
|
|
|
public static event EventHandler<SolutionEventArgs> SolutionClosing; |
|
|
|
public static event EventHandler SolutionClosed; |
|
|
|
public static event EventHandler SolutionClosed; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Raised before the solution preferences are being saved. Allows you to save
|
|
|
|
|
|
|
|
/// your additional properties in the solution preferences.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public static event EventHandler<SolutionEventArgs> SolutionPreferencesSaving; |
|
|
|
|
|
|
|
|
|
|
|
public static event ProjectEventHandler CurrentProjectChanged; |
|
|
|
public static event ProjectEventHandler CurrentProjectChanged; |
|
|
|
|
|
|
|
|
|
|
|
public static event EventHandler<ProjectItemEventArgs> ProjectItemAdded; |
|
|
|
public static event EventHandler<ProjectItemEventArgs> ProjectItemAdded; |
|
|
|