Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit d92ca6f

Browse files
authored
Merge pull request #446 from github/fixes/443-information-pane
Add information pane
2 parents 818cdd7 + 517e2d5 commit d92ca6f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+622
-380
lines changed

src/GitHub.App/SampleData/PullRequestCreationViewModelDesigner.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
using System.Collections.Generic;
44
using GitHub.Models;
55
using GitHub.Validation;
6-
using System;
7-
using System.Windows.Input;
86
using ReactiveUI;
97

108
namespace GitHub.SampleData
@@ -47,5 +45,6 @@ public PullRequestCreationViewModelDesigner()
4745
public ReactivePropertyValidator TitleValidator { get; }
4846

4947
public ReactivePropertyValidator BranchValidator { get; }
48+
5049
}
5150
}

src/GitHub.App/SampleData/SampleViewModels.cs

+5
Original file line numberDiff line numberDiff line change
@@ -493,4 +493,9 @@ public bool OpenRepository()
493493

494494
public IConnection SectionConnection { get; }
495495
}
496+
497+
public class InfoPanelDesigner
498+
{
499+
public string Message => "This is an informational message for the info panel to test things in design mode.";
500+
}
496501
}

src/GitHub.App/ViewModels/PullRequestCreationViewModel.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class PullRequestCreationViewModel : BaseViewModel, IPullRequestCreationV
2828
IPullRequestService service, INotificationService notifications)
2929
: this(connectionRepositoryHostMap.CurrentRepositoryHost, teservice.ActiveRepo, service, notifications)
3030
{}
31-
31+
3232
public PullRequestCreationViewModel(IRepositoryHost repositoryHost, ISimpleRepositoryModel activeRepo,
3333
IPullRequestService service, INotificationService notifications)
3434
{
@@ -74,10 +74,11 @@ public PullRequestCreationViewModel(IRepositoryHost repositoryHost, ISimpleRepos
7474
{
7575
if (!ex.IsCriticalException())
7676
{
77+
notifications.ShowError(ex.Message);
7778
}
7879
});
7980
}
80-
81+
8182
public override void Initialize([AllowNull] ViewWithData data)
8283
{
8384
base.Initialize(data);

src/GitHub.Exports.Reactive/ViewModels/IPullRequestCreationViewModel.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using GitHub.Models;
2-
using GitHub.UI;
32
using System.Collections.Generic;
4-
using System.Windows.Input;
53
using GitHub.Validation;
64
using ReactiveUI;
75

src/GitHub.TeamFoundation.14/Home/PullRequestsNavigationItem.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@ public class PullRequestsNavigationItem : TeamExplorerNavigationItemBase
1919
{
2020
public const string PullRequestsNavigationItemId = "5245767A-B657-4F8E-BFEE-F04159F1DDA3";
2121

22-
readonly Lazy<IVisualStudioBrowser> browser;
2322
readonly IMenuProvider menuProvider;
2423

2524
[ImportingConstructor]
26-
public PullRequestsNavigationItem(ISimpleApiClientFactory apiFactory, Lazy<IVisualStudioBrowser> browser,
27-
ITeamExplorerServiceHolder holder, IMenuProvider menuProvider)
25+
public PullRequestsNavigationItem(ISimpleApiClientFactory apiFactory,
26+
ITeamExplorerServiceHolder holder, IMenuProvider menuProvider)
2827
: base(apiFactory, holder, Octicon.git_pull_request)
2928
{
30-
this.browser = browser;
3129
this.menuProvider = menuProvider;
3230
Text = Resources.PullRequestsNavigationItemText;
3331
ArgbColor = Colors.RedNavigationItem.ToInt32();

src/GitHub.UI/Assets/Buttons.xaml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<ResourceDictionary.MergedDictionaries>
1111
<ResourceDictionary Source="../Controls/Buttons/OcticonCircleButton.xaml" />
1212
<ResourceDictionary Source="../Controls/Buttons/OcticonLinkButton.xaml" />
13+
<ResourceDictionary Source="../Controls/Buttons/OcticonButton.xaml" />
1314
<ResourceDictionary Source="../Controls/ToggleButtons/OcticonCircleToggleButton.xaml" />
1415
<ResourceDictionary Source="../Controls/ToggleButtons/OcticonLinkToggleButton.xaml" />
1516
</ResourceDictionary.MergedDictionaries>

src/GitHub.UI/Controls/Buttons/OcticonButton.cs

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
using NullGuard;
2+
using System;
23
using System.Collections.Generic;
34
using System.Linq;
45
using System.Text;
@@ -7,7 +8,7 @@
78

89
namespace GitHub.UI
910
{
10-
public class OcticonButton: Button
11+
public class OcticonButton : Button
1112
{
1213
public static readonly DependencyProperty IconRotationAngleProperty = DependencyProperty.Register(
1314
"IconRotationAngle", typeof(double), typeof(OcticonButton),
@@ -18,5 +19,15 @@ public double IconRotationAngle
1819
get { return (double)GetValue(IconRotationAngleProperty); }
1920
set { SetValue(IconRotationAngleProperty, value); }
2021
}
22+
23+
public static DependencyProperty IconProperty =
24+
OcticonPath.IconProperty.AddOwner(typeof(OcticonButton));
25+
26+
public Octicon Icon
27+
{
28+
[return: AllowNull]
29+
get { return (Octicon)GetValue(OcticonPath.IconProperty); }
30+
set { SetValue(OcticonPath.IconProperty, value); }
31+
}
2132
}
2233
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="clr-namespace:GitHub.UI">
2+
3+
<Style x:Key="OcticonButton" TargetType="{x:Type ui:OcticonButton}">
4+
<Setter Property="Focusable" Value="True"/>
5+
<Setter Property="Foreground" Value="Black"/>
6+
<Setter Property="Height" Value="16"/>
7+
<Setter Property="Width" Value="16"/>
8+
<Setter Property="Margin" Value="0"/>
9+
<Setter Property="Padding" Value="0"/>
10+
<Setter Property="HorizontalAlignment" Value="Center"/>
11+
<Setter Property="VerticalAlignment" Value="Center"/>
12+
<Setter Property="BorderBrush" Value="Transparent"/>
13+
<Setter Property="Template">
14+
<Setter.Value>
15+
<ControlTemplate TargetType="ui:OcticonButton">
16+
<Grid x:Name="content" Margin="{TemplateBinding Margin}" Background="Transparent">
17+
<VisualStateManager.VisualStateGroups>
18+
<VisualStateGroup x:Name="CommonStates">
19+
<VisualState x:Name="Normal"/>
20+
<VisualState x:Name="MouseOver">
21+
<Storyboard>
22+
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="MouseOverBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
23+
<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
24+
</DoubleAnimationUsingKeyFrames>
25+
</Storyboard>
26+
</VisualState>
27+
<VisualState x:Name="Pressed">
28+
<Storyboard>
29+
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PressedBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
30+
<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
31+
</DoubleAnimationUsingKeyFrames>
32+
</Storyboard>
33+
</VisualState>
34+
<VisualState x:Name="Disabled">
35+
<Storyboard>
36+
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity">
37+
<SplineDoubleKeyFrame KeyTime="0" Value="0.5"/>
38+
</DoubleAnimationUsingKeyFrames>
39+
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="(UIElement.Opacity)">
40+
<EasingDoubleKeyFrame KeyTime="0" Value="0.5"/>
41+
</DoubleAnimationUsingKeyFrames>
42+
</Storyboard>
43+
</VisualState>
44+
</VisualStateGroup>
45+
<VisualStateGroup x:Name="FocusStates">
46+
<VisualState x:Name="Focused"/>
47+
<VisualState x:Name="Unfocused"/>
48+
</VisualStateGroup>
49+
</VisualStateManager.VisualStateGroups>
50+
<Grid.ColumnDefinitions>
51+
<ColumnDefinition Width="Auto"/>
52+
</Grid.ColumnDefinitions>
53+
<Border x:Name="Background"
54+
Background="{TemplateBinding Background}"
55+
BorderBrush="{TemplateBinding BorderBrush}"
56+
BorderThickness="1"
57+
SnapsToDevicePixels="True"/>
58+
<Rectangle x:Name="DisabledVisualElement"
59+
Fill="#FFFCFCFC"
60+
IsHitTestVisible="False"
61+
Opacity="0"
62+
SnapsToDevicePixels="True"/>
63+
<Border x:Name="MouseOverBorder"
64+
Background="#FFDDDDE6"
65+
BorderBrush="{TemplateBinding BorderBrush}"
66+
BorderThickness="1"
67+
Opacity="0"
68+
SnapsToDevicePixels="True"/>
69+
<Border x:Name="PressedBorder"
70+
Background="#FFCFCFDB"
71+
BorderBrush="{TemplateBinding BorderBrush}"
72+
BorderThickness="1"
73+
Opacity="0"
74+
SnapsToDevicePixels="True"/>
75+
<Border x:Name="DefaultVisualElement"
76+
Background="Transparent"
77+
BorderBrush="{TemplateBinding BorderBrush}"
78+
BorderThickness="1"
79+
Opacity="0"
80+
SnapsToDevicePixels="True"/>
81+
<Viewbox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Width="16" Height="16">
82+
<Border BorderBrush="Transparent" BorderThickness="1">
83+
84+
<ui:OcticonPath Height="16"
85+
Fill="{TemplateBinding Foreground}"
86+
Icon="{TemplateBinding Icon}"
87+
SnapsToDevicePixels="True"/>
88+
</Border>
89+
</Viewbox>
90+
</Grid>
91+
<ControlTemplate.Triggers>
92+
<Trigger Property="IsDefaulted" Value="True">
93+
<Setter TargetName="DefaultVisualElement" Property="Opacity" Value="1"/>
94+
</Trigger>
95+
<Trigger Property="IsKeyboardFocused" Value="True">
96+
<Setter TargetName="DefaultVisualElement" Property="Opacity" Value="1"/>
97+
</Trigger>
98+
</ControlTemplate.Triggers>
99+
</ControlTemplate>
100+
</Setter.Value>
101+
</Setter>
102+
</Style>
103+
104+
<Style BasedOn="{StaticResource OcticonButton}" TargetType="{x:Type ui:OcticonButton}"/>
105+
</ResourceDictionary>

src/GitHub.UI/Controls/Buttons/OcticonCircleButton.cs

-17
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,6 @@ public class OcticonCircleButton : OcticonButton
2828
FrameworkPropertyMetadataOptions.AffectsMeasure |
2929
FrameworkPropertyMetadataOptions.AffectsRender));
3030

31-
public static readonly DependencyProperty IconProperty = DependencyProperty.Register(
32-
"Icon", typeof(Octicon), typeof(OcticonCircleButton),
33-
new FrameworkPropertyMetadata(defaultValue: Octicon.mark_github, flags:
34-
FrameworkPropertyMetadataOptions.AffectsArrange |
35-
FrameworkPropertyMetadataOptions.AffectsMeasure |
36-
FrameworkPropertyMetadataOptions.AffectsRender,
37-
propertyChangedCallback: OnIconChanged
38-
)
39-
);
40-
4131
public bool ShowSpinner
4232
{
4333
get { return (bool)GetValue(ShowSpinnerProperty); }
@@ -78,13 +68,6 @@ public double IconSize
7868
set { SetValue(IconSizeProperty, value); }
7969
}
8070

81-
public Octicon Icon
82-
{
83-
[return: AllowNull]
84-
get { return (Octicon)GetValue(OcticonPath.IconProperty); }
85-
set { SetValue(OcticonPath.IconProperty, value); }
86-
}
87-
8871
public Geometry Data
8972
{
9073
[return: AllowNull]

src/GitHub.UI/Controls/Buttons/OcticonLinkButton.cs

-6
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ namespace GitHub.UI
1616
{
1717
public partial class OcticonLinkButton : OcticonButton
1818
{
19-
public Octicon Icon
20-
{
21-
get { return (Octicon)GetValue(OcticonPath.IconProperty); }
22-
set { SetValue(OcticonPath.IconProperty, value); }
23-
}
24-
2519
public Geometry Data
2620
{
2721
[return: AllowNull]

src/GitHub.UI/Controls/Octicons/OcticonPath.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ public class OcticonPath : Shape
2828
new FrameworkPropertyMetadata(defaultValue: Octicon.mark_github, flags:
2929
FrameworkPropertyMetadataOptions.AffectsArrange |
3030
FrameworkPropertyMetadataOptions.AffectsMeasure |
31-
FrameworkPropertyMetadataOptions.AffectsRender
31+
FrameworkPropertyMetadataOptions.AffectsRender,
32+
propertyChangedCallback: OnIconChanged
3233
)
3334
);
3435

@@ -85,5 +86,9 @@ static Geometry LoadGeometry(Octicon icon)
8586

8687
return path;
8788
}
89+
static void OnIconChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
90+
{
91+
d.SetValue(Path.DataProperty, OcticonPath.GetGeometryForIcon((Octicon)e.NewValue));
92+
}
8893
}
8994
}

src/GitHub.UI/GitHub.UI.csproj

+4
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@
194194
<Generator>MSBuild:Compile</Generator>
195195
<SubType>Designer</SubType>
196196
</Page>
197+
<Page Include="Controls\Buttons\OcticonButton.xaml">
198+
<Generator>MSBuild:Compile</Generator>
199+
<SubType>Designer</SubType>
200+
</Page>
197201
<Page Include="Controls\Buttons\OcticonLinkButton.xaml">
198202
<Generator>MSBuild:Compile</Generator>
199203
<SubType>Designer</SubType>

0 commit comments

Comments
 (0)