blob: 1b7d42e2cb4fb2f814496dbb7caa6999f4b60b32 [file] [log] [blame]
Nicolas Jager998fbd72016-08-08 11:41:28 -04001/**************************************************************************
2* Copyright (C) 2016 by Savoir-faire Linux *
3* Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com> *
atraczykacc4c412016-11-10 22:56:52 -05004* Author: Traczyk Andreas <andreas.traczyk@savoirfairelinux.com> *
Nicolas Jager998fbd72016-08-08 11:41:28 -04005* *
6* This program is free software; you can redistribute it and/or modify *
7* it under the terms of the GNU General Public License as published by *
8* the Free Software Foundation; either version 3 of the License, or *
9* (at your option) any later version. *
10* *
11* This program is distributed in the hope that it will be useful, *
12* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14* GNU General Public License for more details. *
15* *
16* You should have received a copy of the GNU General Public License *
17* along with this program. If not, see <http://www.gnu.org/licenses/>. *
18**************************************************************************/
19#include "pch.h"
20
21#include "WelcomePage.xaml.h"
atraczykbee42712016-12-12 17:12:41 -050022#include "AboutPage.xaml.h"
Nicolas Jager998fbd72016-08-08 11:41:28 -040023
24using namespace RingClientUWP;
25using namespace RingClientUWP::Views;
26
atraczykbee42712016-12-12 17:12:41 -050027using namespace Windows::UI::ViewManagement;
28using namespace Windows::UI::Core;
29using namespace Windows::UI::Xaml::Controls;
30
Nicolas Jager998fbd72016-08-08 11:41:28 -040031WelcomePage::WelcomePage()
32{
33 InitializeComponent();
atraczyk1ddcb5a2016-09-07 16:18:30 -040034 Window::Current->SizeChanged += ref new WindowSizeChangedEventHandler(this, &WelcomePage::OnResize);
35 OnResize(nullptr, nullptr);
36};
37
38void
39WelcomePage::PositionImage()
40{
Nicolas Jager7f34b772016-12-09 12:25:25 -050041 /*Rect imageBounds;
atraczyk14ba30c2016-09-22 18:31:59 -040042 imageBounds.Width = static_cast<float>(_welcomePage_->ActualWidth);
43 imageBounds.Height = static_cast<float>(_welcomePage_->ActualHeight);
atraczyk1ddcb5a2016-09-07 16:18:30 -040044
45 _welcomeImage_->SetValue(Canvas::LeftProperty, imageBounds.Width * 0.5 - _welcomeImage_->Width * 0.5);
Nicolas Jager7f34b772016-12-09 12:25:25 -050046 _welcomeImage_->SetValue(Canvas::TopProperty, imageBounds.Height * 0.5 - _welcomeImage_->Height * 0.5);*/
atraczyk1ddcb5a2016-09-07 16:18:30 -040047}
48
49void
50WelcomePage::OnResize(Platform::Object^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ e)
51{
atraczyk6cae7a62016-11-30 14:56:31 -050052 //PositionImage();
atraczykbee42712016-12-12 17:12:41 -050053}
54
55void RingClientUWP::Views::WelcomePage::_aboutButton__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
56{
57 // new window?
58 /*auto currentAV = ApplicationView::GetForCurrentView();
59 auto newAV = CoreApplication::CreateNewView();
60 newAV->Dispatcher->RunAsync(CoreDispatcherPriority::Normal,
61 ref new DispatchedHandler([=]()
62 {
63 auto newWindow = Window::Current;
64 auto newAppView = ApplicationView::GetForCurrentView();
65 newAppView->Title = "About";
66
67 auto frame = ref new Windows::UI::Xaml::Controls::Frame();
68 frame->Navigate(Windows::UI::Xaml::Interop::TypeName(Views::AboutPage::typeid));
69 newWindow->Content = frame;
70 newWindow->Activate();
71
72 ApplicationViewSwitcher::TryShowAsStandaloneAsync(
73 newAppView->Id,
74 ViewSizePreference::UseMinimum,
75 currentAV->Id,
76 ViewSizePreference::UseMinimum);
77
78 RingD::instance->isInAbout = true;
79 newAppView->TryResizeView(Size(200, 200));
80 }));*/
81
82 auto rootFrame = dynamic_cast<Windows::UI::Xaml::Controls::Frame^>(Window::Current->Content);
83 rootFrame->Navigate(Windows::UI::Xaml::Interop::TypeName(Views::AboutPage::typeid));
84}