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 2, 2018
1 parent 2ce1961 commit 99b9035
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 45 deletions.
2 changes: 1 addition & 1 deletion TsinghuaNetUWP/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ namespace winrt::TsinghuaNetUWP::implementation
/// </summary>
/// <param name="sender">挂起的请求的源。</param>
/// <param name="e">有关挂起请求的详细信息。</param>
void App::OnSuspending(IInspectable const& /*sender*/, SuspendingEventArgs const& e)
void App::OnSuspending(IInspectable const&, SuspendingEventArgs const& e)
{
auto deferral = e.SuspendingOperation().GetDeferral();
// TODO: 保存应用程序状态并停止任何后台活动
Expand Down
16 changes: 3 additions & 13 deletions TsinghuaNetUWP/Arc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,12 @@ namespace winrt::TsinghuaNetUWP::implementation
InitializeComponent();
}

void Arc::OnLoaded(IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/)
{
Draw();
}

void Arc::OnSizeChanged(IInspectable const& /*sender*/, SizeChangedEventArgs const& /*e*/)
{
Draw();
}

void Arc::OnSizePropertyChanged(DependencyObject const& d, DependencyPropertyChangedEventArgs const& /*e*/)
void Arc::OnSizePropertyChanged(DependencyObject const& d, DependencyPropertyChangedEventArgs const&)
{
if (TsinghuaNetUWP::Arc tarc{ d.try_as<TsinghuaNetUWP::Arc>() })
{
Arc* parc(get_self<Arc>(tarc));
parc->Draw();
parc->DrawArc();
}
}

Expand All @@ -57,7 +47,7 @@ namespace winrt::TsinghuaNetUWP::implementation
return { (float)(origin.X - sin(RADIANS * angle) * radius), (float)(origin.Y + cos(RADIANS * angle) * radius) };
}

void Arc::Draw()
void Arc::DrawArc()
{
Size size = RenderSize();
double length = min(size.Width, size.Height);
Expand Down
6 changes: 3 additions & 3 deletions TsinghuaNetUWP/Arc.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ namespace winrt::TsinghuaNetUWP::implementation

double Radius() const { return m_Radius; }

void OnLoaded(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& e);
void OnSizeChanged(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::SizeChangedEventArgs const& e);
void OnLoaded(Windows::Foundation::IInspectable const&, Windows::UI::Xaml::RoutedEventArgs const&) { DrawArc(); }
void OnSizeChanged(Windows::Foundation::IInspectable const&, Windows::UI::Xaml::SizeChangedEventArgs const&) { DrawArc(); }

DEPENDENCY_PROPERTY(Thickness, double)
DEPENDENCY_PROPERTY(Fill, Windows::UI::Xaml::Media::Brush)
Expand All @@ -25,7 +25,7 @@ namespace winrt::TsinghuaNetUWP::implementation
static void OnSizePropertyChanged(Windows::UI::Xaml::DependencyObject const& d, Windows::UI::Xaml::DependencyPropertyChangedEventArgs const& e);

double GetAngle();
void Draw();
void DrawArc();
};
} // namespace winrt::TsinghuaNetUWP::implementation

Expand Down
4 changes: 2 additions & 2 deletions TsinghuaNetUWP/CurrencyStringConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ using namespace TsinghuaNetHelper;

