integrate wizard menu and add loadpage

Change-Id: I65fe90a2155966a2631c01ed00892070e8fc4456
diff --git a/App.xaml.cpp b/App.xaml.cpp
index 275592a..e3f6a8d 100644
--- a/App.xaml.cpp
+++ b/App.xaml.cpp
@@ -17,6 +17,7 @@
 **************************************************************************/

 #include "pch.h"

 

+#include "LoadingPage.xaml.h"

 #include "MainPage.xaml.h"

 

 using namespace Windows::ApplicationModel::Core;

@@ -45,20 +46,16 @@
         rootFrame = ref new Frame();

 

         if (rootFrame->Content == nullptr)

-            rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments);

+            rootFrame->Navigate(TypeName(Views::LoadingPage::typeid), e->Arguments);

 

         Window::Current->Content = rootFrame;

         Window::Current->Activate();

     } else

-        rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments);

+        rootFrame->Navigate(TypeName(Views::LoadingPage::typeid), e->Arguments);

 

     CoreApplication::GetCurrentView()->TitleBar->ExtendViewIntoTitleBar = true;

     ApplicationView::GetForCurrentView()->TitleBar->ButtonBackgroundColor = Colors::LightBlue;

     ApplicationView::GetForCurrentView()->TitleBar->ButtonInactiveBackgroundColor = Colors::LightBlue;

     ApplicationView::GetForCurrentView()->TitleBar->ForegroundColor = Colors::White;

     ApplicationView::GetForCurrentView()->TitleBar->ButtonForegroundColor = Colors::White;

-

-    /* summon the daemon */

-    //RingD::instance->startDaemon(); //disabled on purpose

-

 }
\ No newline at end of file
diff --git a/LoadingPage.xaml b/LoadingPage.xaml
new file mode 100644
index 0000000..b1b3b84
--- /dev/null
+++ b/LoadingPage.xaml
@@ -0,0 +1,29 @@
+<!-- **********************************************************************

+* Copyright (C) 2016 by Savoir-faire Linux                                *

+* Author: Jäger Nicolas<nicolas.jager@savoirfairelinux.com>               *

+*                                                                         *

+* This program is free software; you can redistribute it and/or modify    *

+* it under the terms of the GNU General Public License as published by    *

+* the Free Software Foundation; either version 3 of the License, or       *

+* (at your option) any later version.                                     *

+*                                                                         *

+* This program is distributed in the hope that it will be useful,         *

+* but WITHOUT ANY WARRANTY; without even the implied warranty of          *

+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *

+* GNU General Public License for more details.                            *

+*                                                                         *

+* You should have received a copy of the GNU General Public License       *

+* along with this program.  If not, see <http://www.gnu.org/licenses/> .  *

+*********************************************************************** -->

+<Page

+    x:Class="RingClientUWP.Views.LoadingPage"

+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

+      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

+      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

+      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

+      mc:Ignorable="d">

+

+    <Grid>

+        <TextBlock Text="loading page"/>

+    </Grid>

+</Page>

diff --git a/LoadingPage.xaml.cpp b/LoadingPage.xaml.cpp
new file mode 100644
index 0000000..b0263ee
--- /dev/null
+++ b/LoadingPage.xaml.cpp
@@ -0,0 +1,67 @@
+/**************************************************************************

+* Copyright (C) 2016 by Savoir-faire Linux                                *

+* Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com>              *

+* Author: Traczyk Andreas <traczyk.andreas@savoirfairelinux.com>          *

+*                                                                         *

+* This program is free software; you can redistribute it and/or modify    *

+* it under the terms of the GNU General Public License as published by    *

+* the Free Software Foundation; either version 3 of the License, or       *

+* (at your option) any later version.                                     *

+*                                                                         *

+* This program is distributed in the hope that it will be useful,         *

+* but WITHOUT ANY WARRANTY; without even the implied warranty of          *

+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *

+* GNU General Public License for more details.                            *

+*                                                                         *

+* You should have received a copy of the GNU General Public License       *

+* along with this program.  If not, see <http://www.gnu.org/licenses/>.   *

+**************************************************************************/

+#include "pch.h"

+

+#include "LoadingPage.xaml.h"

+

+#include "MainPage.xaml.h"

+#include "Wizard.xaml.h"

+

+using namespace RingClientUWP;

+using namespace RingClientUWP::Views;

+using namespace RingClientUWP::ViewModel;

+

+using namespace Platform;

+using namespace Windows::ApplicationModel::Core;

+using namespace Windows::Foundation;

+using namespace Windows::Foundation::Collections;

+using namespace Windows::UI::ViewManagement;

+using namespace Windows::UI::Xaml;

+using namespace Windows::UI::Xaml::Controls;

+using namespace Windows::UI::Xaml::Controls::Primitives;

+using namespace Windows::UI::Core;

+using namespace Windows::UI::Xaml::Data;

