Skip to content
This repository has been archived by the owner on Aug 15, 2023. It is now read-only.

Commit

Permalink
格式化日期
Browse files Browse the repository at this point in the history
标题复制
  • Loading branch information
kitUIN committed Feb 25, 2022
1 parent a6f713b commit 35f866c
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 48 deletions.
2 changes: 1 addition & 1 deletion ClassificationPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<Image Source="ms-appx:///Assets//Picacgs//register_name.png" Width="36" Height="36" Margin="0,0,0,0"/>
<TextBlock Text="热门分类" FontSize="25" FontWeight="Bold" Foreground="{StaticResource SystemAccentColorDark3}"/>
<TextBlock IsTextSelectionEnabled="True" Text="热门分类" FontSize="25" FontWeight="Bold" Foreground="{StaticResource SystemAccentColorDark3}"/>
</StackPanel>
<GridView x:Name="GridV" SelectionMode="None" IsItemClickEnabled="True" ItemClick="GridV_ItemClick"
ItemsSource="{x:Bind ClassBlockView.ClassBlocks}" Margin="0,30,0,0">
Expand Down
53 changes: 28 additions & 25 deletions InfoPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ namespace winrt::bikabika::implementation
InitializeComponent();
NavigationCacheMode(Windows::UI::Xaml::Navigation::NavigationCacheMode::Enabled);
}

