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> *
|
| 4 | * *
|
| 5 | * This program is free software; you can redistribute it and/or modify *
|
| 6 | * it under the terms of the GNU General Public License as published by *
|
| 7 | * the Free Software Foundation; either version 3 of the License, or *
|
| 8 | * (at your option) any later version. *
|
| 9 | * *
|
| 10 | * This program is distributed in the hope that it will be useful, *
|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
| 13 | * GNU General Public License for more details. *
|
| 14 | * *
|
| 15 | * You should have received a copy of the GNU General Public License *
|
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
| 17 | **************************************************************************/
|
| 18 | #include "pch.h"
|
| 19 |
|
| 20 | #include "WelcomePage.xaml.h"
|
| 21 |
|
| 22 | using namespace RingClientUWP;
|
| 23 | using namespace RingClientUWP::Views;
|
| 24 |
|
| 25 | WelcomePage::WelcomePage()
|
| 26 | {
|
| 27 | InitializeComponent();
|
atraczyk | 1ddcb5a | 2016-09-07 16:18:30 -0400 | [diff] [blame] | 28 | Window::Current->SizeChanged += ref new WindowSizeChangedEventHandler(this, &WelcomePage::OnResize);
|
| 29 | OnResize(nullptr, nullptr);
|
| 30 | };
|
| 31 |
|
| 32 | void
|
| 33 | WelcomePage::PositionImage()
|
| 34 | {
|
| 35 | Rect imageBounds;
|
| 36 | imageBounds.Width = _welcomePage_->ActualWidth;
|
| 37 | imageBounds.Height = _welcomePage_->ActualWidth;
|
| 38 |
|
| 39 | _welcomeImage_->SetValue(Canvas::LeftProperty, imageBounds.Width * 0.5 - _welcomeImage_->Width * 0.5);
|
| 40 | _welcomeImage_->SetValue(Canvas::TopProperty, imageBounds.Height * 0.5 - _welcomeImage_->Height * 0.5);
|
| 41 | }
|
| 42 |
|
| 43 | void
|
| 44 | WelcomePage::OnResize(Platform::Object^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ e)
|
| 45 | {
|
| 46 | PositionImage();
|
| 47 | } |