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

Commit

Permalink
增加版本号
Browse files Browse the repository at this point in the history
  • Loading branch information
Berrysoft committed Dec 29, 2018
1 parent fd228bc commit 5cb58b3
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
5 changes: 4 additions & 1 deletion TsinghuaNetUWP/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@
</StackPanel>
</StackPanel>
<TextBlock Margin="10" Style="{ThemeResource TitleTextBlockStyle}">关于</TextBlock>
<TextBlock Margin="10" Style="{ThemeResource SubtitleTextBlockStyle}">清华大学校园网客户端</TextBlock>
<StackPanel Orientation="Horizontal">
<TextBlock Margin="10" Style="{ThemeResource SubtitleTextBlockStyle}">清华大学校园网客户端</TextBlock>
<TextBlock Margin="10" Style="{ThemeResource BodyTextBlockStyle}" VerticalAlignment="Bottom" Text="{x:Bind Model.GetVersionString(Model.Version),Mode=OneWay}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Margin="10" Style="{ThemeResource BaseTextBlockStyle}">版权所有 © 2018 Berrysoft</TextBlock>
<HyperlinkButton NavigateUri="https://github.com/Berrysoft/TsinghuaNetUWP">项目网址</HyperlinkButton>
Expand Down
9 changes: 9 additions & 0 deletions TsinghuaNetUWP/MainViewModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
#include "WaterUserContent.h"

using namespace std;
using sf::sprint;
using namespace winrt;
using namespace Windows::ApplicationModel;
using namespace Windows::Foundation;
using namespace Windows::UI::Xaml;
using namespace TsinghuaNetHelper;
Expand All @@ -18,6 +20,11 @@ namespace winrt::TsinghuaNetUWP::implementation
m_NetUsers = single_threaded_observable_vector<IInspectable>();
}

hstring MainViewModel::GetVersionString(PackageVersion const& ver)
{
return hstring(sprint(L"{}.{}.{}.{}", ver.Major, ver.Minor, ver.Build, ver.Revision));
}

void MainViewModel::OnAutoLoginPropertyChanged(DependencyObject const& d, DependencyPropertyChangedEventArgs const& e)
{
if (auto model{ d.try_as<class_type>() })
Expand Down Expand Up @@ -93,4 +100,6 @@ namespace winrt::TsinghuaNetUWP::implementation

DEPENDENCY_PROPERTY_INIT(Theme, ElementTheme, MainViewModel, box_value(ElementTheme::Default))
DEPENDENCY_PROPERTY_INIT(ContentType, UserContentType, MainViewModel, box_value(UserContentType::Ring), &MainViewModel::OnContentTypePropertyChanged)

DEPENDENCY_PROPERTY_INIT(Version, PackageVersion, MainViewModel, box_value(Package::Current().Id().Version()))
} // namespace winrt::TsinghuaNetUWP::implementation
9 changes: 8 additions & 1 deletion TsinghuaNetUWP/MainViewModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,15 @@ namespace winrt::TsinghuaNetUWP::implementation
DEPENDENCY_PROPERTY(ContentType, TsinghuaNetHelper::UserContentType)
EVENT_DECL(ContentTypeChanged, TsinghuaNetHelper::UserContentType)

DEPENDENCY_PROPERTY(Version, Windows::ApplicationModel::PackageVersion)

public:
Windows::Foundation::Collections::IObservableVector<Windows::Foundation::IInspectable> NetUsers() const { return m_NetUsers; }
hstring GetVersionString(Windows::ApplicationModel::PackageVersion const& ver);

Windows::Foundation::Collections::IObservableVector<Windows::Foundation::IInspectable> NetUsers() const
{
return m_NetUsers;
}

private:
Windows::Foundation::Collections::IObservableVector<Windows::Foundation::IInspectable> m_NetUsers;
Expand Down
4 changes: 4 additions & 0 deletions TsinghuaNetUWP/MainViewModel.idl
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,9 @@ namespace TsinghuaNetUWP
TsinghuaNetHelper.UserContentType ContentType;
static Windows.UI.Xaml.DependencyProperty ContentTypeProperty { get; };
event Windows.Foundation.EventHandler<TsinghuaNetHelper.UserContentType> ContentTypeChanged;

Windows.ApplicationModel.PackageVersion Version;
static Windows.UI.Xaml.DependencyProperty VersionProperty { get; };
String GetVersionString(Windows.ApplicationModel.PackageVersion ver);
}
} // namespace TsinghuaNetUWP
2 changes: 1 addition & 1 deletion TsinghuaNetUWP/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="Berrysoft.TsinghuaNetUWP" Publisher="CN=Straw" Version="2.0.37.0" />
<Identity Name="Berrysoft.TsinghuaNetUWP" Publisher="CN=Straw" Version="2.0.38.0" />
<mp:PhoneIdentity PhoneProductId="091ffa12-1933-4f1b-96a5-4a169e4ab5f5" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>TsinghuaNetUWP</DisplayName>
Expand Down

0 comments on commit 5cb58b3

Please sign in to comment.