Skip to content

Commit

Permalink
fix design
Browse files Browse the repository at this point in the history
  • Loading branch information
chenss3 committed Aug 7, 2020
1 parent f7c5fc5 commit bc0f122
Show file tree
Hide file tree
Showing 24 changed files with 87 additions and 51 deletions.
Binary file modified .vs/InfoBarDemo/v16/.suo
Binary file not shown.
12 changes: 9 additions & 3 deletions InfoBarDemo/InfoBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using Windows.ApplicationModel;
using System.ServiceModel.Channels;
using Windows.UI.Xaml.Documents;
using InfoBar;

namespace InfoBarDemo
{
Expand Down Expand Up @@ -195,7 +196,7 @@ private void UpdateMargins()
{
if (Message != null && Message != "")
{
if (ActionButtonContent != null)
if (ActionButtonContent != null || HyperlinkButtonContent != null)
{
_message.Margin = new Thickness(0, 12, 12, 12);
}
Expand Down Expand Up @@ -588,21 +589,26 @@ void OnIsOpenChanged()
// Opens or closes the InfoBar
private void Open(bool value)
{

InfoBarAutomationPeer infoBarPeer = FrameworkElementAutomationPeer.FromElement(this) as InfoBarAutomationPeer ?? null;
if (value)
{
VisualStateManager.GoToState(this, "Visible", false);
IsOpen = true;
infoBarPeer.RaiseWindowOpenedEvent(Title + " " + Message);
}
else
{
VisualStateManager.GoToState(this, "Collapsed", false);
IsOpen = false;
RaiseClosedEvent();
infoBarPeer.RaiseWindowOpenedEvent("InfoBar dismissed");
}
}


protected override AutomationPeer OnCreateAutomationPeer()
{
return new InfoBarAutomationPeer(this);
}

}
}
45 changes: 45 additions & 0 deletions InfoBarDemo/InfoBarAutomationPeer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using Windows.UI.Xaml;
using Windows.UI.Xaml.Automation.Peers;

namespace InfoBar
{
public class InfoBarAutomationPeer : FrameworkElementAutomationPeer
{
public InfoBarAutomationPeer(FrameworkElement owner) : base(owner)
{

}

protected override AutomationControlType GetAutomationControlTypeCore()
{
return AutomationControlType.StatusBar;
}

protected override string GetClassNameCore()
{
return nameof(InfoBar);
}

public void RaiseWindowOpenedEvent(string displayString)
{
AutomationPeer autPeer = this;
autPeer.RaiseNotificationEvent(AutomationNotificationKind.Other, AutomationNotificationProcessing.CurrentThenMostRecent, displayString, "InfoBarOpenedActivityId");

if (AutomationPeer.ListenerExists(AutomationEvents.WindowOpened))
{
RaiseAutomationEvent(AutomationEvents.WindowOpened);
}
}

void RaiseWindowClosedEvent(string displayString)
{
AutomationPeer autPeer = this;
autPeer.RaiseNotificationEvent(AutomationNotificationKind.Other, AutomationNotificationProcessing.CurrentThenMostRecent, displayString, "InfoBarClosedActivityId");
if (AutomationPeer.ListenerExists(AutomationEvents.WindowClosed))
{
RaiseAutomationEvent(AutomationEvents.WindowClosed);
}
}

}
}
1 change: 1 addition & 0 deletions InfoBarDemo/InfoBarDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
<DependentUpon>FavoritesPage.xaml</DependentUpon>
</Compile>
<Compile Include="InfoBar.cs" />
<Compile Include="InfoBarAutomationPeer.cs" />
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
Expand Down
4 changes: 2 additions & 2 deletions InfoBarDemo/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ namespace InfoBarDemo
/// </summary>
public sealed partial class MainPage : Page
{
private static int refreshed = 1;
private static bool saved = false;
private int refreshed = 1;
private bool saved = false;

private List<File> Files;
public MainPage()
Expand Down
24 changes: 8 additions & 16 deletions InfoBarDemo/Themes/Generic.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>

<IconSourceElement x:Name="StandardIcon"
Expand All @@ -208,11 +206,8 @@
IconSource="{TemplateBinding IconSource}"
Grid.Column="0"/>

<Grid x:Name="TextPanel" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel x:Name="TextPanel" Orientation ="Horizontal" Grid.Column="1">

<TextBlock x:Name="Title"
Text="{TemplateBinding Title}"
AutomationProperties.LandmarkType="Navigation"
Expand All @@ -225,27 +220,24 @@
<TextBlock x:Name="Message"
Text="{TemplateBinding Message}"
FontSize="{ThemeResource InfoBarFontSize}"
TextTrimming="CharacterEllipsis"
Grid.Column="1"/>
</Grid>

<Button Name="ActionButton"
TextTrimming="CharacterEllipsis"/>
<Button Name="ActionButton"
Content="{TemplateBinding ActionButtonContent}"
Command="{TemplateBinding ActionButtonCommand}"
Style="{TemplateBinding ActionButtonStyle}"
Width="96"
Height="24"
Grid.Column="2"
Padding="0"
CornerRadius="2,2,2,2"/>

<HyperlinkButton x:Name="HyperlinkButton"
<HyperlinkButton x:Name="HyperlinkButton"
Content="{TemplateBinding HyperlinkButtonContent}"
Style="{TemplateBinding HyperlinkButtonStyle}"
FontSize="{ThemeResource InfoBarFontSize}"
Grid.Column="3"
Padding="0"
Foreground="{ThemeResource InfoBarHyperlinkButtonColor}"/>
</StackPanel>



<Button Name="AlternateCloseButton"
Expand All @@ -256,7 +248,7 @@
Width="{StaticResource InfoBarAlternateCloseButtonSize}"
Background="Transparent"
FontSize="16"
Grid.Column="4"
Grid.Column="2"
Margin="0, 0, -12, 0">
<Viewbox Width="{StaticResource InfoBarAlternateCloseButtonGlyphSize}"
Height="{StaticResource InfoBarAlternateCloseButtonGlyphSize}">
Expand Down
2 changes: 1 addition & 1 deletion InfoBarDemo/bin/x86/Debug/AppX/InfoBarDemo.xr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@
<RootProperty Name="FontSize" />
<RootProperty Name="Name" />
<RootProperty Name="Command" />
<RootProperty Name="CommandParameter" />
<RootProperty Name="Style" />
<RootProperty Name="Padding" />
<RootProperty Name="CommandParameter" />
<RootEvent Name="Click" />
</RootType>
<RootType FullName="InfoBarDemo.InfoBar">
Expand Down
Binary file modified InfoBarDemo/bin/x86/Debug/AppX/Themes/Generic.xbf
Binary file not shown.
Binary file modified InfoBarDemo/bin/x86/Debug/AppX/entrypoint/InfoBarDemo.exe
Binary file not shown.
18 changes: 9 additions & 9 deletions InfoBarDemo/bin/x86/Debug/AppX/vs.appxrecipe
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
<AppXManifest Include="C:\Users\t-soc\Repos\InfoBarDemo\InfoBarDemo\bin\x86\Debug\Core\AppxManifest.xml">
<PackagePath>AppxManifest.xml</PackagePath>
<ReRegisterAppIfChanged>true</ReRegisterAppIfChanged>
<Modified>2020-08-03T19:12:05.204</Modified>
<Modified>2020-08-05T16:19:31.730</Modified>
</AppXManifest>
</ItemGroup>
<ItemGroup>
<AppxPackagedFile Include="C:\Users\t-soc\Repos\InfoBarDemo\InfoBarDemo\bin\x86\Debug\InfoBarDemo.exe">
<PackagePath>entrypoint\InfoBarDemo.exe</PackagePath>
<Modified>2020-08-03T19:12:03.283</Modified>
<Modified>2020-08-05T16:19:29.755</Modified>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Program Files %28x86%29\Microsoft SDKs\UWPNuGetPackages\runtime.win10-x86.microsoft.netcore.universalwindowsplatform\6.2.10\runtimes\win10-x86\lib\uap10.0.15138\System.Runtime.dll">
<PackagePath>System.Runtime.dll</PackagePath>
Expand Down Expand Up @@ -126,23 +126,23 @@
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Users\t-soc\Repos\InfoBarDemo\InfoBarDemo\bin\x86\Debug\InfoBarDemo.xr.xml">
<PackagePath>InfoBarDemo.xr.xml</PackagePath>
<Modified>2020-08-03T17:16:54.897</Modified>
<Modified>2020-08-04T21:53:10.632</Modified>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Users\t-soc\Repos\InfoBarDemo\InfoBarDemo\bin\x86\Debug\App.xbf">
<PackagePath>App.xbf</PackagePath>
<Modified>2020-08-03T19:12:02.923</Modified>
<Modified>2020-08-05T16:02:07.026</Modified>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Users\t-soc\Repos\InfoBarDemo\InfoBarDemo\bin\x86\Debug\FavoritesPage.xbf">
<PackagePath>FavoritesPage.xbf</PackagePath>
<Modified>2020-08-03T19:12:02.923</Modified>
<Modified>2020-08-05T16:02:07.027</Modified>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Users\t-soc\Repos\InfoBarDemo\InfoBarDemo\bin\x86\Debug\MainPage.xbf">
<PackagePath>MainPage.xbf</PackagePath>
<Modified>2020-08-03T19:12:02.922</Modified>
<Modified>2020-08-05T16:02:07.026</Modified>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Users\t-soc\Repos\InfoBarDemo\InfoBarDemo\bin\x86\Debug\Themes\Generic.xbf">
<PackagePath>Themes\Generic.xbf</PackagePath>
<Modified>2020-08-03T19:12:02.909</Modified>
<Modified>2020-08-05T16:02:07.017</Modified>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Program Files %28x86%29\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\Microsoft.UniversalCRT.Debug\10.0.19041.0\\redist\Debug\x86\ucrtbased.dll">
<PackagePath>ucrtbased.dll</PackagePath>
Expand All @@ -158,11 +158,11 @@
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Users\t-soc\Repos\InfoBarDemo\InfoBarDemo\bin\x86\Debug\resources.pri">
<PackagePath>resources.pri</PackagePath>
<Modified>2020-08-03T17:00:15.780</Modified>
<Modified>2020-08-05T16:19:30.319</Modified>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Users\t-soc\Repos\InfoBarDemo\InfoBarDemo\bin\x86\Debug\Core\InfoBarDemo.exe">
<PackagePath>InfoBarDemo.exe</PackagePath>
<Modified>2020-08-03T19:12:05.156</Modified>
<Modified>2020-08-05T16:19:31.685</Modified>
</AppxPackagedFile>
</ItemGroup>
<ItemGroup>
Expand Down
Binary file modified InfoBarDemo/bin/x86/Debug/InfoBarDemo.exe
Binary file not shown.
Binary file modified InfoBarDemo/bin/x86/Debug/InfoBarDemo.pdb
Binary file not shown.
2 changes: 1 addition & 1 deletion InfoBarDemo/bin/x86/Debug/InfoBarDemo.xr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@
<RootProperty Name="FontSize" />
<RootProperty Name="Name" />
<RootProperty Name="Command" />
<RootProperty Name="CommandParameter" />
<RootProperty Name="Style" />
<RootProperty Name="Padding" />
<RootProperty Name="CommandParameter" />
<RootEvent Name="Click" />
</RootType>
<RootType FullName="InfoBarDemo.InfoBar">
Expand Down
Binary file modified InfoBarDemo/bin/x86/Debug/Themes/Generic.xbf
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6157fe84882bfe171f0edfbd3841f6b5f49db236
b8e1e7d7ff4e47e30a58b374633802d88023d1a2
Binary file not shown.
Binary file modified InfoBarDemo/obj/x86/Debug/InfoBarDemo.exe
Binary file not shown.
Binary file modified InfoBarDemo/obj/x86/Debug/InfoBarDemo.pdb
Binary file not shown.
2 changes: 1 addition & 1 deletion InfoBarDemo/obj/x86/Debug/InfoBarDemo.xr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@
<RootProperty Name="FontSize" />
<RootProperty Name="Name" />
<RootProperty Name="Command" />
<RootProperty Name="CommandParameter" />
<RootProperty Name="Style" />
<RootProperty Name="Padding" />
<RootProperty Name="CommandParameter" />
<RootEvent Name="Click" />
</RootType>
<RootType FullName="InfoBarDemo.InfoBar">
Expand Down
24 changes: 8 additions & 16 deletions InfoBarDemo/obj/x86/Debug/Themes/Generic.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>

<IconSourceElement x:Name="StandardIcon"
Expand All @@ -208,11 +206,8 @@
IconSource="{TemplateBinding IconSource}"
Grid.Column="0"/>

<Grid x:Name="TextPanel" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel x:Name="TextPanel" Orientation ="Horizontal" Grid.Column="1">

<TextBlock x:Name="Title"
Text="{TemplateBinding Title}"
AutomationProperties.LandmarkType="Navigation"
Expand All @@ -225,27 +220,24 @@
<TextBlock x:Name="Message"
Text="{TemplateBinding Message}"
FontSize="{ThemeResource InfoBarFontSize}"
TextTrimming="CharacterEllipsis"
Grid.Column="1"/>
</Grid>

<Button Name="ActionButton"
TextTrimming="CharacterEllipsis"/>
<Button Name="ActionButton"
Content="{TemplateBinding ActionButtonContent}"
Command="{TemplateBinding ActionButtonCommand}"
Style="{TemplateBinding ActionButtonStyle}"
Width="96"
Height="24"
Grid.Column="2"
Padding="0"
CornerRadius="2,2,2,2"/>

<HyperlinkButton x:Name="HyperlinkButton"
<HyperlinkButton x:Name="HyperlinkButton"
Content="{TemplateBinding HyperlinkButtonContent}"
Style="{TemplateBinding HyperlinkButtonStyle}"
FontSize="{ThemeResource InfoBarFontSize}"
Grid.Column="3"
Padding="0"
Foreground="{ThemeResource InfoBarHyperlinkButtonColor}"/>
</StackPanel>



<Button Name="AlternateCloseButton"
Expand All @@ -256,7 +248,7 @@
Width="{StaticResource InfoBarAlternateCloseButtonSize}"
Background="Transparent"
FontSize="16"
Grid.Column="4"
Grid.Column="2"
Margin="0, 0, -12, 0">
<Viewbox Width="{StaticResource InfoBarAlternateCloseButtonGlyphSize}"
Height="{StaticResource InfoBarAlternateCloseButtonGlyphSize}">
Expand Down
Binary file modified InfoBarDemo/obj/x86/Debug/Themes/Generic.xbf
Binary file not shown.
2 changes: 1 addition & 1 deletion InfoBarDemo/obj/x86/Debug/XamlSaveStateFile.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?xml version="1.0" encoding="utf-8"?><XamlCompilerSaveState><ReferenceAssemblyList><LocalAssembly PathName="c:\users\t-soc\repos\infobardemo\infobardemo\obj\x86\debug\intermediatexaml\infobardemo.exe" HashGuid="5235e944-705d-cb82-6156-f6e7a2038ea5" /></ReferenceAssemblyList><XamlSourceFileDataList><XamlSourceFileData XamlFileName="App.xaml" ClassFullName="InfoBarDemo.App" GeneratedCodePathPrefix="C:\Users\t-soc\Repos\InfoBarDemo\InfoBarDemo\obj\x86\Debug\App" XamlFileTimeAtLastCompileInTicks="637318084265140178" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="MainPage.xaml" ClassFullName="InfoBarDemo.MainPage" GeneratedCodePathPrefix="C:\Users\t-soc\Repos\InfoBarDemo\InfoBarDemo\obj\x86\Debug\MainPage" XamlFileTimeAtLastCompileInTicks="637320607084936469" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="Themes\Generic.xaml" ClassFullName="" GeneratedCodePathPrefix="" XamlFileTimeAtLastCompileInTicks="637318054158212003" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="FavoritesPage.xaml" ClassFullName="InfoBarDemo.FavoritesPage" GeneratedCodePathPrefix="C:\Users\t-soc\Repos\InfoBarDemo\InfoBarDemo\obj\x86\Debug\FavoritesPage" XamlFileTimeAtLastCompileInTicks="637320607084726883" HasBoundEventAssignments="False" /></XamlSourceFileDataList></XamlCompilerSaveState>
<?xml version="1.0" encoding="utf-8"?><XamlCompilerSaveState><ReferenceAssemblyList><LocalAssembly PathName="c:\users\t-soc\repos\infobardemo\infobardemo\obj\x86\debug\intermediatexaml\infobardemo.exe" HashGuid="8ba95473-b9c1-649c-1f5e-e88903c23065" /></ReferenceAssemblyList><XamlSourceFileDataList><XamlSourceFileData XamlFileName="App.xaml" ClassFullName="InfoBarDemo.App" GeneratedCodePathPrefix="C:\Users\t-soc\Repos\InfoBarDemo\InfoBarDemo\obj\x86\Debug\App" XamlFileTimeAtLastCompileInTicks="637318084265140178" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="MainPage.xaml" ClassFullName="InfoBarDemo.MainPage" GeneratedCodePathPrefix="C:\Users\t-soc\Repos\InfoBarDemo\InfoBarDemo\obj\x86\Debug\MainPage" XamlFileTimeAtLastCompileInTicks="637320607084936469" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="Themes\Generic.xaml" ClassFullName="" GeneratedCodePathPrefix="" XamlFileTimeAtLastCompileInTicks="637321567731184759" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="FavoritesPage.xaml" ClassFullName="InfoBarDemo.FavoritesPage" GeneratedCodePathPrefix="C:\Users\t-soc\Repos\InfoBarDemo\InfoBarDemo\obj\x86\Debug\FavoritesPage" XamlFileTimeAtLastCompileInTicks="637320607084726883" HasBoundEventAssignments="False" /></XamlSourceFileDataList></XamlCompilerSaveState>
Binary file modified InfoBarDemo/obj/x86/Debug/intermediatexaml/InfoBarDemo.exe
Binary file not shown.
Binary file modified InfoBarDemo/obj/x86/Debug/intermediatexaml/InfoBarDemo.pdb
Binary file not shown.

0 comments on commit bc0f122

Please sign in to comment.