Skip to content

Commit

Permalink
add notification banner
Browse files Browse the repository at this point in the history
  • Loading branch information
duchuule committed Oct 9, 2015
1 parent 2f78a7a commit 26ea125
Show file tree
Hide file tree
Showing 9 changed files with 211 additions and 100 deletions.
229 changes: 135 additions & 94 deletions DirectXPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@

<SwapChainPanel x:Name="swapChainPanel">

<!-- Adaptive triggers -->
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<!-- Adaptive triggers -->
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState x:Name="wideView">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="1000" />
</VisualState.StateTriggers>
<VisualState.Setters>
<!--<Setter Target="RootSplitView.DisplayMode" Value="CompactInline"/>
<Setter Target="RootSplitView.IsPaneOpen" Value="True"/>-->
<Setter Target="RootSplitView.OpenPaneLength" Value="200"/>
</VisualState.Setters>
</VisualState>
<AdaptiveTrigger MinWindowWidth="1000" />
</VisualState.StateTriggers>
<VisualState.Setters>
<!--<Setter Target="RootSplitView.DisplayMode" Value="CompactInline"/>
<Setter Target="RootSplitView.IsPaneOpen" Value="True"/>-->
<Setter Target="RootSplitView.OpenPaneLength" Value="200"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="mediumView">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="500" />
Expand All @@ -59,90 +59,90 @@
</VisualState>

<VisualState x:Name="narrowView">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0" />
</VisualState.StateTriggers>
<VisualState.Setters>
<!--<Setter Target="RootSplitView.DisplayMode" Value="Overlay"/>-->
<Setter Target="RootSplitView.OpenPaneLength" Value="48"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>


<!-- Top-level navigation menu + app content -->
<SplitView x:Name="RootSplitView"
DisplayMode="Inline"
IsTabStop="False"
Background="Transparent"
>
<SplitView.Pane >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- A custom ListView to display the items in the pane. The automation Name is set in the ContainerContentChanging event. -->
<controls:NavMenuListView x:Name="NavMenuList"
IsTabStop="False"
Margin="0,48,0,0"
VerticalAlignment="Top"
ContainerContentChanging="NavMenuItemContainerContentChanging"
ItemContainerStyle="{StaticResource NavMenuItemContainerStyle}"
ItemTemplate="{StaticResource NavMenuItemTemplate}"
ItemInvoked="NavMenuList_ItemInvoked"
>
<!--<controls:NavMenuListView.Header>
-->
<!-- Using this custom back navigation button until the system-provided back button is enabled. -->
<!--
<Button x:Name="BackButton"
TabIndex="2"
Style="{StaticResource NavigationBackButtonStyle}"
IsEnabled="{x:Bind AppFrame.CanGoBack, Mode=OneWay}"
HorizontalAlignment="{Binding ItemsPanelRoot.HorizontalAlignment, ElementName=NavMenuList}"
Click="BackButton_Click"/>
</controls:NavMenuListView.Header>-->
</controls:NavMenuListView>
</Grid>

</SplitView.Pane>

<!-- OnNavigatingToPage we synchronize the selected item in the nav menu with the current page.
OnNavigatedToPage we move keyboard focus to the first item on the page after it's loaded. -->
<SplitView.Content>
<Frame x:Name="contentFrame" Margin="-1,0,0,0">
<!--Navigating="OnNavigatingToPage"
Navigated="OnNavigatedToPage"-->

<Frame.ContentTransitions>
<TransitionCollection>
<NavigationThemeTransition>
<NavigationThemeTransition.DefaultNavigationTransitionInfo>
<EntranceNavigationTransitionInfo/>
</NavigationThemeTransition.DefaultNavigationTransitionInfo>
</NavigationThemeTransition>
</TransitionCollection>
</Frame.ContentTransitions>

</Frame>
</SplitView.Content>
</SplitView>

<!-- Declared last to have it rendered above everything else, but it needs to be the first item in the tab sequence. -->
<ToggleButton x:Name="TogglePaneButton"
IsTabStop="False"
Style="{StaticResource SplitViewTogglePaneButtonStyle}"
IsChecked="{Binding IsPaneOpen, ElementName=RootSplitView, Mode=TwoWay}"
Unchecked="TogglePaneButton_UnChecked"
Checked="TogglePaneButton_Checked"
AutomationProperties.Name="Menu"
ToolTipService.ToolTip="Menu"
VerticalAlignment="Top"
/>
<!---->
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0" />
</VisualState.StateTriggers>
<VisualState.Setters>
<!--<Setter Target="RootSplitView.DisplayMode" Value="Overlay"/>-->
<Setter Target="RootSplitView.OpenPaneLength" Value="48"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>