namespace winrt::TsinghuaNetUWP::implementation
{
IInspectable CurrencyStringConverter::Convert(IInspectable const& value, TypeName const& /*targetType*/, IInspectable const& /*parameter*/, hstring const& /*language*/) const
IInspectable CurrencyStringConverter::Convert(IInspectable const& value, TypeName const&, IInspectable const&, hstring const&) const
{
return box_value(UserHelper::GetCurrencyString(unbox_value<double>(value)));
}

IInspectable CurrencyStringConverter::ConvertBack(IInspectable const& /*value*/, TypeName const& /*targetType*/, IInspectable const& /*parameter*/, hstring const& /*language*/) const
IInspectable CurrencyStringConverter::ConvertBack(IInspectable const&, TypeName const&, IInspectable const&, hstring const&) const
{
throw hresult_not_implemented();
}
Expand Down
2 changes: 1 addition & 1 deletion TsinghuaNetUWP/DropUserCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace winrt::TsinghuaNetUWP::implementation
{
DropUserCommand() = default;

bool CanExecute(Windows::Foundation::IInspectable const& /*parameter*/) { return true; }
bool CanExecute(Windows::Foundation::IInspectable const&) { return true; }
void Execute(Windows::Foundation::IInspectable const& parameter);

EVENT_DECL(CanExecuteChanged, Windows::Foundation::IInspectable)
Expand Down
4 changes: 2 additions & 2 deletions TsinghuaNetUWP/FluxStringConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ using namespace TsinghuaNetHelper;

namespace winrt::TsinghuaNetUWP::implementation
{
IInspectable FluxStringConverter::Convert(IInspectable const& value, TypeName const& /*targetType*/, IInspectable const& /*parameter*/, hstring const& /*language*/) const
IInspectable FluxStringConverter::Convert(IInspectable const& value, TypeName const&, IInspectable const&, hstring const&) const
{
uint64_t flux = unbox_value<uint64_t>(value);
hstring result = UserHelper::GetFluxString(flux);
return box_value(result);
}

IInspectable FluxStringConverter::ConvertBack(IInspectable const& /*value*/, TypeName const& /*targetType*/, IInspectable const& /*parameter*/, hstring const& /*language*/) const
IInspectable FluxStringConverter::ConvertBack(IInspectable const&, TypeName const&, IInspectable const&, hstring const&) const
{
throw hresult_not_implemented();
}
Expand Down
4 changes: 2 additions & 2 deletions TsinghuaNetUWP/InternetStatusStringConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ using namespace TsinghuaNetHelper;

namespace winrt::TsinghuaNetUWP::implementation
{
IInspectable InternetStatusStringConverter::Convert(IInspectable const& value, TypeName const& /*targetType*/, IInspectable const& /*parameter*/, hstring const& /*language*/) const
IInspectable InternetStatusStringConverter::Convert(IInspectable const& value, TypeName const&, IInspectable const&, hstring const&) const
{
InternetStatus status = unbox_value<InternetStatus>(value);
wstring result;
Expand All @@ -36,7 +36,7 @@ namespace winrt::TsinghuaNetUWP::implementation
return box_value(result);
}

IInspectable InternetStatusStringConverter::ConvertBack(IInspectable const& /*value*/, TypeName const& /*targetType*/, IInspectable const& /*parameter*/, hstring const& /*language*/) const
IInspectable InternetStatusStringConverter::ConvertBack(IInspectable const&, TypeName const&, IInspectable const&, hstring const&) const
{
throw hresult_not_implemented();
}
Expand Down
50 changes: 35 additions & 15 deletions TsinghuaNetUWP/MainPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ namespace winrt::TsinghuaNetUWP::implementation
titleBar.BackgroundColor(Colors::Transparent());
titleBar.ButtonBackgroundColor(Colors::Transparent());
titleBar.ButtonInactiveBackgroundColor(Colors::Transparent());
ThemeChangedImpl();
auto viewTitleBar = CoreApplication::GetCurrentView().TitleBar();
viewTitleBar.ExtendViewIntoTitleBar(true);
}

IAsyncAction MainPage::PageLoaded(IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/)
IAsyncAction MainPage::PageLoaded(IInspectable const&, RoutedEventArgs const&)
{
RefreshStatusImpl();
NetState state = Model().SuggestState();
Expand All @@ -54,32 +55,37 @@ namespace winrt::TsinghuaNetUWP::implementation
}
}

void MainPage::OpenSettings(IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/)
void MainPage::ThemeChanged(IFrameworkElement const&, IInspectable const&)
{
ThemeChangedImpl();
}

void MainPage::OpenSettings(IInspectable const&, RoutedEventArgs const&)
{
Split().IsPaneOpen(true);
}

IAsyncAction MainPage::Login(IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/)
IAsyncAction MainPage::Login(IInspectable const&, RoutedEventArgs const&)
{
return LoginImpl();
}

IAsyncAction MainPage::Logout(IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/)
IAsyncAction MainPage::Logout(IInspectable const&, RoutedEventArgs const&)
{
return LogoutImpl();
}

IAsyncAction MainPage::Refresh(IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/)
IAsyncAction MainPage::Refresh(IInspectable const&, RoutedEventArgs const&)
{
return RefreshImpl();
}

IAsyncAction MainPage::DropUser(IInspectable const& /*sender*/, hstring const& e)
IAsyncAction MainPage::DropUser(IInspectable const&, hstring const& e)
{
return DropImpl(e);
}

IAsyncAction MainPage::ShowChangeUser(IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/)
IAsyncAction MainPage::ShowChangeUser(IInspectable const&, RoutedEventArgs const&)
{
auto dialog = make<ChangeUserDialog>();
hstring oldun = Model().Username();
Expand Down Expand Up @@ -111,6 +117,20 @@ namespace winrt::TsinghuaNetUWP::implementation
}
}

void MainPage::ThemeChangedImpl()
{
auto titleBar = ApplicationView::GetForCurrentView().TitleBar();
switch (ActualTheme())
{
case ElementTheme::Light:
titleBar.ButtonForegroundColor(Colors::Black());
break;
case ElementTheme::Dark:
titleBar.ButtonForegroundColor(Colors::White());
break;
}
}

class ProgressRingManager
{
private:
Expand Down Expand Up @@ -226,7 +246,7 @@ namespace winrt::TsinghuaNetUWP::implementation
}
}