+using namespace Windows::UI::Xaml::Input;

+using namespace Windows::UI::Xaml::Interop;

+using namespace Windows::UI::Xaml::Navigation;

+using namespace Windows::ApplicationModel::Activation;

+using namespace Windows::Graphics::Display;

+using namespace Windows::System;

+

+LoadingPage::LoadingPage()

+{

+    InitializeComponent();

+

+    Utils::fileExists(ApplicationData::Current->LocalFolder, ".config\\dring.yml")

+        .then([this](bool config_exists)

+    {

+        if (config_exists) {

+            RingD::instance->hasConfig = true;

+            this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new Windows::UI::Core::DispatchedHandler([this] () {

+                this->Frame->Navigate(Windows::UI::Xaml::Interop::TypeName(MainPage::typeid));

+            }));

+        }

+        else {

+            RingD::instance->hasConfig = false;

+            this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new Windows::UI::Core::DispatchedHandler([this] () {

+                this->Frame->Navigate(Windows::UI::Xaml::Interop::TypeName(Wizard::typeid));

+            }));

+        }

+    });

+}

diff --git a/LoadingPage.xaml.h b/LoadingPage.xaml.h
new file mode 100644
index 0000000..9c31a90
--- /dev/null
+++ b/LoadingPage.xaml.h
@@ -0,0 +1,31 @@
+#pragma once

+/**************************************************************************

+* Copyright (C) 2016 by Savoir-faire Linux                                *

+* Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com>              *

+*                                                                         *

+* This program is free software; you can redistribute it and/or modify    *

+* it under the terms of the GNU General Public License as published by    *

+* the Free Software Foundation; either version 3 of the License, or       *

+* (at your option) any later version.                                     *

+*                                                                         *

+* This program is distributed in the hope that it will be useful,         *

+* but WITHOUT ANY WARRANTY; without even the implied warranty of          *

+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *

+* GNU General Public License for more details.                            *

+*                                                                         *

+* You should have received a copy of the GNU General Public License       *

+* along with this program.  If not, see <http://www.gnu.org/licenses/>.   *

+**************************************************************************/

+#include "LoadingPage.g.h"

+

+namespace RingClientUWP

+{

+namespace Views

+{

+public ref class LoadingPage sealed

+{

+public:

+    LoadingPage();

+};

+}

+}
\ No newline at end of file
diff --git a/MainPage.xaml.cpp b/MainPage.xaml.cpp
index d0e1d25..aa7c13d 100644
--- a/MainPage.xaml.cpp
+++ b/MainPage.xaml.cpp
@@ -98,3 +98,9 @@
         dynamic_cast<MessageTextPage^>(_messageTextFrame_->Content)->updatePageContent();

     }

 }

+

+void

+RingClientUWP::MainPage::OnNavigatedTo(NavigationEventArgs ^ e)

+{

+    RingD::instance->startDaemon();

+}
\ No newline at end of file
diff --git a/MainPage.xaml.h b/MainPage.xaml.h
index e2a9e0f..7b9691b 100644
--- a/MainPage.xaml.h
+++ b/MainPage.xaml.h
@@ -31,6 +31,7 @@
     MainPage();

 

 protected:

+    virtual void OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override;

     virtual void OnKeyDown(KeyRoutedEventArgs^ e) override;

 private:

     void _toggleSmartBoxButton__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);

diff --git a/Package.appxmanifest b/Package.appxmanifest
index 7ac7bed..d3ec44c 100644
--- a/Package.appxmanifest
+++ b/Package.appxmanifest
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>

 <Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">

-  <Identity Name="2385953f-9019-423d-aa82-d1bbacfa258b" Publisher="CN=user" Version="1.0.0.0" />

+  <Identity Name="00000000-0000-0000-0000-000000000000" Publisher="CN=user" Version="1.0.0.0" />

   <mp:PhoneIdentity PhoneProductId="2385953f-9019-423d-aa82-d1bbacfa258b" PhonePublisherId="00000000-0000-0000-0000-000000000000" />

   <Properties>

     <DisplayName>ring-client-uwp</DisplayName>

