Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/kengwang/HyPlayer
Browse files Browse the repository at this point in the history
  • Loading branch information
kengwang committed Feb 26, 2021
2 parents cd6b7e2 + 538ea1c commit ad0f81e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 49 deletions.
77 changes: 33 additions & 44 deletions HyPlayer/Pages/BasePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,97 +2,86 @@
x:Class="HyPlayer.Pages.BasePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:controls1="using:Microsoft.UI.Xaml.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:hyPlayer="using:HyPlayer"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:media="using:Windows.UI.Xaml.Media"
xmlns:controls1="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<Grid>
<NavigationView
x:Name="NavMain"
Margin="0,0,0,0"
BackRequested="OnNavigateBack"
Background="{ThemeResource AccentPanelAcrylic}"
IsBackButtonVisible="Visible"
IsBackEnabled="True"
IsSettingsVisible="False"
BackRequested="OnNavigateBack"
Background="{ThemeResource AccentPanelAcrylic}"
SelectionChanged="NavMain_OnSelectionChanged"
x:Name="NavMain">
Loaded="NavMain_Loaded"
SelectionChanged="NavMain_OnSelectionChanged">
<NavigationView.MenuItems>
<NavigationViewItem
Icon="Home"
Content="主页"
Icon="Home"
Tag="PageHome" />
<NavigationViewItem
Icon="Zoom"
Content="搜索"
Icon="Zoom"
Tag="PageSearch" />
<NavigationViewItem
Icon="Download"
Content="下载"
Icon="Download"
Tag="PageDownload" />
<NavigationViewItem
Tag="PageMe">
<StackPanel
Margin="-10,0,0,0"
Orientation="Horizontal">
<NavigationViewItem Tag="PageMe">
<StackPanel Margin="-10,0,0,0" Orientation="Horizontal">
<PersonPicture
x:Name="PersonPictureUser"
Margin="5,0,0,0"
Width="20"/>
Width="20"
Margin="5,0,0,0" />
<TextBlock
x:Name="TextBlockUserName"
Margin="16,0,0,0"
Text="登录" />
</StackPanel>
</NavigationViewItem>
</NavigationView.MenuItems>
<Frame
Margin="0,40,0,0"
x:Name="BaseFrame" />
<Frame x:Name="BaseFrame" Margin="0,40,0,0" />
</NavigationView>
<!-- 登录弹窗 -->
<ContentDialog
x:Name="DialogLogin"
Width="400">
<StackPanel
Orientation="Vertical">
<Image
Height="200"
Source="/Assets/LargeTile.scale-400.png"></Image>
<!-- 登录弹窗 -->
<ContentDialog x:Name="DialogLogin" Width="400">
<StackPanel Orientation="Vertical">
<Image Height="200" Source="/Assets/LargeTile.scale-400.png" />
<TextBlock
Padding="0,3,0,10"
HorizontalAlignment="Center"
FontSize="25"
Text="登录到网易云音乐"
HorizontalAlignment="Center" />
Text="登录到网易云音乐" />
<TextBox
KeyDown="TextBoxAccount_OnKeyDown"
x:Name="TextBoxAccount"
Margin="5"
PlaceholderText="手机 / 邮箱"
x:Name="TextBoxAccount" />
KeyDown="TextBoxAccount_OnKeyDown"
PlaceholderText="手机 / 邮箱" />
<PasswordBox
KeyDown="TextBoxPassword_OnKeyDown"
x:Name="TextBoxPassword"
Margin="5"
PlaceholderText="密码"
x:Name="TextBoxPassword" />
KeyDown="TextBoxPassword_OnKeyDown"
PlaceholderText="密码" />
<Button
Name="ButtonLogin"
Margin="0,15,0,0"
HorizontalAlignment="Stretch"
Click="ButtonLogin_OnClick"
Style="{StaticResource AccentButtonStyle}"
Content="登录"
HorizontalAlignment="Stretch"
Margin="0,15,0,0"></Button>
<TextBlock
Padding="0,25,0,0"
TextAlignment="Center">
Style="{StaticResource AccentButtonStyle}" />
<TextBlock Padding="0,25,0,0" TextAlignment="Center">
<TextBlock.Text>
登录代表你同意相关条款
</TextBlock.Text>
</TextBlock>
<controls1:InfoBar
CloseButtonClick="InfoBarLoginHint_OnCloseButtonClick"
x:Name="InfoBarLoginHint"
CloseButtonClick="InfoBarLoginHint_OnCloseButtonClick"
IsOpen="False" />
</StackPanel>
</ContentDialog>
Expand Down
14 changes: 9 additions & 5 deletions HyPlayer/Pages/BasePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,8 @@ private async void LoadLoginData()
PersonPictureUser.ProfilePicture =
new BitmapImage(new Uri(json["profile"]["avatarUrl"].ToString()));
}

}
catch (Exception) { }

}

private async void ButtonLogin_OnClick(object sender, RoutedEventArgs e)
Expand All @@ -96,7 +94,6 @@ private async void ButtonLogin_OnClick(object sender, RoutedEventArgs e)
JObject json;
try
{

var queries = new Dictionary<string, object>();
var account = TextBoxAccount.Text;
var isPhone = Regex.Match(account, "^[0-9]+$").Success;
Expand Down Expand Up @@ -167,14 +164,15 @@ private async void NavMain_OnSelectionChanged(NavigationView sender, NavigationV
case "PageMe":
Common.BaseFrame.Navigate(typeof(Pages.Me), null, new EntranceNavigationTransitionInfo());
break;

case "PageHome":
Common.BaseFrame.Navigate(typeof(Pages.Home), null, new EntranceNavigationTransitionInfo());
break;

case "PageSearch":
Common.BaseFrame.Navigate(typeof(Search), null, new EntranceNavigationTransitionInfo());
break;
}

}

private void OnNavigateBack(NavigationView sender, NavigationViewBackRequestedEventArgs args)
Expand All @@ -198,5 +196,11 @@ private void TextBoxPassword_OnKeyDown(object sender, KeyRoutedEventArgs e)
ButtonLogin_OnClick(null, null);
}
}

private void NavMain_Loaded(object sender, RoutedEventArgs e)
{
NavMain.SelectedItem = NavMain.MenuItems[0];
Common.BaseFrame.Navigate(typeof(Home));
}
}
}
}

0 comments on commit ad0f81e

Please sign in to comment.