blob: 1a22547fbc35fedbdcb3b99aada487896ce93b89 [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> *
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
22using namespace RingClientUWP;
23using namespace RingClientUWP::Views;
24
25WelcomePage::WelcomePage()
26{
27 InitializeComponent();
atraczyk1ddcb5a2016-09-07 16:18:30 -040028 Window::Current->SizeChanged += ref new WindowSizeChangedEventHandler(this, &WelcomePage::OnResize);
29 OnResize(nullptr, nullptr);
30};
31
32void
33WelcomePage::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
43void
44WelcomePage::OnResize(Platform::Object^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ e)
45{
46 PositionImage();
47}