void MainPage::StateChanged(IInspectable const& /*sender*/, NetState const& e)
void MainPage::StateChanged(IInspectable const&, NetState const& e)
{
switch (e)
{
Expand All @@ -241,25 +261,25 @@ namespace winrt::TsinghuaNetUWP::implementation
break;
}
}
void MainPage::Auth4Checked(IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/)
void MainPage::Auth4Checked(IInspectable const&, RoutedEventArgs const&)
{
Model().SyncState(NetState::Auth4);
}
void MainPage::Auth6Checked(IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/)
void MainPage::Auth6Checked(IInspectable const&, RoutedEventArgs const&)
{
Model().SyncState(NetState::Auth6);
}
void MainPage::NetChecked(IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/)
void MainPage::NetChecked(IInspectable const&, RoutedEventArgs const&)
{
Model().SyncState(NetState::Net);
}

void MainPage::RefreshStatus(IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/)
void MainPage::RefreshStatus(IInspectable const&, RoutedEventArgs const&)
{
RefreshStatusImpl();
}

IAsyncAction MainPage::ShowEditSuggestion(IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/)
IAsyncAction MainPage::ShowEditSuggestion(IInspectable const&, RoutedEventArgs const&)
{
auto dialog = make<EditSuggestionDialog>();
dialog.LanCombo().SelectedIndex((int)settings.LanState());
Expand All @@ -273,12 +293,12 @@ namespace winrt::TsinghuaNetUWP::implementation
}
}

IAsyncAction MainPage::RefreshNetUsers(IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/)
IAsyncAction MainPage::RefreshNetUsers(IInspectable const&, RoutedEventArgs const&)
{
return RefreshNetUsersImpl();
}

void MainPage::AutoLoginChanged(IInspectable const& /*sender*/, optional<bool> const& e)
void MainPage::AutoLoginChanged(IInspectable const&, optional<bool> const& e)
{
settings.AutoLogin(e.Value());
}
Expand Down
3 changes: 3 additions & 0 deletions TsinghuaNetUWP/MainPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace winrt::TsinghuaNetUWP::implementation
void ToastLogined(bool value) { m_ToastLogined = value; }