diff --git a/RingConsolePanel.xaml.cpp b/RingConsolePanel.xaml.cpp
index 798b794..797e023 100644
--- a/RingConsolePanel.xaml.cpp
+++ b/RingConsolePanel.xaml.cpp
@@ -1,116 +1,116 @@
-/**************************************************************************
-* Copyright (C) 2016 by Savoir-faire Linux                                *
-* Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com>              *
-*                                                                         *
-* This program is free software; you can redistribute it and/or modify    *
-* it under the terms of the GNU General Public License as published by    *
-* the Free Software Foundation; either version 3 of the License, or       *
-* (at your option) any later version.                                     *
-*                                                                         *
-* This program is distributed in the hope that it will be useful,         *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of          *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
-* GNU General Public License for more details.                            *
-*                                                                         *
-* You should have received a copy of the GNU General Public License       *
-* along with this program.  If not, see <http://www.gnu.org/licenses/>.   *
-**************************************************************************/
-#include "pch.h"
-
-#include "RingConsolePanel.xaml.h"
-
-using namespace RingClientUWP;
-using namespace RingClientUWP::Views;
-using namespace Windows::ApplicationModel::Core;
-using namespace Windows::UI::Core;
-using namespace Windows::UI::Xaml::Documents;
-
-RingConsolePanel::RingConsolePanel()
-{
-    InitializeComponent();
-
-    RingDebug::instance->messageToScreen += ref new debugMessageToScreen([this](Platform::String^ message) {
-        output(message);
-    });
-}
-
-void
-RingConsolePanel::output(Platform::String^ message)
-{
-    try {
-        Run^ inlineText = ref new Run();
-        inlineText->Text = message;
-        Paragraph^ paragraph = ref new Paragraph();
-        paragraph->Inlines->Append(inlineText);
-        _debugWindowOutput_->Blocks->Append(paragraph);
-        _scrollView_->UpdateLayout();
-        _scrollView_->ScrollToVerticalOffset(_scrollView_->ScrollableHeight);
-    }
-    catch (Platform::Exception^ e) {
-        return;
-    }
-}
-
-void RingConsolePanel::_btnSendDbgCmd__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
-{
-    sendCommand();
-}
-
-
-void RingConsolePanel::_sendDbgCmd__KeyDown(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e)
-{
-    if (e->Key == Windows::System::VirtualKey::Enter && _tBoxDbg_->Text != "") {
-        sendCommand();
-    }
-    else if (e->Key == Windows::System::VirtualKey::PageUp) {
-
-        if (historyLevel < 1)
-            return;
-        if (historyLevel == historyCmds.Size)
-            currentCmd = _tBoxDbg_->Text;
-        historyLevel--;
-        _tBoxDbg_->Text = historyCmds.GetAt(historyLevel);
-
-    }
-    else if (e->Key == Windows::System::VirtualKey::PageDown) {
-        if (historyLevel < historyCmds.Size) {
-            _tBoxDbg_->Text = historyCmds.GetAt(historyLevel);
-            historyLevel++;
-
-        }
-        else {
-            _tBoxDbg_->Text = currentCmd;
-        }
-        return;
-    }
-}
-
-/*\ ADD EACH NEW COMMAND TO THE HELP LIST \*/
-void RingConsolePanel::sendCommand()
-{
-    auto cmdInput = _tBoxDbg_->Text;
-    addCommandToHistory();
-    historyLevel++;
-    _tBoxDbg_->Text = "";
-    currentCmd = "";
-    historyLevel = historyCmds.Size;
-
-    if (cmdInput == "") {
-        return;
-    }
-    else if (cmdInput == "help") {
-        MSG_(">> Help :");
-        MSG_("use PgUp/PgDown for crawling commands history.");
-        return;
-    }
-
-    std::wstring wStr(cmdInput->Begin());
-    std::string result(wStr.begin(), wStr.end());
-
-    MSG_(">> error, command \'" + result + "\' not found");
-}
-
-void RingConsolePanel::addCommandToHistory()
-{
-    historyCmds.Append(_tBoxDbg_->Text);
+/**************************************************************************

+* Copyright (C) 2016 by Savoir-faire Linux                                *

+* Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com>              *

+*                                                                         *

+* This program is free software; you can redistribute it and/or modify    *

+* it under the terms of the GNU General Public License as published by    *

+* the Free Software Foundation; either version 3 of the License, or       *

+* (at your option) any later version.                                     *

+*                                                                         *

+* This program is distributed in the hope that it will be useful,         *

+* but WITHOUT ANY WARRANTY; without even the implied warranty of          *

+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *

+* GNU General Public License for more details.                            *

+*                                                                         *

+* You should have received a copy of the GNU General Public License       *

+* along with this program.  If not, see <http://www.gnu.org/licenses/>.   *

+**************************************************************************/

+#include "pch.h"

+

+#include "RingConsolePanel.xaml.h"

+

+using namespace RingClientUWP;

+using namespace RingClientUWP::Views;

+using namespace Windows::ApplicationModel::Core;

+using namespace Windows::UI::Core;

+using namespace Windows::UI::Xaml::Documents;

+

+RingConsolePanel::RingConsolePanel()

+{

+    InitializeComponent();

+

+    RingDebug::instance->messageToScreen += ref new debugMessageToScreen([this](Platform::String^ message) {

+        output(message);

+    });

+}

+

+void

+RingConsolePanel::output(Platform::String^ message)

+{

+    try {

+        Run^ inlineText = ref new Run();

+        inlineText->Text = message;

+        Paragraph^ paragraph = ref new Paragraph();

+        paragraph->Inlines->Append(inlineText);

+        _debugWindowOutput_->Blocks->Append(paragraph);

+        _scrollView_->UpdateLayout();

+        _scrollView_->ScrollToVerticalOffset(_scrollView_->ScrollableHeight);

+    }

+    catch (Platform::Exception^ e) {

+        return;

+    }

+}

+

+void RingConsolePanel::_btnSendDbgCmd__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)

