Browse Source

Put a Hyperlink into the startpage ListView.

Rename Foreach extension method to ForEach (to be consistent with List<T>).

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3491 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 18 years ago
parent
commit
20d4744aa4
  1. 87
      src/AddIns/Misc/StartPage/Project/Src/StartPageControl.xaml
  2. 7
      src/AddIns/Misc/StartPage/Project/Src/StartPageControl.xaml.cs
  3. 4
      src/Main/Base/Project/Src/Commands/FileCommands.cs
  4. 4
      src/Main/Base/Project/Src/Gui/Workbench/Layouts/AvalonWorkbenchWindow.cs
  5. 2
      src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs
  6. 2
      src/Main/Base/Project/Src/Gui/Workbench/Layouts/SimpleWorkbenchLayout.cs
  7. 4
      src/Main/Base/Project/Src/Project/BuildEngine.cs
  8. 10
      src/Main/Base/Project/Src/Util/ExtensionMethods.cs

87
src/AddIns/Misc/StartPage/Project/Src/StartPageControl.xaml

@ -1,10 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<UserControl <UserControl
x:Class="ICSharpCode.StartPage.StartPageControl" x:Class="ICSharpCode.StartPage.StartPageControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" xmlns:core="http://icsharpcode.net/sharpdevelop/core"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop"
xmlns:core="http://icsharpcode.net/sharpdevelop/core"
Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"> Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
@ -31,39 +27,78 @@
Stretch="Fill" Stretch="Fill"
Source="../Resources/balken_mitte.gif" /> Source="../Resources/balken_mitte.gif" />
</DockPanel> </DockPanel>
<DockPanel Grid.Row="1" VerticalAlignment="Top"> <DockPanel
<Border DockPanel.Dock="Top" Background="#A8C6E3" Margin="4,20,4,0" CornerRadius="15,15,0,0" Padding="15,0,15,0"> Grid.Row="1"
<TextBlock Text="{core:Localize StartPage.StartMenu.BarNameName}" VerticalAlignment="Top">
FontSize="11pt" <Border
FontWeight="Bold" DockPanel.Dock="Top"
Foreground="White" Background="#A8C6E3"
Margin="0,0,0,2"/> Margin="4,20,4,0"
CornerRadius="15,15,0,0"
Padding="15,0,15,0">
<TextBlock
Text="{core:Localize StartPage.StartMenu.BarNameName}"
FontSize="11pt"
FontWeight="Bold"
Foreground="White"
Margin="0,0,0,2" />
</Border> </Border>
<Border Background="#DCDDDE" Margin="4,0,4,4" CornerRadius="0,0,15,15"> <Border
<StackPanel Orientation="Vertical" Margin="15"> Background="#DCDDDE"
<ListView Name="lastProjectsListView" SelectionMode="Single" MouseDoubleClick="lastProjectsDoubleClick"> Margin="4,0,4,4"
CornerRadius="0,0,15,15">
<StackPanel
Orientation="Vertical"
Margin="15">
<ListView
Name="lastProjectsListView"
SelectionMode="Single"
MouseDoubleClick="lastProjectsDoubleClick">
<ListView.Resources>
<DataTemplate x:Key="nameCellTemplate">
<TextBlock>
<Hyperlink Tag="{Binding}" Click="listViewHyperlinkClick">
<TextBlock Text="{Binding Path=Name}"/>
</Hyperlink>
</TextBlock>
</DataTemplate>
</ListView.Resources>
<ListView.View> <ListView.View>
<GridView> <GridView>
<GridViewColumn DisplayMemberBinding="{Binding Path=Name}" <GridViewColumn
Header="{core:Localize Global.Name}" /> CellTemplate="{StaticResource nameCellTemplate}"
<GridViewColumn DisplayMemberBinding="{Binding Path=LastModification}" Header="{core:Localize Global.Name}" />
Header="{core:Localize StartPage.StartMenu.ModifiedTable}" /> <GridViewColumn
<GridViewColumn DisplayMemberBinding="{Binding Path=Path}" DisplayMemberBinding="{Binding Path=LastModification}"
Header="{core:Localize StartPage.StartMenu.LocationTable}" /> Header="{core:Localize StartPage.StartMenu.ModifiedTable}" />
<GridViewColumn
DisplayMemberBinding="{Binding Path=Path}"
Header="{core:Localize StartPage.StartMenu.LocationTable}" />
</GridView> </GridView>
</ListView.View> </ListView.View>
</ListView> </ListView>
<StackPanel Orientation="Horizontal" Margin="0,20,0,0"> <StackPanel
<Button Content="{core:Localize StartPage.StartMenu.OpenCombineButton}" Click="openSolutionClick"/> Orientation="Horizontal"
<Button Content="{core:Localize StartPage.StartMenu.NewCombineButton}" Click="newSolutionClick" Margin="8,0,0,0"/> Margin="0,20,0,0">
<Button
Content="{core:Localize StartPage.StartMenu.OpenCombineButton}"
Click="openSolutionClick" />
<Button
Content="{core:Localize StartPage.StartMenu.NewCombineButton}"
Click="newSolutionClick"
Margin="8,0,0,0" />
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
</Border> </Border>
</DockPanel> </DockPanel>
<TextBlock Background="#A8C6E3" Grid.Row="2" Padding="4,0,4,0"> <TextBlock
Background="#A8C6E3"
Grid.Row="2"
Padding="4,0,4,0"
TextWrapping="Wrap">
Copyright ©2000-2008 Copyright ©2000-2008
<Hyperlink NavigateUri="mailto:webmaster@icsharpcode.net">IC#SharpCode</Hyperlink> <Hyperlink NavigateUri="mailto:webmaster@icsharpcode.net">IC#SharpCode</Hyperlink>
<Run Text="{x:Static gui:AboutSharpDevelopTabPage.LicenseSentence}"/> <Run Text="{x:Static gui:AboutSharpDevelopTabPage.LicenseSentence}" />
</TextBlock> </TextBlock>
</Grid> </Grid>
</UserControl> </UserControl>

7
src/AddIns/Misc/StartPage/Project/Src/StartPageControl.xaml.cs

@ -13,6 +13,7 @@ using System.Windows.Controls;
using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Project; using ICSharpCode.SharpDevelop.Project;
using System.Windows.Documents;
namespace ICSharpCode.StartPage namespace ICSharpCode.StartPage
{ {
@ -60,6 +61,12 @@ namespace ICSharpCode.StartPage
} }
} }
void listViewHyperlinkClick(object sender, RoutedEventArgs e)
{
RecentOpenItem item = (RecentOpenItem)((Hyperlink)sender).Tag;
ProjectService.LoadSolutionOrProject(item.Path);
}
void openSolutionClick(object sender, RoutedEventArgs e) void openSolutionClick(object sender, RoutedEventArgs e)
{ {
new ICSharpCode.SharpDevelop.Project.Commands.LoadSolution().Run(); new ICSharpCode.SharpDevelop.Project.Commands.LoadSolution().Run();

4
src/Main/Base/Project/Src/Commands/FileCommands.cs

@ -68,7 +68,7 @@ namespace ICSharpCode.SharpDevelop.Commands
internal static void Save(IWorkbenchWindow window) internal static void Save(IWorkbenchWindow window)
{ {
window.ViewContents.Foreach(Save); window.ViewContents.ForEach(Save);
} }
internal static void Save(IViewContent content) internal static void Save(IViewContent content)
@ -139,7 +139,7 @@ namespace ICSharpCode.SharpDevelop.Commands
internal static void Save(IWorkbenchWindow window) internal static void Save(IWorkbenchWindow window)
{ {
window.ViewContents.Foreach(Save); window.ViewContents.ForEach(Save);
} }
internal static void Save(IViewContent content) internal static void Save(IViewContent content)

4
src/Main/Base/Project/Src/Gui/Workbench/Layouts/AvalonWorkbenchWindow.cs

@ -223,7 +223,7 @@ namespace ICSharpCode.SharpDevelop.Gui
// DetachContent must be called before the controls are disposed // DetachContent must be called before the controls are disposed
List<IViewContent> viewContents = this.ViewContents.ToList(); List<IViewContent> viewContents = this.ViewContents.ToList();
this.ViewContents.Clear(); this.ViewContents.Clear();
viewContents.Foreach(vc => vc.Dispose()); viewContents.ForEach(vc => vc.Dispose());
} }
private void CreateViewTabControl() private void CreateViewTabControl()
@ -339,7 +339,7 @@ namespace ICSharpCode.SharpDevelop.Gui
if (!vc.IsDirty) continue; if (!vc.IsDirty) continue;
if (vc.PrimaryFile != null) { if (vc.PrimaryFile != null) {
while (true) { while (true) {
vc.Files.Foreach(ICSharpCode.SharpDevelop.Commands.SaveFile.Save); vc.Files.ForEach(ICSharpCode.SharpDevelop.Commands.SaveFile.Save);
if (vc.IsDirty) { if (vc.IsDirty) {
if (MessageService.AskQuestion("${res:MainWindow.DiscardChangesMessage}")) { if (MessageService.AskQuestion("${res:MainWindow.DiscardChangesMessage}")) {
break; break;

2
src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs

@ -340,7 +340,7 @@ namespace ICSharpCode.SharpDevelop.Gui
if (!vc.IsDirty) continue; if (!vc.IsDirty) continue;
if (vc.PrimaryFile != null) { if (vc.PrimaryFile != null) {
while (true) { while (true) {
vc.Files.Foreach(ICSharpCode.SharpDevelop.Commands.SaveFile.Save); vc.Files.ForEach(ICSharpCode.SharpDevelop.Commands.SaveFile.Save);
if (vc.IsDirty) { if (vc.IsDirty) {
if (MessageService.AskQuestion("${res:MainWindow.DiscardChangesMessage}")) { if (MessageService.AskQuestion("${res:MainWindow.DiscardChangesMessage}")) {
break; break;

2
src/Main/Base/Project/Src/Gui/Workbench/Layouts/SimpleWorkbenchLayout.cs

@ -538,7 +538,7 @@ namespace ICSharpCode.SharpDevelop.Gui
if (!vc.IsDirty) continue; if (!vc.IsDirty) continue;
if (vc.PrimaryFile != null) { if (vc.PrimaryFile != null) {
while (true) { while (true) {
vc.Files.Foreach(ICSharpCode.SharpDevelop.Commands.SaveFile.Save); vc.Files.ForEach(ICSharpCode.SharpDevelop.Commands.SaveFile.Save);
if (vc.IsDirty) { if (vc.IsDirty) {
if (MessageService.AskQuestion("${res:MainWindow.DiscardChangesMessage}")) { if (MessageService.AskQuestion("${res:MainWindow.DiscardChangesMessage}")) {
break; break;

4
src/Main/Base/Project/Src/Project/BuildEngine.cs

@ -333,7 +333,7 @@ namespace ICSharpCode.SharpDevelop.Project
node.options.Platform = options.SolutionPlatform; node.options.Platform = options.SolutionPlatform;
// copy properties to project options // copy properties to project options
options.GlobalAdditionalProperties.Foreach(node.options.Properties.Add); options.GlobalAdditionalProperties.ForEach(node.options.Properties.Add);
if (project == rootProject) { if (project == rootProject) {
foreach (var pair in options.ProjectAdditionalProperties) { foreach (var pair in options.ProjectAdditionalProperties) {
node.options.Properties[pair.Key] = pair.Value; node.options.Properties[pair.Key] = pair.Value;
@ -603,7 +603,7 @@ namespace ICSharpCode.SharpDevelop.Project
} }
} }
if (messagesToReport != null) { if (messagesToReport != null) {
messagesToReport.Foreach(ReportMessageInternal); messagesToReport.ForEach(ReportMessageInternal);
} }
if (newNodeWithOutputLockAlreadyFinishedBuilding) { if (newNodeWithOutputLockAlreadyFinishedBuilding) {
// if the node already finished building before it got the output lock, we need // if the node already finished building before it got the output lock, we need

10
src/Main/Base/Project/Src/Util/ExtensionMethods.cs

@ -26,7 +26,7 @@ namespace ICSharpCode.SharpDevelop
/// <summary> /// <summary>
/// Runs an action for all elements in the input. /// Runs an action for all elements in the input.
/// </summary> /// </summary>
public static void Foreach<T>(this IEnumerable<T> input, Action<T> action) public static void ForEach<T>(this IEnumerable<T> input, Action<T> action)
{ {
if (input == null) if (input == null)
throw new ArgumentNullException("input"); throw new ArgumentNullException("input");
@ -143,6 +143,12 @@ namespace ICSharpCode.SharpDevelop
} }
} }
/// <summary>
/// WindowsFormsHost that prevents its child from being disposed.
/// The default WindowsFormsHost disposes its child when the WPF application shuts down,
/// but some events in SharpDevelop occur after the WPF shutdown (e.g. SolutionClosed), so we must
/// not dispose pads that could still be handling them.
/// </summary>
class SDWindowsFormsHost : WinForms.Integration.WindowsFormsHost class SDWindowsFormsHost : WinForms.Integration.WindowsFormsHost
{ {
public SDWindowsFormsHost(WinForms.Control child) public SDWindowsFormsHost(WinForms.Control child)
@ -150,7 +156,7 @@ namespace ICSharpCode.SharpDevelop
this.Child = child; this.Child = child;
child.Disposed += child_Disposed; child.Disposed += child_Disposed;
} }
void child_Disposed(object sender, EventArgs e) void child_Disposed(object sender, EventArgs e)
{ {
Dispose(); Dispose();

Loading…
Cancel
Save