<!-- Top-level navigation menu + app content -->
<SplitView x:Name="RootSplitView"
DisplayMode="Inline"
IsTabStop="False"
Background="Transparent"
>
<SplitView.Pane >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- A custom ListView to display the items in the pane. The automation Name is set in the ContainerContentChanging event. -->
<controls:NavMenuListView x:Name="NavMenuList"
IsTabStop="False"
Margin="0,48,0,0"
VerticalAlignment="Top"
ContainerContentChanging="NavMenuItemContainerContentChanging"
ItemContainerStyle="{StaticResource NavMenuItemContainerStyle}"
ItemTemplate="{StaticResource NavMenuItemTemplate}"
ItemInvoked="NavMenuList_ItemInvoked"
>
<!--<controls:NavMenuListView.Header>
-->
<!-- Using this custom back navigation button until the system-provided back button is enabled. -->
<!--
<Button x:Name="BackButton"
TabIndex="2"
Style="{StaticResource NavigationBackButtonStyle}"
IsEnabled="{x:Bind AppFrame.CanGoBack, Mode=OneWay}"
HorizontalAlignment="{Binding ItemsPanelRoot.HorizontalAlignment, ElementName=NavMenuList}"
Click="BackButton_Click"/>
</controls:NavMenuListView.Header>-->
</controls:NavMenuListView>
</Grid>

</SplitView.Pane>

<!-- OnNavigatingToPage we synchronize the selected item in the nav menu with the current page.
OnNavigatedToPage we move keyboard focus to the first item on the page after it's loaded. -->
<SplitView.Content>
<Frame x:Name="contentFrame" Margin="-1,0,0,0">
<!--Navigating="OnNavigatingToPage"
Navigated="OnNavigatedToPage"-->

<Frame.ContentTransitions>
<TransitionCollection>
<NavigationThemeTransition>
<NavigationThemeTransition.DefaultNavigationTransitionInfo>
<EntranceNavigationTransitionInfo/>
</NavigationThemeTransition.DefaultNavigationTransitionInfo>
</NavigationThemeTransition>
</TransitionCollection>
</Frame.ContentTransitions>

</Frame>
</SplitView.Content>
</SplitView>

<!-- Declared last to have it rendered above everything else, but it needs to be the first item in the tab sequence. -->
<ToggleButton x:Name="TogglePaneButton"
IsTabStop="False"
Style="{StaticResource SplitViewTogglePaneButtonStyle}"
IsChecked="{Binding IsPaneOpen, ElementName=RootSplitView, Mode=TwoWay}"
Unchecked="TogglePaneButton_UnChecked"
Checked="TogglePaneButton_Checked"
AutomationProperties.Name="Menu"
ToolTipService.ToolTip="Menu"
VerticalAlignment="Top"
/>
<!---->

<!-- buttons to accept/cancel button position configuration-->
<!-- buttons to accept/cancel button position configuration-->
<StackPanel x:Name="panelEditButton"
Visibility="Collapsed"
HorizontalAlignment="Center"
Expand All @@ -168,6 +168,47 @@

</StackPanel>

<!--notification bannter-->
<StackPanel Background="{ThemeResource SystemControlBackgroundAccentBrush}"
VerticalAlignment="Top"
x:Name="notificationPanel"
Opacity="0"
Visibility="Collapsed"
>
<StackPanel.Resources>
<Storyboard x:Name="notificationEntrance">
<PopInThemeAnimation SpeedRatio="0.7" TargetName="notificationPanel"
/>
</Storyboard>

<Storyboard x:Name="notificationExit">
<PopOutThemeAnimation SpeedRatio="0.7" TargetName="notificationPanel" />
</Storyboard>

<Storyboard x:Name="notificationEntranceExit" Storyboard.TargetName="">
<DoubleAnimationUsingKeyFrames BeginTime="0:0:0" Storyboard.TargetName="notificationPanel"
Storyboard.TargetProperty="Opacity">
<SplineDoubleKeyFrame KeyTime="0:0:0.5" Value="1"/>
<SplineDoubleKeyFrame KeyTime="0:0:2.5" Value="1"/>
<SplineDoubleKeyFrame KeyTime="0:0:3" Value="0"/>
</DoubleAnimationUsingKeyFrames>

<ObjectAnimationUsingKeyFrames BeginTime="0:0:0" Storyboard.TargetName="notificationPanel"
Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible"/>
<DiscreteObjectKeyFrame KeyTime="0:0:3" Value="Collapsed"/>
</ObjectAnimationUsingKeyFrames>

</Storyboard>
</StackPanel.Resources>

<TextBlock x:Name="txtNotification"
Text="test" Foreground="White"
Margin="12,4,12,4"

/>
</StackPanel>

</SwapChainPanel>

<!--<Page.BottomAppBar>
Expand Down
46 changes: 46 additions & 0 deletions DirectXPage.xaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ using namespace Windows::Globalization; //to get date time
using namespace Windows::System::Display;
using namespace Windows::ApplicationModel::Activation;
using namespace Windows::Storage::AccessCache;
using namespace Windows::Devices::HumanInterfaceDevice;
using namespace Windows::Devices::Enumeration;

using namespace std;
using namespace VBA10;
Expand Down Expand Up @@ -237,6 +239,41 @@ DirectXPage::DirectXPage():
RootSplitView->IsPaneOpen = true;

}, task_continuation_context::use_current());