+{

+    sendCommand();

+}

+

+

+void RingConsolePanel::_sendDbgCmd__KeyDown(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e)

+{

+    if (e->Key == Windows::System::VirtualKey::Enter && _tBoxDbg_->Text != "") {

+        sendCommand();

+    }

+    else if (e->Key == Windows::System::VirtualKey::PageUp) {

+

+        if (historyLevel < 1)

+            return;

+        if (historyLevel == historyCmds.Size)

+            currentCmd = _tBoxDbg_->Text;

+        historyLevel--;

+        _tBoxDbg_->Text = historyCmds.GetAt(historyLevel);

+

+    }

+    else if (e->Key == Windows::System::VirtualKey::PageDown) {

+        if (historyLevel < historyCmds.Size) {

+            _tBoxDbg_->Text = historyCmds.GetAt(historyLevel);

+            historyLevel++;

+

+        }

+        else {

+            _tBoxDbg_->Text = currentCmd;

+        }

+        return;

+    }

+}

+

+/*\ ADD EACH NEW COMMAND TO THE HELP LIST \*/

+void RingConsolePanel::sendCommand()

+{

+    auto cmdInput = _tBoxDbg_->Text;

+    addCommandToHistory();

+    historyLevel++;

+    _tBoxDbg_->Text = "";

+    currentCmd = "";

+    historyLevel = historyCmds.Size;

+

+    if (cmdInput == "") {

+        return;

+    }

+    else if (cmdInput == "help") {

+        MSG_(">> Help :");

+        MSG_("use PgUp/PgDown for crawling commands history.");

+        return;

+    }

+

+    std::wstring wStr(cmdInput->Begin());

+    std::string result(wStr.begin(), wStr.end());

+

+    MSG_(">> error, command \'" + result + "\' not found");

+}

+

+void RingConsolePanel::addCommandToHistory()

+{

+    historyCmds.Append(_tBoxDbg_->Text);

 }

diff --git a/RingD.cpp b/RingD.cpp
index 68bac89..0cc1a99 100644
--- a/RingD.cpp
+++ b/RingD.cpp
@@ -33,9 +33,6 @@
 

 using namespace RingClientUWP;

 

-CoreDispatcher^ g_dispatcher;

-bool has_config;

