Nicolas Jager | 998fbd7 | 2016-08-08 11:41:28 -0400 | [diff] [blame] | 1 | /**************************************************************************
|
| 2 | * Copyright (C) 2016 by Savoir-faire Linux *
|
| 3 | * Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com> *
|
atraczyk | acc4c41 | 2016-11-10 22:56:52 -0500 | [diff] [blame] | 4 | * Author: Traczyk Andreas <andreas.traczyk@savoirfairelinux.com> *
|
Nicolas Jager | 998fbd7 | 2016-08-08 11:41:28 -0400 | [diff] [blame] | 5 | * *
|
| 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"
|
atraczyk | bee4271 | 2016-12-12 17:12:41 -0500 | [diff] [blame] | 22 | #include "AboutPage.xaml.h"
|
Nicolas Jager | 998fbd7 | 2016-08-08 11:41:28 -0400 | [diff] [blame] | 23 |
|
| 24 | using namespace RingClientUWP;
|
| 25 | using namespace RingClientUWP::Views;
|
| 26 |
|
atraczyk | bee4271 | 2016-12-12 17:12:41 -0500 | [diff] [blame] | 27 | using namespace Windows::UI::ViewManagement;
|
| 28 | using namespace Windows::UI::Core;
|
| 29 | using namespace Windows::UI::Xaml::Controls;
|
| 30 |
|
Nicolas Jager | 998fbd7 | 2016-08-08 11:41:28 -0400 | [diff] [blame] | 31 | WelcomePage::WelcomePage()
|
| 32 | {
|
| 33 | InitializeComponent();
|
atraczyk | 1ddcb5a | 2016-09-07 16:18:30 -0400 | [diff] [blame] | 34 | Window::Current->SizeChanged += ref new WindowSizeChangedEventHandler(this, &WelcomePage::OnResize);
|
| 35 | OnResize(nullptr, nullptr);
|
| 36 | };
|
| 37 |
|
| 38 | void
|
| 39 | WelcomePage::PositionImage()
|
| 40 | {
|
Nicolas Jager | 7f34b77 | 2016-12-09 12:25:25 -0500 | [diff] [blame] | 41 | /*Rect imageBounds;
|
atraczyk | 14ba30c | 2016-09-22 18:31:59 -0400 | [diff] [blame] | 42 | imageBounds.Width = static_cast<float>(_welcomePage_->ActualWidth);
|
| 43 | imageBounds.Height = static_cast<float>(_welcomePage_->ActualHeight);
|
atraczyk | 1ddcb5a | 2016-09-07 16:18:30 -0400 | [diff] [blame] | 44 |
|
| 45 | _welcomeImage_->SetValue(Canvas::LeftProperty, imageBounds.Width * 0.5 - _welcomeImage_->Width * 0.5);
|
Nicolas Jager | 7f34b77 | 2016-12-09 12:25:25 -0500 | [diff] [blame] | 46 | _welcomeImage_->SetValue(Canvas::TopProperty, imageBounds.Height * 0.5 - _welcomeImage_->Height * 0.5);*/
|
atraczyk | 1ddcb5a | 2016-09-07 16:18:30 -0400 | [diff] [blame] | 47 | }
|
| 48 |
|
| 49 | void
|
| 50 | WelcomePage::OnResize(Platform::Object^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ e)
|
| 51 | {
|
atraczyk | 6cae7a6 | 2016-11-30 14:56:31 -0500 | [diff] [blame] | 52 | //PositionImage();
|
atraczyk | bee4271 | 2016-12-12 17:12:41 -0500 | [diff] [blame] | 53 | }
|
| 54 |
|
| 55 | void 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 | }
|