Windows::Foundation::IAsyncAction InfoPage::ContentDialogShow(hstring const& mode, hstring const& message)
{
Windows::ApplicationModel::Resources::ResourceLoader resourceLoader{ Windows::ApplicationModel::Resources::ResourceLoader::GetForCurrentView() };

if (mode == L"Timeout") {
auto show{ PicErrorDialog().ShowAsync() };
}
Expand Down Expand Up @@ -51,7 +51,6 @@ namespace winrt::bikabika::implementation
if (show == winrt::Windows::UI::Xaml::Controls::ContentDialogResult::None)
{
auto loginTeachingTip = Frame().Parent().as<Microsoft::UI::Xaml::Controls::NavigationView>().Parent().as<Windows::UI::Xaml::Controls::Grid>().Children().GetAt(3).as<Microsoft::UI::Xaml::Controls::TeachingTip>();
Windows::ApplicationModel::Resources::ResourceLoader resourceLoader{ Windows::ApplicationModel::Resources::ResourceLoader::GetForCurrentView() };
loginTeachingTip.Title(resourceLoader.GetString(L"LoginButton/Content"));
loginTeachingTip.IsOpen(true);
}
Expand Down Expand Up @@ -144,16 +143,16 @@ namespace winrt::bikabika::implementation
m_tags.Clear();
animeFlag = false;
m_eps = winrt::single_threaded_observable_vector<bikabika::EpisodeBlock>();
LayoutMessage().Title(resourceLoader.GetString(L"Loading"));
LayoutMessage().IsOpen(true);
auto res{ co_await m_bikaHttp.BookInfo(m_id) };
if (res[1] == 'T') {
//auto show{ PicErrorDialog().ShowAsync() };
LayoutMessage().IsOpen(false);
if (res[1] == 'T')
{
ContentDialogShow(L"Timeout", L"");
}
else if (res[1] == 'E') {
/*auto resourceLoader{ Windows::ApplicationModel::Resources::ResourceLoader::GetForCurrentView() };
LoginContentDialog().Title(box_value(resourceLoader.GetString(L"LoadFail/Title")));
LoginContentDialog().Content(box_value(res));
LoginContentDialog().CloseButtonText(resourceLoader.GetString(L"Fail/CloseButtonText"));
auto show{ co_await LoginContentDialog().ShowAsync() };*/
ContentDialogShow(L"Error", res);
}
else
{
Expand Down Expand Up @@ -214,7 +213,7 @@ namespace winrt::bikabika::implementation
Finished().Visibility(m_finished);
m_updatedAt = json.GetNamedString(L"updated_at");
m_createdAt = json.GetNamedString(L"created_at");
CreateDate().Text(m_createdAt);
CreateDate().Text(to_hstring(to_string(m_updatedAt).substr(0, 10)) +L" "+ to_hstring(to_string(m_updatedAt).substr(11, 8)));
m_allowDownload = json.GetNamedBoolean(L"allowDownload");
m_allowComment = json.GetNamedBoolean(L"allowComment");
Comments().IsEnabled(m_allowComment);
Expand Down Expand Up @@ -247,7 +246,6 @@ namespace winrt::bikabika::implementation
}

}
Windows::ApplicationModel::Resources::ResourceLoader resourceLoader{ Windows::ApplicationModel::Resources::ResourceLoader::GetForCurrentView() };
if (Favourite().IsChecked().GetBoolean())
{
FavouriteTip().Content(box_value(resourceLoader.GetString(L"TipUnfavourite")));
Expand Down Expand Up @@ -308,10 +306,9 @@ namespace winrt::bikabika::implementation
void winrt::bikabika::implementation::InfoPage::CommentsView_PaneClosed(winrt::Windows::UI::Xaml::Controls::SplitView const& sender, winrt::Windows::Foundation::IInspectable const& args)
{
Comments().IsChecked(false);
Windows::ApplicationModel::Resources::ResourceLoader resourceLoader{ Windows::ApplicationModel::Resources::ResourceLoader::GetForCurrentView() };
}

}

//爱心
Windows::Foundation::IAsyncAction winrt::bikabika::implementation::InfoPage::Like_Unchecked(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e)
{
Like().IsChecked(!Like().IsChecked().GetBoolean());
Expand All @@ -329,7 +326,6 @@ namespace winrt::bikabika::implementation
double code = resp.GetNamedNumber(L"code");
if (code == (double)200)
{
Windows::ApplicationModel::Resources::ResourceLoader resourceLoader{ Windows::ApplicationModel::Resources::ResourceLoader::GetForCurrentView() };
Windows::Data::Json::JsonObject ca = resp.GetNamedObject(L"data");
hstring action = ca.GetNamedString(L"action");
if (action == L"like")
Expand All @@ -356,7 +352,7 @@ namespace winrt::bikabika::implementation
}
}


//收藏
Windows::Foundation::IAsyncAction winrt::bikabika::implementation::InfoPage::Favourite_Checked(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e)
{

Expand All @@ -376,8 +372,7 @@ namespace winrt::bikabika::implementation
double code = resp.GetNamedNumber(L"code");
if (code == (double)200)
{
Windows::ApplicationModel::Resources::ResourceLoader resourceLoader{ Windows::ApplicationModel::Resources::ResourceLoader::GetForCurrentView() };
Windows::Data::Json::JsonObject ca = resp.GetNamedObject(L"data");
Windows::Data::Json::JsonObject ca = resp.GetNamedObject(L"data");
hstring action = ca.GetNamedString(L"action");
if (action == L"favourite")
{
Expand Down Expand Up @@ -418,7 +413,6 @@ namespace winrt::bikabika::implementation
// 爱心
void winrt::bikabika::implementation::InfoPage::Like_Checked(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e)
{
Windows::ApplicationModel::Resources::ResourceLoader resourceLoader{ Windows::ApplicationModel::Resources::ResourceLoader::GetForCurrentView() };
if (sender.as<winrt::Windows::UI::Xaml::Controls::AppBarToggleButton>().IsChecked().GetBoolean())
{
LikeTip().Content(box_value(resourceLoader.GetString(L"TipUnlike")));
Expand All @@ -432,7 +426,7 @@ void winrt::bikabika::implementation::InfoPage::Like_Checked(winrt::Windows::Fou
// 收藏
void winrt::bikabika::implementation::InfoPage::Favourite_Unchecked(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e)
{
Windows::ApplicationModel::Resources::ResourceLoader resourceLoader{ Windows::ApplicationModel::Resources::ResourceLoader::GetForCurrentView() };

if (sender.as<winrt::Windows::UI::Xaml::Controls::AppBarToggleButton>().IsChecked().GetBoolean())
{
FavouriteTip().Content(box_value(resourceLoader.GetString(L"TipUnfavourite")));
Expand Down Expand Up @@ -463,7 +457,9 @@ void winrt::bikabika::implementation::InfoPage::TagButton_Click(winrt::Windows::
// 按下作者
void winrt::bikabika::implementation::InfoPage::Author_Drop(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e)
{
auto tag = sender.as<winrt::Windows::UI::Xaml::Controls::TextBlock>().Text();
if (e.GetCurrentPoint(sender.as<TextBlock>()).Properties().IsLeftButtonPressed())
{
auto tag = sender.as<winrt::Windows::UI::Xaml::Controls::TextBlock>().Text();
extern bool loadComicFlag;
loadComicFlag = true;
ComicArgs args;
Expand All @@ -472,14 +468,21 @@ void winrt::bikabika::implementation::InfoPage::Author_Drop(winrt::Windows::Foun
args.SortMode(winrt::bikabika::SearchSortMode::DD);
args.IsAnime(false);
Frame().Navigate(winrt::xaml_typename<bikabika::ComicsPage>(), box_value(args));
}


}

// 按下标题
void winrt::bikabika::implementation::InfoPage::Title_PointerPressed(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e)
{
//todo 点击标题复制
auto title = sender.as<winrt::Windows::UI::Xaml::Controls::TextBlock>().Text();


DataPackage dataPackage = DataPackage();
dataPackage.SetText(title);
if (Clipboard::SetContentWithOptions(dataPackage, nullptr))
{

}
}


2 changes: 2 additions & 0 deletions InfoPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "Utils/Blocks/TagBlock.h"
#include "Utils/Blocks/CreaterBlock.h"
#include "Utils/Blocks/EpisodeBlock.h"
#include "MainPage.h"
namespace winrt::bikabika::implementation
{
struct InfoPage : InfoPageT<InfoPage>
Expand All @@ -29,6 +30,7 @@ namespace winrt::bikabika::implementation


private:
Windows::ApplicationModel::Resources::ResourceLoader resourceLoader{ Windows::ApplicationModel::Resources::ResourceLoader::GetForCurrentView() };
bikabika::FileCheckTool m_fileCheckTool;
bikabika::BikaHttp m_bikaHttp;
hstring m_id;
Expand Down
15 changes: 10 additions & 5 deletions InfoPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
<Border CornerRadius="10" HorizontalAlignment="Left" BorderThickness="1.5" Padding="10" Opacity="0.9" BorderBrush="{StaticResource SystemAccentColorDark1}" Background="{ThemeResource MyAcrylicBrushLight3}">
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="18" Margin="3,10,0,10" HorizontalAlignment="Left" TextWrapping="Wrap" x:Name="Description"/>
<TextBlock IsTextSelectionEnabled="True" FontSize="18" Margin="3,10,0,10" HorizontalAlignment="Left" TextWrapping="Wrap" x:Name="Description"/>
<Border CornerRadius="10" HorizontalAlignment="Left" BorderThickness="1.5" Padding="10" Opacity="0.9" Background="{ThemeResource MyAcrylicBrushLight2}">

<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
Expand Down Expand Up @@ -243,7 +243,7 @@
<PersonPicture x:Name="Creater" Margin="10,0,0,0" HorizontalAlignment="Left" Width="64" Height="64" ProfilePicture="Assets/Picacgs/placeholder_avatar_2.png"/>
<StackPanel Margin="10,0,0,0">
<TextBlock VerticalAlignment="Center" x:Name="CreaterName" FontSize="16" FontWeight="Bold" Foreground="{StaticResource SystemAccentColorDark1}"/>
<TextBlock VerticalAlignment="Center" x:Name="CreateDate" FontSize="16" Foreground="Gray" Margin="0,0,30,0"/>
<TextBlock IsTextSelectionEnabled="True" VerticalAlignment="Center" x:Name="CreateDate" FontSize="16" Foreground="Gray" Margin="0,0,30,0"/>
<TextBlock VerticalAlignment="Center" x:Uid="UpdateTime" Text="更新" FontSize="15" FontWeight="Bold" Foreground="Gray"/>
</StackPanel>
</StackPanel>
Expand Down Expand Up @@ -285,15 +285,15 @@
<StackPanel Orientation="Vertical" Margin="10,0,0,0" HorizontalAlignment="Center">
<TextBlock x:Name="UsersName" Text="name" VerticalAlignment="Center" MaxWidth="200" TextWrapping = "Wrap" FontSize="16" FontWeight="Bold" Foreground="{StaticResource SystemAccentColorDark2}"/>
<StackPanel Orientation="Horizontal">
<TextBlock VerticalAlignment="Center" x:Name="UsersLevel" Text="Lv.5" FontSize="13"/>
<TextBlock IsTextSelectionEnabled="True" VerticalAlignment="Center" x:Name="UsersLevel" Text="Lv.5" FontSize="13"/>
<Border VerticalAlignment="Center" CornerRadius="10" BorderThickness="1.5" Padding="4" Opacity="0.9" Background="{ThemeResource SystemAccentColorDark1}">
<TextBlock x:Name="UsersTitle" FontWeight="Bold" FontSize="10"/>
<TextBlock IsTextSelectionEnabled="True" x:Name="UsersTitle" FontWeight="Bold" FontSize="10"/>
</Border>
</StackPanel>

</StackPanel>
</StackPanel>
<TextBlock Margin="0,6,0,0" x:Name="UserInfomation"/>
<TextBlock IsTextSelectionEnabled="True" Margin="0,6,0,0" x:Name="UserInfomation"/>
</StackPanel>
</muxc:TeachingTip.Content>
<muxc:TeachingTip.IconSource>
Expand All @@ -302,6 +302,11 @@
</muxc:TeachingTip>
</Grid>
</ScrollViewer>
<muxc:TeachingTip Background="{StaticResource SystemAccentColorLight3}" x:Name="LayoutMessage" PreferredPlacement="Center" IsLightDismissEnabled="False">
<muxc:TeachingTip.Content>
<ProgressRing Padding="10" Height="80" Width="80" IsActive="True" Foreground="{StaticResource SystemAccentColor}"/>
</muxc:TeachingTip.Content>
</muxc:TeachingTip>
<ContentDialog x:Name="PicErrorDialog" x:Uid="PicErrorDialog"
Background="{StaticResource SystemAccentColorLight2}">
<ContentDialog.TitleTemplate>
Expand Down
7 changes: 3 additions & 4 deletions MainPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ namespace winrt::bikabika::implementation
m_pages.push_back(std::make_pair<std::wstring, Windows::UI::Xaml::Interop::TypeName>
(L"settings", winrt::xaml_typename<bikabika::SettingsPage>()));
Window::Current().SetTitleBar(AppTitleBar());
Windows::ApplicationModel::Resources::ResourceLoader resourceLoader{ Windows::ApplicationModel::Resources::ResourceLoader::GetForCurrentView() };
LoginTeachingTip().Title(resourceLoader.GetString(L"LoginButton/Content"));
LoginTeachingTip().IsOpen(true);
NavHome().IsEnabled(false);
Expand All @@ -58,7 +57,6 @@ namespace winrt::bikabika::implementation





void MainPage::NavView_Loaded(
Windows::Foundation::IInspectable const& /* sender */,
Expand Down Expand Up @@ -323,9 +321,10 @@ namespace winrt::bikabika::implementation
{
__super::OnNavigatedTo(e);
}

// 弹出窗
Windows::Foundation::IAsyncAction MainPage::ContentDialogShow(hstring const& mode, hstring const& message)
{

Windows::ApplicationModel::Resources::ResourceLoader resourceLoader{ Windows::ApplicationModel::Resources::ResourceLoader::GetForCurrentView() };

if (mode == L"Timeout") {
Expand Down Expand Up @@ -472,8 +471,8 @@ namespace winrt::bikabika::implementation
NavClassification().IsEnabled(true);
NavAccount().IsEnabled(true);
if (m_firstArrive) {
NavView().SelectedItem(NavView().MenuItems().GetAt(1));
ContentFrame().Navigate(winrt::xaml_typename<bikabika::HomePage>());
NavView().SelectedItem(NavView().MenuItems().GetAt(2));
m_firstArrive = false;
co_await GetKeywords();
}
Expand Down
3 changes: 1 addition & 2 deletions MainPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,10 @@ namespace winrt::bikabika::implementation
void CatSearch_TextChanged(winrt::Windows::UI::Xaml::Controls::AutoSuggestBox const& sender, winrt::Windows::UI::Xaml::Controls::AutoSuggestBoxTextChangedEventArgs const& args);
void CatSearch_QuerySubmitted(winrt::Windows::UI::Xaml::Controls::AutoSuggestBox const& sender, winrt::Windows::UI::Xaml::Controls::AutoSuggestBoxQuerySubmittedEventArgs const& args);
void CatSearch_SuggestionChosen(winrt::Windows::UI::Xaml::Controls::AutoSuggestBox const& sender, winrt::Windows::UI::Xaml::Controls::AutoSuggestBoxSuggestionChosenEventArgs const& args);

void Password_Loaded(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
hstring PicPath();
private:

Windows::ApplicationModel::Resources::ResourceLoader resourceLoader{ Windows::ApplicationModel::Resources::ResourceLoader::GetForCurrentView() };
std::vector<std::pair<std::wstring, Windows::UI::Xaml::Interop::TypeName>> m_pages;
bikabika::UserViewModel m_userViewModel;
bool m_suggestIsChosen = false;
Expand Down
1 change: 1 addition & 0 deletions MainPage.idl
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ namespace bikabika
UserViewModel MainUserViewModel{ get; };
Windows.UI.Xaml.Controls.PersonPicture UsersPic{ get; };
String PicPath{ get; };
Windows.Foundation.IAsyncAction ContentDialogShow(String mode, String message);
}
}
4 changes: 2 additions & 2 deletions MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
>
<Page.Resources>
<ResourceDictionary>

<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<AcrylicBrush x:Key="NavigationViewExpandedPaneBackground" TintColor="{ThemeResource SystemAccentColorLight1}" TintOpacity=".6"/>
Expand All @@ -18,9 +19,8 @@
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>

</Page.Resources>

<Grid >
<muxc:TeachingTip Background="{StaticResource SystemAccentColorLight3}" x:Name="LayoutMessage" PreferredPlacement="Center" IsLightDismissEnabled="False">
<muxc:TeachingTip.Content>
Expand Down
4 changes: 4 additions & 0 deletions Strings/zh-cn/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@
<data name="CommentsTip.Content" xml:space="preserve">
<value>展开评论面板</value>
</data>
<data name="CopySuccess" xml:space="preserve">
<value>复制成功</value>
<comment>复制成功</comment>
</data>
<data name="CreaterTip.Content" xml:space="preserve">
<value>点击查看上传者信息</value>
</data>
Expand Down
Loading

0 comments on commit 35f866c

Please sign in to comment.