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

Commit 04bb5b4

Browse files
authored
Merge pull request #16 from kitUIN/dev
2 parents b5bfe85 + 0de79b2 commit 04bb5b4

33 files changed

+1141
-237
lines changed

.gitignore

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@
1111
/x64/Debug/bikabika
1212
/bikabika/x64/Release
1313
/x64/Release/bikabika
14-
/AppPackages/bikabika/bikabika_0.1.1.0_Test
15-
/AppPackages/bikabika/bikabika_0.3.0.0_Test
14+
/AppPackages/bikabika/
15+
/ARM
16+
/bikabika/ARM
17+
/bikabika/ARM/Release

README.md

+20-17
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ _✨ 目前正在重构项目中,请耐心等待✨_
3434
- 有问题或者建议可以提issue
3535
- 支持项目可以点个Star✨呢~
3636
- 点个Watch👀能随时了解开发动态呢~
37-
37+
- [Telegram频道](https://t.me/bikabikaUWP) 将会提前发布测试版以供测试
3838

3939
> 刚学C++, 做个项目练练手
4040
>
@@ -69,33 +69,36 @@ _✨ 目前正在重构项目中,请耐心等待✨_
6969
保姆级教程(施工中)
7070

7171
## 展示🍀
72-
![](https://i.niupic.com/images/2022/03/06/9W2O.png)
73-
![](https://i.niupic.com/images/2022/03/06/9W2R.png)
74-
![](https://i.niupic.com/images/2022/03/06/9W2Q.png)
75-
![](https://i.niupic.com/images/2022/03/06/9W2P.png)
76-
![](https://i.niupic.com/images/2022/03/06/9W2S.png)
77-
![](https://i.niupic.com/images/2022/03/06/9W2V.png)
72+
> 此为重制版新UI,目前仅在[Telegram频道](https://t.me/bikabikaUWP) 测试
73+
> 待完整开发后在Github发布
74+
![](https://files.catbox.moe/exh50q.png)
75+
![](https://files.catbox.moe/47jzrt.png)
76+
![](https://files.catbox.moe/mzitik.png)
77+
![](https://files.catbox.moe/8mpfdq.png)
78+
![](https://files.catbox.moe/vfed3i.png)
7879
暗系主题:
7980
![](https://files.catbox.moe/x0s1kj.png)
8081
磁贴:
8182
![](https://i.niupic.com/images/2022/03/06/9W2W.png)
8283
## 功能📝
83-
84+
以下为重置版功能列表
8485
* 登陆
8586

8687
* [x] 登陆
8788

8889
* [ ] 自动测速分流
8990

91+
* [x] 多用户切换
92+
9093
* 个人信息
9194

92-
* [x] 个人信息
95+
* [ ] 个人信息
9396

94-
* [x] 打卡
97+
* [ ] 打卡
9598

96-
* [x] 收藏
99+
* [ ] 收藏
97100

98-
* [x] 浏览历史
101+
* [ ] 浏览历史
99102

100103
* 主页
101104

@@ -107,9 +110,9 @@ _✨ 目前正在重构项目中,请耐心等待✨_
107110

108111
* [ ] 哔咔排行榜
109112

110-
* [ ] 随机本子
113+
* [x] 随机本子
111114

112-
* [ ] 最近更新
115+
* [x] 最近更新
113116

114117
* [x] 其他主要分区
115118

@@ -123,7 +126,7 @@ _✨ 目前正在重构项目中,请耐心等待✨_
123126

124127
* [x] 点击标签搜索
125128

126-
* [x] 点击作者搜索
129+
* [ ] 点击作者搜索
127130

128131
* 漫画
129132

@@ -137,6 +140,8 @@ _✨ 目前正在重构项目中,请耐心等待✨_
137140

138141
* [ ] 封印本子
139142

143+
* [ ] 下载
144+
140145
* 看图
141146

142147
* [ ] 全屏
@@ -147,7 +152,5 @@ _✨ 目前正在重构项目中,请耐心等待✨_
147152

148153
* [ ] 界面
149154

150-
* 小程序
151155

152-
* [ ] 聊天室
153156

bikabika/BikaImage.cpp

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#include "pch.h"
2+
#include "BikaImage.h"
3+
#if __has_include("BikaImage.g.cpp")
4+
#include "BikaImage.g.cpp"
5+
#endif
6+
7+
using namespace winrt;
8+
using namespace Windows::UI::Xaml;
9+
using namespace Windows::Foundation;
10+
using namespace Windows::Storage::Streams;
11+
namespace winrt::bikabika::implementation
12+
{
13+
BikaImage::BikaImage()
14+
{
15+
DefaultStyleKey(winrt::box_value(L"bikabika.BikaImage"));
16+
InitializeComponent();
17+
}
18+
19+
Windows::UI::Xaml::DependencyProperty BikaImage::m_imageProperty =
20+
Windows::UI::Xaml::DependencyProperty::Register(
21+
L"ImgBlock",
22+
winrt::xaml_typename<winrt::BikaClient::Blocks::ImageBlock>(),
23+
winrt::xaml_typename<bikabika::BikaImage>(),
24+
Windows::UI::Xaml::PropertyMetadata{ nullptr }
25+
);
26+
winrt::BikaClient::Blocks::ImageBlock BikaImage::ImgBlock()
27+
{
28+
return winrt::unbox_value<winrt::BikaClient::Blocks::ImageBlock>(GetValue(m_imageProperty));
29+
}
30+
31+
void BikaImage::ImgBlock(winrt::BikaClient::Blocks::ImageBlock const& value)
32+
{
33+
SetValue(m_imageProperty, winrt::box_value(value));
34+
BikaImg().Source(value.Img());
35+
}
36+
37+
Windows::UI::Xaml::Media::ImageSource BikaImage::ImgSource()
38+
{
39+
return BikaImg().Source();
40+
}
41+
void BikaImage::ImageLoaded(bool const& value)
42+
{
43+
m_loaded = value;
44+
}
45+
bool BikaImage::ImageLoaded()
46+
{
47+
return m_loaded;
48+
}
49+
}
50+
void winrt::bikabika::implementation::BikaImage::BikaImg_ImageFailed(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::ExceptionRoutedEventArgs const& e)
51+
{
52+
ImageLoaded(false);
53+
RefreshIcon().Visibility(Visibility::Visible);
54+
}
55+
56+
57+
Windows::Foundation::IAsyncAction winrt::bikabika::implementation::BikaImage::BikaImg_ImageOpened(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e)
58+
{
59+
ImageLoaded(true);
60+
RefreshIcon().Visibility(Visibility::Collapsed);
61+
// 通过Xaml界面获取位图的大小不对
62+
//winrt::BikaClient::Blocks::ImageBlock imgBlock = ImgBlock();
63+
//winrt::Windows::UI::Xaml::Media::Imaging::RenderTargetBitmap bitmap;
64+
//co_await bitmap.RenderAsync(sender.as<UIElement>());
65+
//IBuffer pixels = co_await bitmap.GetPixelsAsync();
66+
67+
//Windows::Storage::ApplicationDataContainer settings = Windows::Storage::ApplicationData::Current().LocalSettings().CreateContainer(L"Settings", Windows::Storage::ApplicationDataCreateDisposition::Always);
68+
//if (!settings.Values().HasKey(L"CacheFolder"))
69+
//{
70+
// Windows::Storage::StorageFolder storageFolder{ Windows::Storage::ApplicationData::Current().LocalFolder() };
71+
// Windows::Storage::StorageFolder downloadFolder = co_await storageFolder.CreateFolderAsync(L"Cache");
72+
// settings.Values().Insert(L"CacheFolder", box_value(downloadFolder.Path()));
73+
//}
74+
//Windows::Storage::StorageFolder storageFolder = co_await Windows::Storage::StorageFolder::GetFolderFromPathAsync(settings.Values().Lookup(L"CacheFolder").as<hstring>());
75+
//Windows::Storage::StorageFile imgFile = co_await storageFolder.CreateFileAsync(imgBlock.OriginalName(), Windows::Storage::CreationCollisionOption::ReplaceExisting);
76+
//Windows::Storage::Streams::IRandomAccessStream stream{ co_await imgFile.OpenAsync(Windows::Storage::FileAccessMode::ReadWrite) };
77+
//auto softwareBitmap = winrt::Windows::Graphics::Imaging::SoftwareBitmap::CreateCopyFromBuffer(pixels, winrt::Windows::Graphics::Imaging::BitmapPixelFormat::Bgra8, (uint32_t)200, (uint32_t)200, winrt::Windows::Graphics::Imaging::BitmapAlphaMode::Ignore);
78+
//auto propertySet = winrt::Windows::Graphics::Imaging::BitmapPropertySet();
79+
//winrt::Windows::Graphics::Imaging::BitmapTypedValue qualityValue(box_value(1.0), Windows::Foundation::PropertyType::Single);
80+
//propertySet.Insert(L"ImageQuality", qualityValue);
81+
//winrt::Windows::Graphics::Imaging::BitmapEncoder encoder = co_await winrt::Windows::Graphics::Imaging::BitmapEncoder::CreateAsync(winrt::Windows::Graphics::Imaging::BitmapEncoder::JpegEncoderId(), stream, propertySet);
82+
//encoder.SetSoftwareBitmap(softwareBitmap);
83+
///*auto dataReader = DataReader::FromBuffer(pixels);
84+
//winrt::array_view<byte> b;
85+
//dataReader.ReadBytes(b);
86+
//encoder.SetPixelData(winrt::Windows::Graphics::Imaging::BitmapPixelFormat::Bgra8,
87+
// winrt::Windows::Graphics::Imaging::BitmapAlphaMode::Ignore,
88+
// (uint32_t)bitmap.PixelWidth(),(uint32_t)bitmap.PixelHeight(),
89+
// 96, 96,b);*/
90+
//co_await encoder.FlushAsync();
91+
92+
}
93+
94+
95+
void winrt::bikabika::implementation::BikaImage::RefreshIcon_PointerPressed(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e)
96+
{
97+
winrt::BikaClient::Blocks::ImageBlock imgBlock = ImgBlock();
98+
BikaImg().Source(imgBlock.Img());
99+
}

bikabika/BikaImage.h

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#pragma once
2+
3+
#include "winrt/Windows.UI.Xaml.h"
4+
#include "winrt/Windows.UI.Xaml.Markup.h"
5+
#include "winrt/Windows.UI.Xaml.Interop.h"
6+
#include "winrt/Windows.UI.Xaml.Controls.Primitives.h"
7+
#include "BikaImage.g.h"
8+
9+
namespace winrt::bikabika::implementation
10+
{
11+
struct BikaImage : BikaImageT<BikaImage>
12+
{
13+
BikaImage();
14+
15+
winrt::BikaClient::Blocks::ImageBlock ImgBlock();
16+
void ImgBlock(winrt::BikaClient::Blocks::ImageBlock const& value);
17+
Windows::UI::Xaml::Media::ImageSource ImgSource();
18+
static Windows::UI::Xaml::DependencyProperty ImageProperty() { return m_imageProperty; }
19+
void ImageLoaded(bool const& value);
20+
bool ImageLoaded();
21+
private:
22+
static Windows::UI::Xaml::DependencyProperty m_imageProperty;
23+
bool m_loaded = false;
24+
25+
public:
26+
void BikaImg_ImageFailed(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::ExceptionRoutedEventArgs const& e);
27+
Windows::Foundation::IAsyncAction BikaImg_ImageOpened(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
28+
void RefreshIcon_PointerPressed(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Input::PointerRoutedEventArgs const& e);
29+
};
30+
}
31+
32+
namespace winrt::bikabika::factory_implementation
33+
{
34+
struct BikaImage : BikaImageT<BikaImage, implementation::BikaImage>
35+
{
36+
};
37+
}

bikabika/BikaImage.idl

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace bikabika
2+
{
3+
[default_interface]
4+
runtimeclass BikaImage : Windows.UI.Xaml.Controls.UserControl
5+
{
6+
BikaImage();
7+
static Windows.UI.Xaml.DependencyProperty ImageProperty{ get; };
8+
Windows.UI.Xaml.Media.ImageSource ImgSource{ get; };
9+
BikaClient.Blocks.ImageBlock ImgBlock;
10+
Boolean ImageLoaded;
11+
}
12+
}

bikabika/BikaImage.xaml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<UserControl
2+
x:Class="bikabika.BikaImage"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="using:bikabika"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
mc:Ignorable="d">
9+
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
10+
<Image
11+
x:Name="BikaImg"
12+
ImageFailed="BikaImg_ImageFailed"
13+
ImageOpened="BikaImg_ImageOpened" />
14+
<SymbolIcon
15+
x:Name="RefreshIcon"
16+
HorizontalAlignment="Center"
17+
VerticalAlignment="Center"
18+
PointerPressed="RefreshIcon_PointerPressed"
19+
Symbol="Refresh"
20+
Visibility="Collapsed" />
21+
</Grid>
22+
</UserControl>

bikabika/ComicPage.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,12 @@ void winrt::bikabika::implementation::ComicPage::GridV_ItemClick(winrt::Windows:
206206
{
207207
auto comicBlock = e.ClickedItem().as<BikaClient::Blocks::ComicBlock>();
208208
auto container = GridV().ContainerFromItem(e.ClickedItem()).as<winrt::Windows::UI::Xaml::Controls::GridViewItem>();
209-
auto root = container.ContentTemplateRoot().as<FrameworkElement>();
210-
auto image = root.FindName(L"ConnectedElement2").as<UIElement>();
211-
winrt::Windows::UI::Xaml::Media::Animation::ConnectedAnimationService::GetForCurrentView().PrepareToAnimate(L"ForwardConnectedAnimation", image);
209+
FrameworkElement root = container.ContentTemplateRoot().as<FrameworkElement>();
210+
bikabika::BikaImage bikaImg = root.FindName(L"ConnectedElement2").as<bikabika::BikaImage>();
211+
if(bikaImg.ImageLoaded()) winrt::Windows::UI::Xaml::Media::Animation::ConnectedAnimationService::GetForCurrentView().PrepareToAnimate(L"ForwardConnectedAnimation", bikaImg.as<UIElement>());
212212
winrt::Microsoft::UI::Xaml::Controls::SymbolIconSource symbol;
213213
winrt::Windows::UI::Xaml::Controls::Frame frame;
214214
symbol.Symbol(Windows::UI::Xaml::Controls::Symbol::PreviewLink);
215-
frame.Navigate(winrt::xaml_typename<bikabika::InfoPage>(), box_value(single_threaded_vector<winrt::Windows::Foundation::IInspectable>({ box_value(root.FindName(L"ConnectedElement2").as<winrt::Windows::UI::Xaml::Controls::Image>().Source()), box_value(bikabika::ComicArgs(comicBlock.ID(),1,1,1)) })), winrt::Windows::UI::Xaml::Media::Animation::SuppressNavigationTransitionInfo());
215+
frame.Navigate(winrt::xaml_typename<bikabika::InfoPage>(), box_value(single_threaded_vector<winrt::Windows::Foundation::IInspectable>({ box_value(bikaImg.ImgSource()), box_value(bikabika::ComicArgs(comicBlock.ID(),1,1,1)) })), winrt::Windows::UI::Xaml::Media::Animation::SuppressNavigationTransitionInfo());
216216
rootPage.CreateNewTab(frame, comicBlock.Title(), symbol);
217217
}

bikabika/ComicPage.xaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
Height="160"
4040
VerticalAlignment="Center"
4141
CornerRadius="10">
42-
<Image Name="ConnectedElement2" Source="{x:Bind Thumb.Img, Mode=OneWay}" />
42+
<local:BikaImage Name="ConnectedElement2" ImgBlock="{x:Bind Thumb, Mode=OneWay}" />
4343
</Border>
4444
<Grid Width="260">
4545
<StackPanel

bikabika/DownloadPage.xaml

+9-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@
22
x:Class="bikabika.DownloadPage"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:local="using:bikabika"
65
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="using:bikabika"
77
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
88
mc:Ignorable="d">
99

10-
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
11-
<Button x:Name="Button" Click="ClickHandler">Click Me</Button>
10+
<StackPanel
11+
HorizontalAlignment="Center"
12+
VerticalAlignment="Center"
13+
Orientation="Horizontal">
14+
<Button
15+
x:Name="Button"
16+
x:Uid="NotOK"
17+
Click="ClickHandler" />
1218
</StackPanel>
1319
</Page>

bikabika/HomePage.xaml

+9-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@
22
x:Class="bikabika.HomePage"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:local="using:bikabika"
65
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="using:bikabika"
77
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
88
mc:Ignorable="d">
99

10-
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
11-
<Button x:Name="Button" Click="ClickHandler">Click Me</Button>
10+
<StackPanel
11+
HorizontalAlignment="Center"
12+
VerticalAlignment="Center"
13+
Orientation="Horizontal">
14+
<Button
15+
x:Name="Button"
16+
x:Uid="NotOK"
17+
Click="ClickHandler" />
1218
</StackPanel>
1319
</Page>

0 commit comments

Comments
 (0)