diff --git a/App.xaml.cpp b/App.xaml.cpp index 7239a55690bce11df7e47303ec00fce751b37381..bd5300b5aec0d822cf11583022a9f70275882c32 100644 --- a/App.xaml.cpp +++ b/App.xaml.cpp @@ -19,6 +19,7 @@ #include "LoadingPage.xaml.h" #include "MainPage.xaml.h" +#include "Wizard.xaml.h" using namespace Windows::ApplicationModel::Core; using namespace Windows::Foundation; @@ -35,6 +36,9 @@ using namespace RingClientUWP; App::App() { InitializeComponent(); // summon partial class, form generated files trough App.xaml + + /* connect to delegate */ + RingD::instance->summonWizard += ref new RingClientUWP::SummonWizard(this, &RingClientUWP::App::OnsummonWizard); } void @@ -59,4 +63,9 @@ App::OnLaunched(LaunchActivatedEventArgs^ e) ApplicationView::GetForCurrentView()->TitleBar->BackgroundColor = Colors::LightBlue; ApplicationView::GetForCurrentView()->TitleBar->ForegroundColor = Colors::White; ApplicationView::GetForCurrentView()->TitleBar->ButtonForegroundColor = Colors::White; -} \ No newline at end of file +} + +void RingClientUWP::App::OnsummonWizard() +{ + rootFrame->Navigate(Windows::UI::Xaml::Interop::TypeName(Views::Wizard::typeid)); +} diff --git a/App.xaml.h b/App.xaml.h index cdc1f267b748f0f058e3efcfd196725d13b38cc2..a638f50e5799d9ec3d27082033522cffc9dfef6c 100644 --- a/App.xaml.h +++ b/App.xaml.h @@ -33,5 +33,6 @@ internal: private: Frame^ rootFrame; + void OnsummonWizard(); }; } \ No newline at end of file diff --git a/RingD.cpp b/RingD.cpp index 814d080899f039d790deefcbe81daa21a6146122..a6d001fc2a83350f7b7f1e65d65fd5b96100dbe6 100644 --- a/RingD.cpp +++ b/RingD.cpp @@ -47,6 +47,13 @@ RingClientUWP::RingD::reloadAccountList() RingClientUWP::ViewModel::AccountsViewModel::instance->clearAccountList(); std::vector<std::string> accountList = DRing::getAccountList(); + + /* if for any reason there is no account at all, screen the wizard */ + if (accountList.size() == 0) { + summonWizard(); + return; + } + std::vector<std::string>::reverse_iterator rit = accountList.rbegin(); for (; rit != accountList.rend(); ++rit) { @@ -380,7 +387,7 @@ RingClientUWP::RingD::startDaemon() CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(CoreDispatcherPriority::High, ref new DispatchedHandler([=]() { reloadAccountList(); - std::vector<std::string> accountList = DRing::getAccountList(); + std::vector<std::string> accountList = DRing::getAccountList(); // refacto : there is already a callo to getAccountList in reloadAccountList auto last_id = accountList.back(); if (!account_id.compare(last_id)) { auto frame = dynamic_cast<Frame^>(Window::Current->Content); diff --git a/RingD.h b/RingD.h index b776f076411320eaba0319ebda35454e4e42b817..7c29da7ba2d0df82a14957649938e2b79c361107 100644 --- a/RingD.h +++ b/RingD.h @@ -34,6 +34,7 @@ delegate void CallPlaced(String^ callId); delegate void IncomingMessage(String^ callId, String^ payload); delegate void DevicesListRefreshed(Vector<String^>^ devicesList); delegate void ExportOnRingEnded(String^ accountId, String^ pin); +delegate void SummonWizard(); public ref class RingD sealed @@ -109,6 +110,7 @@ internal: event CallPlaced^ callPlaced; event DevicesListRefreshed^ devicesListRefreshed; event ExportOnRingEnded^ exportOnRingEnded; + event SummonWizard^ summonWizard; private: /* sub classes */