-

 void

 DebugOutputWrapper(const std::string& str)

 {

@@ -45,101 +42,88 @@
 void

 RingClientUWP::RingD::startDaemon()

 {

-    g_dispatcher = CoreApplication::MainView->CoreWindow->Dispatcher;

-

-    Utils::fileExists(ApplicationData::Current->LocalFolder, ".config\\dring.yml")

-    .then([this](bool config_exists)

+    create_task([&]()

     {

-        if (!config_exists) {

-            has_config = false;

+        using SharedCallback = std::shared_ptr<DRing::CallbackWrapperBase>;

+        using namespace std::placeholders;

+

+        std::map<std::string, SharedCallback> callHandlers = {

+            // use IncomingCall only to register the call client sided, use StateChange to determine the impact on the UI

+            DRing::exportable_callback<DRing::CallSignal::IncomingCall>([this](

+                const std::string& accountId,

+                const std::string& callId,

+                const std::string& from)

+            {

+                MSG_("<IncomingCall>");

+                MSG_("accountId = " + accountId);

+                MSG_("callId = " + callId);

+                MSG_("from = " + from);

+            }),

+            DRing::exportable_callback<DRing::CallSignal::StateChange>([this](

+                const std::string& callId,

+                const std::string& state,

+                int code)

+            {

+                MSG_("<StateChange>");

+                MSG_("callId = " + callId);

+                MSG_("state = " + state);

+                MSG_("code = " + std::to_string(code));

+            }),

+            DRing::exportable_callback<DRing::ConfigurationSignal::IncomingAccountMessage>([this](

+                const std::string& accountId,

+                const std::string& from,

+                const std::map<std::string, std::string>& payloads)

+            {

+                MSG_("<IncomingAccountMessage>");

+                MSG_("accountId = " + accountId);

+                MSG_("from = " + from);

+

+                for (auto i : payloads) {

+                    MSG_("payload = " + i.second);

+                    auto payload = Utils::toPlatformString(i.second);

+                }

+            })

+        };

+

+        registerCallHandlers(callHandlers);

+

+        std::map<std::string, SharedCallback> dringDebugOutHandler;

+        dringDebugOutHandler.insert(DRing::exportable_callback<DRing::Debug::MessageSend>

+                             (std::bind(&DebugOutputWrapper, _1)));

+        registerCallHandlers(dringDebugOutHandler);

+

+        std::map<std::string, SharedCallback> getAppPathHandler =

+        {

+            DRing::exportable_callback<DRing::ConfigurationSignal::GetAppDataPath>

+            ([this](std::vector<std::string>* paths){

+                paths->emplace_back(localFolder_);

+            })

+        };

+        registerCallHandlers(getAppPathHandler);

+

+        DRing::init(static_cast<DRing::InitFlag>(DRing::DRING_FLAG_CONSOLE_LOG |

+            DRing::DRING_FLAG_DEBUG |

+            DRing::DRING_FLAG_AUTOANSWER));

+

+        if (!DRing::start()) {

+            ERR_("\ndaemon didn't start.\n");

+            return;

         }

         else {

-            has_config = true;

-        }

-    })

-    .then([this]() {

-        create_task([&]()

-        {

-            using SharedCallback = std::shared_ptr<DRing::CallbackWrapperBase>;

-            using namespace std::placeholders;

-

-            std::map<std::string, SharedCallback> callHandlers = {

-                // use IncomingCall only to register the call client sided, use StateChange to determine the impact on the UI

-                DRing::exportable_callback<DRing::CallSignal::IncomingCall>([this](

-                    const std::string& accountId,

-                    const std::string& callId,

-                    const std::string& from)

-                {

-                    MSG_("<IncomingCall>");

-                    MSG_("accountId = " + accountId);

-                    MSG_("callId = " + callId);

-                    MSG_("from = " + from);

-                }),

-                DRing::exportable_callback<DRing::CallSignal::StateChange>([this](

-                    const std::string& callId,

-                    const std::string& state,

-                    int code)

-                {

-                    MSG_("<StateChange>");

-                    MSG_("callId = " + callId);

-                    MSG_("state = " + state);

-                    MSG_("code = " + std::to_string(code));

-                }),

-                DRing::exportable_callback<DRing::ConfigurationSignal::IncomingAccountMessage>([this](

-                    const std::string& accountId,

-                    const std::string& from,

-                    const std::map<std::string, std::string>& payloads)

-                {

-                    MSG_("<IncomingAccountMessage>");

-                    MSG_("accountId = " + accountId);

-                    MSG_("from = " + from);

-

-                    for (auto i : payloads) {

-                        MSG_("payload = " + i.second);

-                        auto payload = Utils::toPlatformString(i.second);

-                    }

-                })

-            };

-

-            registerCallHandlers(callHandlers);

-

-            std::map<std::string, SharedCallback> dringDebugOutHandler;

-            dringDebugOutHandler.insert(DRing::exportable_callback<DRing::Debug::MessageSend>

-                                        (std::bind(&DebugOutputWrapper, _1)));

-            registerCallHandlers(dringDebugOutHandler);

-

-            std::map<std::string, SharedCallback> getAppPathHandler =

+            if (!hasConfig)

             {

-                DRing::exportable_callback<DRing::ConfigurationSignal::GetAppDataPath>

-                ([this](std::vector<std::string>* paths) {

-                    paths->emplace_back(localFolder_);

-                })

-            };

-            registerCallHandlers(getAppPathHandler);

-

-            DRing::init(static_cast<DRing::InitFlag>(DRing::DRING_FLAG_CONSOLE_LOG |

-                        DRing::DRING_FLAG_DEBUG |

-                        DRing::DRING_FLAG_AUTOANSWER));

-

-            if (!DRing::start()) {

-                ERR_("\ndaemon didn't start.\n");

-                return;

+                std::map<std::string, std::string> test_details;

+                test_details.insert(std::make_pair(ring::Conf::CONFIG_ACCOUNT_ALIAS, accountName));

+                test_details.insert(std::make_pair(ring::Conf::CONFIG_ACCOUNT_TYPE,"RING"));

+                DRing::addAccount(test_details);

             }

-            else {

-                // if there is no config, create a default RING account

-                if (!has_config) {

-                    std::map<std::string, std::string> test_details;

-                    test_details.insert(std::make_pair(ring::Conf::CONFIG_ACCOUNT_ALIAS, "default"));

-                    test_details.insert(std::make_pair(ring::Conf::CONFIG_ACCOUNT_TYPE, "RING"));

-                    DRing::addAccount(test_details);

-                }

-                while (true) {

-                    DRing::pollEvents();

-                    Sleep(1000);

-                }

-                DRing::fini();

+            // if there is no config, create a default RING account

+            while (true) {

+                DRing::pollEvents();

+                Sleep(1000);

             }

-        });

+            DRing::fini();

+        }

     });

 }

 

diff --git a/RingD.h b/RingD.h
index e049dd0..6556fa4 100644
--- a/RingD.h
+++ b/RingD.h
@@ -45,15 +45,17 @@
 

     /* properties */

 

+

     /* functions */

+

 internal:

     void startDaemon();

-    void stopDaemon();

+    bool hasConfig;

+    std::string accountName;

 

 private:

     RingD(); // singleton

     std::string localFolder_;

     bool daemonRunning_ = false;

-

 };

 }
\ No newline at end of file
diff --git a/Styles.xaml b/Styles.xaml
index 4afe023..9afeebe 100644
--- a/Styles.xaml
+++ b/Styles.xaml
@@ -1,6 +1,7 @@
 <!-- **********************************************************************

 * Copyright (C) 2016 by Savoir-faire Linux                                *

 * Author: Jäger Nicolas<nicolas.jager@savoirfairelinux.com>               *

+* Author: Traczyk Andreas<andreas.traczyk@savoirfairelinux.com>           *

 *                                                                         *

 * This program is free software; you can redistribute it and/or modify    *

 * it under the terms of the GNU General Public License as published by    *

@@ -82,7 +83,7 @@
     <Style x:Key="ButtonStyle2"

         TargetType="Button">

         <Setter Property="Width"

-            Value="50"/>

+            Value="400"/>

         <Setter Property="Height"

             Value="30"/>

         <Setter Property="FontFamily"

@@ -107,6 +108,13 @@
         <Setter Property="FontSize"

                 Value="70"/>

     </Style>

+    <Style x:Key="ButtonStyle4"

+           TargetType="Button">

+        <Setter Property="Foreground"

+                Value="White"/>

+        <Setter Property="Background"

+                Value="LightBlue"/>

+    </Style>

     <Style x:Key="ToggleButtonStyle1"

            TargetType="ToggleButton">

         <Setter Property="Width"

diff --git a/Wizard.xaml b/Wizard.xaml
new file mode 100644
index 0000000..372beea
--- /dev/null
+++ b/Wizard.xaml
@@ -0,0 +1,144 @@
+<Page

+    x:Class="RingClientUWP.Views.Wizard"

+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

+    xmlns:local="using:RingClientUWP"

+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

+    mc:Ignorable="d">

+

+    <Grid>

+        <Grid.RowDefinitions>

+            <RowDefinition Height="32"/>

+            <RowDefinition Height="*"/>

+        </Grid.RowDefinitions>

+        <Rectangle Fill="LightBlue"

+                   Grid.Row="0"/>

+        <StackPanel Grid.Row="1" Width="400">

+            <Rectangle Height="50"/>

+            <StackPanel Height="auto"

+                        Background="LightBlue"

+                        Grid.Column="0">

+                <TextBlock x:Name="_showCreateAccountMenuTitle_"

+                           Text="Create New Account"

+                           Foreground="White"

+                           FontSize="30"

+                           HorizontalAlignment="Center"/>

+                <Button x:Name="_showCreateAccountMenuBtn_"

+                        Content="Create New Account"

+                        Visibility="Collapsed"

+                        HorizontalAlignment="Center"

+                        Style="{StaticResource ButtonStyle4}"

+                        Click="_showCreateAccountMenuBtn__Click"/>

+                <Grid x:Name="_accountCreationMenuGrid_"

+                      Background="LightBlue"

+                      Visibility="Visible">

+                    <Grid.RowDefinitions>

+                        <RowDefinition Height="auto"/>

+                        <RowDefinition Height="30"/>

+                    </Grid.RowDefinitions>

+                    <StackPanel Orientation="Vertical"

+                            Grid.Row="0"

+                            Background="#FFE4F1F9">

+                        <Button  x:Name="_avatarWebcamCaptureBtn_"

+                                 Margin="0,10,0,0"

+                                 VerticalAlignment="Center"

+                                 Content="&#xE8B8;"

+                                 Style="{StaticResource ButtonStyle3}"

+                                 HorizontalAlignment="Center"/>

+                        <!-- RING account. -->

+                        <StackPanel x:Name="_ringAccountCreationStack_"

+                                    Visibility="Visible">

+                            <TextBox x:Name="_aliasTextBox_"

+                                     Margin="10"

+                                     PlaceholderText="Enter your username"/>

+                            <PasswordBox Margin="10"

+                                         PlaceholderText="Enter your password"/>

+                            <PasswordBox  Margin="10,10,10,20"

+                                          PlaceholderText="Repeat your Password"/>

+                        </StackPanel>

+                        <!-- SIP account. -->

+                        <StackPanel x:Name="_sipAccountCreationStack_"

+                                    Visibility="Collapsed">

+                            <TextBox Margin="10"

+                                     PlaceholderText="Enter hostname"/>

+                            <TextBox Margin="10"

+                                     PlaceholderText="Enter your username"/>

+                            <PasswordBox Margin="10"

+                                         PlaceholderText="Enter your password"/>

+                            <PasswordBox Margin="10"

+                                         PlaceholderText="Repeat your Password"/>

+                        </StackPanel>

+                    </StackPanel>

+                    <!-- buttons yes/no to create the new account. -->

+                    <Grid Grid.Row="1">

+                        <StackPanel Orientation="Horizontal"

+                                    HorizontalAlignment="Center">

+                            <Button x:Name="_createAccountYes_"

+                                    Grid.Row="1"

+                                    VerticalAlignment="Center"

+                                    HorizontalAlignment="Center"

+                                    Content="&#xE081;"

+                                    Click="_createAccountYes__Click"

+                                    Style="{StaticResource ButtonStyle2}"/>

+                        </StackPanel>

+                    </Grid>

+                </Grid>

+            </StackPanel>

+            <Rectangle Height="50"/>

+            <!-- add account. -->

+            <StackPanel Height="auto"

+                        Background="LightBlue"

+                        Grid.Column="2">

+                <TextBlock x:Name="_showAddAccountMenuTitle_"

+                           Text="Add Existing Account"

+                           Foreground="White"

+                           Visibility="Collapsed"

+                           FontSize="30"

+                           HorizontalAlignment="Center"/>

+                <Button x:Name="_showAddAccountMenuBtn_"

+                        Visibility="Visible"

+                        Content="Add Existing Account"

+                        HorizontalAlignment="Center"

+                        Style="{StaticResource ButtonStyle4}"

+                        Click="_showAddAccountMenuBtn__Click"/>

+                <Grid x:Name="_accountAddMenuGrid_"

+                      Visibility="Collapsed"

+                      Background="LightBlue">

+                    <Grid.RowDefinitions>

+                        <RowDefinition Height="auto"/>

+                        <RowDefinition Height="30"/>

+                    </Grid.RowDefinitions>

+                    <!-- add account. -->

+                    <StackPanel Background="#FFE4F1F9">

+                        <TextBox  x:Name="_PINTextBox_"

+                                  Margin="10"

+                                  PlaceholderText="Enter PIN"/>

+                        <PasswordBox Margin="10"

+                                 PlaceholderText="Enter your password"/>

+                    </StackPanel>

+                    <!-- buttons yes/no to add the account. -->

+                    <Grid Grid.Row="1">

+                        <StackPanel Orientation="Horizontal"

+                                HorizontalAlignment="Center">

+                            <Button x:Name="_addAccountYes_"

+                                Grid.Row="1"

+                                VerticalAlignment="Center"

+                                HorizontalAlignment="Center"

+                                Content="&#xE081;"

+                                Style="{StaticResource ButtonStyle2}"/>

+                        </StackPanel>

+                    </Grid>

+                </Grid>

+            </StackPanel>

+        <!--</Grid>-->

+        </StackPanel>

+    </Grid>

+

+

+

+

+

+

+

+</Page>

diff --git a/Wizard.xaml.cpp b/Wizard.xaml.cpp
new file mode 100644
index 0000000..ec0f977
--- /dev/null
+++ b/Wizard.xaml.cpp
@@ -0,0 +1,65 @@
+#include "pch.h"
+
+#include "Wizard.xaml.h"
+
+#include "MainPage.xaml.h"
+
+using namespace RingClientUWP::Views;
+
+using namespace Concurrency;
+using namespace Platform;
+using namespace Windows::Devices::Enumeration;
+using namespace Windows::Foundation;
+using namespace Windows::Foundation::Collections;
+using namespace Windows::UI::Xaml;
+using namespace Windows::UI::Xaml::Controls;
+using namespace Windows::UI::Xaml::Controls::Primitives;
+using namespace Windows::UI::Xaml::Data;
+using namespace Windows::UI::Xaml::Input;
+using namespace Windows::UI::Xaml::Media;
+using namespace Windows::UI::Xaml::Navigation;
+using namespace Windows::Media::Capture;
+
+Wizard::Wizard()
+{
+    InitializeComponent();
+}
+
+void
+Wizard::_createAccountYes__Click(Object^ sender, RoutedEventArgs^ e)
+{
+    auto alias = _aliasTextBox_->Text;
+    if (alias->IsEmpty())
+        alias = "windows user";
+    std::wstring wstr(alias->Begin());
+    std::string str(wstr.begin(), wstr.end());
+    RingD::instance->hasConfig = false;

+    RingD::instance->accountName = std::string(wstr.begin(), wstr.end());

+    this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new Windows::UI::Core::DispatchedHandler([this] () {

+        this->Frame->Navigate(Windows::UI::Xaml::Interop::TypeName(RingClientUWP::MainPage::typeid));

+    }));
+}
+
+void
+Wizard::_showCreateAccountMenuBtn__Click(Object^ sender, RoutedEventArgs^ e)
+{
+    _accountAddMenuGrid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
+    _showAddAccountMenuTitle_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
+    _showAddAccountMenuBtn_->Visibility = Windows::UI::Xaml::Visibility::Visible;
+
+    _accountCreationMenuGrid_->Visibility = Windows::UI::Xaml::Visibility::Visible;
+    _showCreateAccountMenuTitle_->Visibility = Windows::UI::Xaml::Visibility::Visible;
+    _showCreateAccountMenuBtn_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
+}
+
+void
+Wizard::_showAddAccountMenuBtn__Click(Object^ sender, RoutedEventArgs^ e)
+{
+    _accountCreationMenuGrid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
+    _showCreateAccountMenuTitle_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
+    _showCreateAccountMenuBtn_->Visibility = Windows::UI::Xaml::Visibility::Visible;
+
+    _accountAddMenuGrid_->Visibility = Windows::UI::Xaml::Visibility::Visible;
+    _showAddAccountMenuTitle_->Visibility = Windows::UI::Xaml::Visibility::Visible;
+    _showAddAccountMenuBtn_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
+}
\ No newline at end of file
diff --git a/Wizard.xaml.h b/Wizard.xaml.h
new file mode 100644
index 0000000..70792c5
--- /dev/null
+++ b/Wizard.xaml.h
@@ -0,0 +1,21 @@
+#pragma once

