blob: a8d24bc2dd374cd932b209deaef649d2a73e5a74 [file] [log] [blame]
atraczyk61b28422016-08-24 09:25:59 -04001/**************************************************************************
2* Copyright (C) 2016 by Savoir-faire Linux *
3* Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com> *
4* Author: Traczyk Andreas <traczyk.andreas@savoirfairelinux.com> *
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 "LoadingPage.xaml.h"
22
23#include "MainPage.xaml.h"
24#include "Wizard.xaml.h"
25
26using namespace RingClientUWP;
27using namespace RingClientUWP::Views;
28using namespace RingClientUWP::ViewModel;
29
30using namespace Platform;
31using namespace Windows::ApplicationModel::Core;
32using namespace Windows::Foundation;
33using namespace Windows::Foundation::Collections;
34using namespace Windows::UI::ViewManagement;
35using namespace Windows::UI::Xaml;
36using namespace Windows::UI::Xaml::Controls;
37using namespace Windows::UI::Xaml::Controls::Primitives;
38using namespace Windows::UI::Core;
39using namespace Windows::UI::Xaml::Data;
40using namespace Windows::UI::Xaml::Input;
41using namespace Windows::UI::Xaml::Interop;
42using namespace Windows::UI::Xaml::Navigation;
43using namespace Windows::ApplicationModel::Activation;
44using namespace Windows::Graphics::Display;
45using namespace Windows::System;
46
47LoadingPage::LoadingPage()
48{
49 InitializeComponent();
50
51 Utils::fileExists(ApplicationData::Current->LocalFolder, ".config\\dring.yml")
Nicolas Jagerb059a662016-08-30 13:17:30 -040052 .then([this](bool config_exists)
atraczyk61b28422016-08-24 09:25:59 -040053 {
54 if (config_exists) {
55 RingD::instance->hasConfig = true;
56 this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new Windows::UI::Core::DispatchedHandler([this] () {
57 this->Frame->Navigate(Windows::UI::Xaml::Interop::TypeName(MainPage::typeid));
58 }));
59 }
60 else {
61 RingD::instance->hasConfig = false;
62 this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new Windows::UI::Core::DispatchedHandler([this] () {
63 this->Frame->Navigate(Windows::UI::Xaml::Interop::TypeName(Wizard::typeid));
64 }));
65 }
66 });
67}