Windows::Foundation::IAsyncAction PageLoaded(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& e);
void ThemeChanged(Windows::UI::Xaml::IFrameworkElement const& sender, Windows::Foundation::IInspectable const& e);

void OpenSettings(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& e);
Windows::Foundation::IAsyncAction Login(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& e);
Expand All @@ -48,6 +49,8 @@ namespace winrt::TsinghuaNetUWP::implementation
TsinghuaNetHelper::NotificationHelper notification;
TsinghuaNetHelper::SettingsHelper settings;

void ThemeChangedImpl();

Windows::Foundation::IAsyncAction LoginImpl();
Windows::Foundation::IAsyncAction LogoutImpl();
Windows::Foundation::IAsyncAction RefreshImpl();
Expand Down
2 changes: 1 addition & 1 deletion TsinghuaNetUWP/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="using:TsinghuaNetUWP"
mc:Ignorable="d" Background="{ThemeResource SystemControlAcrylicWindowBrush}" Loaded="PageLoaded">
mc:Ignorable="d" Background="{ThemeResource SystemControlAcrylicWindowBrush}" Loaded="PageLoaded" ActualThemeChanged="ThemeChanged">
<Page.DataContext>
<local:MainViewModel x:Name="Model" StateChanged="StateChanged" AutoLoginChanged="AutoLoginChanged"/>
</Page.DataContext>
Expand Down
4 changes: 2 additions & 2 deletions TsinghuaNetUWP/NetStateStringConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ using namespace TsinghuaNetHelper;

namespace winrt::TsinghuaNetUWP::implementation
{
IInspectable NetStateStringConverter::Convert(IInspectable const& value, TypeName const& /*targetType*/, IInspectable const& /*parameter*/, hstring const& /*language*/) const
IInspectable NetStateStringConverter::Convert(IInspectable const& value, TypeName const&, IInspectable const&, hstring const&) const
{
NetState state = unbox_value<NetState>(value);
wstring result;
Expand All @@ -36,7 +36,7 @@ namespace winrt::TsinghuaNetUWP::implementation
return box_value(result);
}

IInspectable NetStateStringConverter::ConvertBack(IInspectable const& /*value*/, TypeName const& /*targetType*/, IInspectable const& /*parameter*/, hstring const& /*language*/) const
IInspectable NetStateStringConverter::ConvertBack(IInspectable const&, TypeName const&, IInspectable const&, hstring const&) const
{
throw hresult_not_implemented();
}
Expand Down
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="1.1.8.0" />
<Identity Name="Berrysoft.TsinghuaNetUWP" Publisher="CN=Straw" Version="1.1.9.0" />
<mp:PhoneIdentity PhoneProductId="091ffa12-1933-4f1b-96a5-4a169e4ab5f5" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>TsinghuaNetUWP</DisplayName>
Expand Down
4 changes: 2 additions & 2 deletions TsinghuaNetUWP/TimeSpanStringConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ using namespace TsinghuaNetHelper;

namespace winrt::TsinghuaNetUWP::implementation
{
IInspectable TimeSpanStringConverter::Convert(IInspectable const& value, TypeName const& /*targetType*/, IInspectable const& /*parameter*/, hstring const& /*language*/) const
IInspectable TimeSpanStringConverter::Convert(IInspectable const& value, TypeName const&, IInspectable const&, hstring const&) const
{
return box_value(UserHelper::GetTimeSpanString(unbox_value<TimeSpan>(value)));
}

IInspectable TimeSpanStringConverter::ConvertBack(IInspectable const& /*value*/, TypeName const& /*targetType*/, IInspectable const& /*parameter*/, hstring const& /*language*/) const
IInspectable TimeSpanStringConverter::ConvertBack(IInspectable const&, TypeName const&, IInspectable const&, hstring const&) const
{
throw hresult_not_implemented();
}
Expand Down

0 comments on commit 99b9035

Please sign in to comment.