+

+#include "Wizard.g.h"

+

+namespace RingClientUWP

+{

+namespace Views

+{

+

+public ref class Wizard sealed

+{

+public:

+    Wizard();

+private:

+    void _createAccountYes__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);

+    void _showCreateAccountMenuBtn__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);

+    void _showAddAccountMenuBtn__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);

+};

+

+}

+}
\ No newline at end of file
diff --git a/ring-client-uwp.vcxproj b/ring-client-uwp.vcxproj
index 922bb4a..091de7b 100644
--- a/ring-client-uwp.vcxproj
+++ b/ring-client-uwp.vcxproj
@@ -162,6 +162,9 @@
     <ClInclude Include="AccountsViewModel.h" />

     <ClInclude Include="Contact.h" />

     <ClInclude Include="ContactsViewModel.h" />

+    <ClInclude Include="LoadingPage.xaml.h">

+      <DependentUpon>LoadingPage.xaml</DependentUpon>

+    </ClInclude>

     <ClInclude Include="MessageTextPage.xaml.h">

       <DependentUpon>MessageTextPage.xaml</DependentUpon>

     </ClInclude>

@@ -187,11 +190,15 @@
     <ClInclude Include="WelcomePage.xaml.h">

       <DependentUpon>WelcomePage.xaml</DependentUpon>

     </ClInclude>

+    <ClInclude Include="Wizard.xaml.h">

+      <DependentUpon>Wizard.xaml</DependentUpon>

+    </ClInclude>

   </ItemGroup>

   <ItemGroup>

     <ApplicationDefinition Include="App.xaml">

       <SubType>Designer</SubType>

     </ApplicationDefinition>

+    <Page Include="LoadingPage.xaml" />

     <Page Include="MainPage.xaml">

       <SubType>Designer</SubType>

     </Page>

@@ -201,6 +208,7 @@
     <Page Include="Styles.xaml" />

     <Page Include="VideoPage.xaml" />

     <Page Include="WelcomePage.xaml" />

+    <Page Include="Wizard.xaml" />

   </ItemGroup>

   <ItemGroup>

     <AppxManifest Include="Package.appxmanifest">

@@ -249,6 +257,9 @@
     </ClCompile>

     <ClCompile Include="Contact.cpp" />

     <ClCompile Include="ContactsViewModel.cpp" />

+    <ClCompile Include="LoadingPage.xaml.cpp">

+      <DependentUpon>LoadingPage.xaml</DependentUpon>

+    </ClCompile>

     <ClCompile Include="MainPage.xaml.cpp">

       <DependentUpon>MainPage.xaml</DependentUpon>

     </ClCompile>

@@ -277,6 +288,9 @@
     <ClCompile Include="WelcomePage.xaml.cpp">

       <DependentUpon>WelcomePage.xaml</DependentUpon>

     </ClCompile>

+    <ClCompile Include="Wizard.xaml.cpp">

+      <DependentUpon>Wizard.xaml</DependentUpon>

+    </ClCompile>

   </ItemGroup>

   <ItemGroup>

     <PRIResource Include="localization\Fr-fr\Resources.resw" />

diff --git a/ring-client-uwp.vcxproj.filters b/ring-client-uwp.vcxproj.filters
index c8f7a7c..3e2c984 100644
--- a/ring-client-uwp.vcxproj.filters
+++ b/ring-client-uwp.vcxproj.filters
@@ -170,6 +170,10 @@
     <Page Include="MessageTextPage.xaml">

       <Filter>Views</Filter>

     </Page>

+    <Page Include="LoadingPage.xaml">

+      <Filter>Views</Filter>

+    </Page>

+    <Page Include="Wizard.xaml" />

   </ItemGroup>

   <ItemGroup>

     <PRIResource Include="localization\US-en\Resources.resw">