Commit 61b28428 authored by atraczyk's avatar atraczyk Committed by Nicolas Jager

integrate wizard menu and add loadpage

Change-Id: I65fe90a2155966a2631c01ed00892070e8fc4456
parent 38ce9e8a
......@@ -17,6 +17,7 @@
**************************************************************************/
#include "pch.h"
#include "LoadingPage.xaml.h"
#include "MainPage.xaml.h"
using namespace Windows::ApplicationModel::Core;
......@@ -45,20 +46,16 @@ App::OnLaunched(LaunchActivatedEventArgs^ e)
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
<!-- **********************************************************************
* 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>
/**************************************************************************
* 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));
}));
}
});
}
#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
......@@ -98,3 +98,9 @@ RingClientUWP::MainPage::showFrame(Windows::UI::Xaml::Controls::Frame^ frame)
dynamic_cast<MessageTextPage^>(_messageTextFrame_->Content)->updatePageContent();
}
}
void
RingClientUWP::MainPage::OnNavigatedTo(NavigationEventArgs ^ e)
{
RingD::instance->startDaemon();
}
\ No newline at end of file
......@@ -31,6 +31,7 @@ public:
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);
......
<?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>
......
......@@ -33,9 +33,6 @@ using namespace Windows::UI::Core;
using namespace RingClientUWP;
CoreDispatcher^ g_dispatcher;
bool has_config;
void
DebugOutputWrapper(const std::string& str)
{
......@@ -45,19 +42,6 @@ DebugOutputWrapper(const std::string& str)
void
RingClientUWP::RingD::startDaemon()
{
g_dispatcher = CoreApplication::MainView->CoreWindow->Dispatcher;
Utils::fileExists(ApplicationData::Current->LocalFolder, ".config\\dring.yml")
.then([this](bool config_exists)
{
if (!config_exists) {
has_config = false;
}
else {
has_config = true;
}
})
.then([this]() {
create_task([&]()
{
using SharedCallback = std::shared_ptr<DRing::CallbackWrapperBase>;
......@@ -111,7 +95,7 @@ RingClientUWP::RingD::startDaemon()
std::map<std::string, SharedCallback> getAppPathHandler =
{
DRing::exportable_callback<DRing::ConfigurationSignal::GetAppDataPath>
([this](std::vector<std::string>* paths) {
([this](std::vector<std::string>* paths){
paths->emplace_back(localFolder_);
})
};
......@@ -126,13 +110,14 @@ RingClientUWP::RingD::startDaemon()
return;
}
else {
// if there is no config, create a default RING account
if (!has_config) {
if (!hasConfig)
{
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"));
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);
}
// if there is no config, create a default RING account
while (true) {
DRing::pollEvents();
Sleep(1000);
......@@ -140,7 +125,6 @@ RingClientUWP::RingD::startDaemon()
DRing::fini();
}
});
});
}
RingClientUWP::RingD::RingD()
......
......@@ -45,15 +45,17 @@ public:
/* 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
<!-- **********************************************************************
* 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"
......
<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>
#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
#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
......@@ -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" />
......
......@@ -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">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment