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 @@ @@ -1,10 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<UserControl
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"
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"
Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
<Grid>
<Grid.RowDefinitions>
@ -31,39 +27,78 @@ @@ -31,39 +27,78 @@
Stretch="Fill"
Source="../Resources/balken_mitte.gif" />
</DockPanel>
<DockPanel Grid.Row="1" VerticalAlignment="Top">
<Border DockPanel.Dock="Top" Background="#A8C6E3" 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"/>
<DockPanel
Grid.Row="1"
VerticalAlignment="Top">
<Border
DockPanel.Dock="Top"
Background="#A8C6E3"
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 Background="#DCDDDE" Margin="4,0,4,4" CornerRadius="0,0,15,15">
<StackPanel Orientation="Vertical" Margin="15">
<ListView Name="lastProjectsListView" SelectionMode="Single" MouseDoubleClick="lastProjectsDoubleClick">
<Border
Background="#DCDDDE"
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>
<GridView>
<GridViewColumn DisplayMemberBinding="{Binding Path=Name}"
Header="{core:Localize Global.Name}" />
<GridViewColumn DisplayMemberBinding="{Binding Path=LastModification}"
Header="{core:Localize StartPage.StartMenu.ModifiedTable}" />
<GridViewColumn DisplayMemberBinding="{Binding Path=Path}"
Header="{core:Localize StartPage.StartMenu.LocationTable}" />
<GridViewColumn
CellTemplate="{StaticResource nameCellTemplate}"
Header="{core:Localize Global.Name}" />
<GridViewColumn
DisplayMemberBinding="{Binding Path=LastModification}"
Header="{core:Localize StartPage.StartMenu.ModifiedTable}" />
<GridViewColumn
DisplayMemberBinding="{Binding Path=Path}"
Header="{core:Localize StartPage.StartMenu.LocationTable}" />
</GridView>
</ListView.View>
</ListView>
<StackPanel Orientation="Horizontal" 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
Orientation="Horizontal"
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>
</Border>
</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
<Hyperlink NavigateUri="mailto:webmaster@icsharpcode.net">IC#SharpCode</Hyperlink>
<Run Text="{x:Static gui:AboutSharpDevelopTabPage.LicenseSentence}"/>
<Run Text="{x:Static gui:AboutSharpDevelopTabPage.LicenseSentence}" />
</TextBlock>
</Grid>
</UserControl>

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

@ -13,6 +13,7 @@ using System.Windows.Controls; @@ -13,6 +13,7 @@ using System.Windows.Controls;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Project;
using System.Windows.Documents;
namespace ICSharpCode.StartPage
{
@ -60,6 +61,12 @@ 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)
{
new ICSharpCode.SharpDevelop.Project.Commands.LoadSolution().Run();

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

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

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

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

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

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

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

@ -333,7 +333,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -333,7 +333,7 @@ namespace ICSharpCode.SharpDevelop.Project
node.options.Platform = options.SolutionPlatform;
// copy properties to project options
options.GlobalAdditionalProperties.Foreach(node.options.Properties.Add);
options.GlobalAdditionalProperties.ForEach(node.options.Properties.Add);
if (project == rootProject) {
foreach (var pair in options.ProjectAdditionalProperties) {
node.options.Properties[pair.Key] = pair.Value;
@ -603,7 +603,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -603,7 +603,7 @@ namespace ICSharpCode.SharpDevelop.Project
}
}
if (messagesToReport != null) {
messagesToReport.Foreach(ReportMessageInternal);
messagesToReport.ForEach(ReportMessageInternal);
}
if (newNodeWithOutputLockAlreadyFinishedBuilding) {
// 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 @@ -26,7 +26,7 @@ namespace ICSharpCode.SharpDevelop
/// <summary>
/// Runs an action for all elements in the input.
/// </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)
throw new ArgumentNullException("input");
@ -143,6 +143,12 @@ namespace ICSharpCode.SharpDevelop @@ -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
{
public SDWindowsFormsHost(WinForms.Control child)
@ -150,7 +156,7 @@ namespace ICSharpCode.SharpDevelop @@ -150,7 +156,7 @@ namespace ICSharpCode.SharpDevelop
this.Child = child;
child.Disposed += child_Disposed;
}
void child_Disposed(object sender, EventArgs e)
{
Dispose();

Loading…
Cancel
Save