//check hid gamepad connection
auto deviceSelector = HidDevice::GetDeviceSelector(0x0001, 0x0005);
create_task(DeviceInformation::FindAllAsync(deviceSelector))
.then([loader, this](DeviceInformationCollection^ collection)
{

//VID_045E = microsoft
Vector<DeviceInformation^>^ HIDDeviceList = ref new Vector<DeviceInformation^>();
Vector<String^>^ deviceIDs = ref new Vector<String^>();
for (int i = 0; i < collection->Size; i++)
{
DeviceInformation^ device = collection->GetAt(i);

//ignore microsoft xbox controller
wstring deviceid(device->Id->Begin(), device->Id->End());
if (deviceid.find(L"VID_045E") != string::npos)
continue;

HIDDeviceList->Append(device);
deviceIDs->Append(device->Name);
}

if (HIDDeviceList->Size > 0)
{
this->ShowNotification(deviceIDs->GetAt(0) + " detected.");
}
else
{

}

}, task_continuation_context::use_current());



}
Expand Down Expand Up @@ -1121,3 +1158,12 @@ void DirectXPage::AcceptPositionBtn_Click(Platform::Object^ sender, Windows::UI:
this->m_main->emulator->LeaveButtonEditMode(true);
this->panelEditButton->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
}

void DirectXPage::ShowNotification(Platform::String^ notificationText)
{
this->txtNotification->Text = notificationText;
//this->notificationPanel->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
this->notificationEntranceExit->Begin();

//DispatcherTimer dispatcherTimer = ref new DispatcherTimer();
}
1 change: 1 addition & 0 deletions DirectXPage.xaml.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ namespace VBA10
task<void> UpdateDBEntry();
task<void> SaveBeforeStop();
void ImportRomFromFile(Windows::ApplicationModel::Activation::FileActivatedEventArgs^ args);
void ShowNotification(Platform::String^ notificationText);


protected:
Expand Down
2 changes: 1 addition & 1 deletion Package.appxmanifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
<Identity Name="16994Sparksoft.VBA10" Publisher="CN=9289A21E-3389-49E2-A9E0-46AA1289C3CB" Version="1.18.187.0" />
<Identity Name="16994Sparksoft.VBA10" Publisher="CN=9289A21E-3389-49E2-A9E0-46AA1289C3CB" Version="1.19.189.0" />
<mp:PhoneIdentity PhoneProductId="2b9558e5-6253-426c-8989-3284f508e743" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>VBA10</DisplayName>
Expand Down
3 changes: 2 additions & 1 deletion PurchasePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
Height="48"
Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}">
<TextBlock x:Name="title"
Style="{StaticResource PageTitleTextBlockStyle}" Text="PURCHASE"/>
Style="{StaticResource PageTitleTextBlockStyle}" Text="**PURCHASE"
x:Uid="PURCHASE"/>
</Grid>

<!--<TextBlock Grid.Row="0" Text="invisible text to stretch the panel invisible text to stretch the panel invisible text to stretch the panel invisible text to stretch the panel invisible text to stretch the panel invisible text to stretch the panel"
Expand Down
9 changes: 9 additions & 0 deletions SelectROMPane.xaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ using namespace Windows::Storage;
using namespace Windows::Storage::AccessCache;
using namespace Windows::UI::ViewManagement;
using namespace Windows::ApplicationModel::Resources;
using namespace Windows::Devices::HumanInterfaceDevice;
using namespace Windows::Devices::Enumeration;

StorageFolderModel::StorageFolderModel(StorageFolder ^folder)
{
Expand All @@ -55,6 +57,9 @@ SelectROMPane::SelectROMPane()

this->InitializeComponent();


auto loader = Windows::ApplicationModel::Resources::ResourceLoader::GetForViewIndependentUse();

//move command bar to bottom if setting says so
if ((EmulatorSettings::Current->CommandButtonPosition == 0 && Windows::Foundation::Metadata::ApiInformation::IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
|| EmulatorSettings::Current->CommandButtonPosition == 2)
Expand Down Expand Up @@ -105,6 +110,10 @@ SelectROMPane::SelectROMPane()
//disable the command bar if no rom is loaded
topbar->IsEnabled = IsROMLoaded();





initdone = true;
}

Expand Down
3 changes: 2 additions & 1 deletion SettingsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
Height="48"
Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}">
<TextBlock x:Name="title"
Style="{StaticResource PageTitleTextBlockStyle}" Text="SETTINGS"/>
Style="{StaticResource PageTitleTextBlockStyle}" Text="**SETTINGS"
x:Uid="SETTINGS"/>
</Grid>


Expand Down
6 changes: 6 additions & 0 deletions Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -687,4 +687,10 @@
<data name="XboxGamepadConfig.Text" xml:space="preserve">
<value>Xbox Gamepad Config</value>
</data>
<data name="PURCHASE.Text" xml:space="preserve">
<value>PURCHASE</value>
</data>
<data name="SETTINGS.Text" xml:space="preserve">
<value>SETTINGS</value>
</data>
</root>
Loading

0 comments on commit 26ea125

Please sign in to comment.