Commit 598aee23 authored by Nicolas Jager's avatar Nicolas Jager

wizard : adds ethereum

- allows to perform lookups on nameservice.
- allows to register on nameservice.

Change-Id: I81a790cebc91ed5c27c828fda0f5f6eadbc82c1a
Tuleap: #790
parent acc4c413
......@@ -23,6 +23,7 @@
#include "ObjBase.h" // for CoCreateGuid
#include "fileutils.h"
#include "direct.h"
using namespace Windows::ApplicationModel::Core;
using namespace Platform;
......@@ -155,7 +156,7 @@ Contact::saveConversationToFile()
StorageFolder^ localfolder = ApplicationData::Current->LocalFolder;
String^ messagesFile = localfolder->Path + "\\" + ".messages\\" + GUID_ + ".json";
if (ring::fileutils::recursive_mkdir(Utils::toString(localfolder->Path + "\\" + ".messages\\").c_str())) {
if (_mkdir(Utils::toString(localfolder->Path + "\\" + ".messages\\").c_str())) {
std::ofstream file(Utils::toString(messagesFile).c_str());
if (file.is_open())
{
......
......@@ -12,4 +12,11 @@ public enum class CallStatus {
TERMINATING
};
public enum class LookupStatus {
SUCCESS,
INVALID_NAME,
NOT_FOUND,
ERRORR // one cannot simply use ERROR
};
}
\ No newline at end of file
......@@ -85,11 +85,11 @@ MainPage::MainPage()
Platform::Object^>(this, &MainPage::DisplayProperties_DpiChanged));
visibilityChangedEventToken = Window::Current->VisibilityChanged +=
ref new WindowVisibilityChangedEventHandler(this, &MainPage::Application_VisibilityChanged);
ref new WindowVisibilityChangedEventHandler(this, &MainPage::Application_VisibilityChanged);
applicationSuspendingEventToken = Application::Current->Suspending +=
ref new SuspendingEventHandler(this, &MainPage::Application_Suspending);
ref new SuspendingEventHandler(this, &MainPage::Application_Suspending);
applicationResumingEventToken = Application::Current->Resuming +=
ref new EventHandler<Object^>(this, &MainPage::Application_Resuming);
ref new EventHandler<Object^>(this, &MainPage::Application_Resuming);
}
void
......@@ -404,9 +404,9 @@ MainPage::BeginExtendedExecution()
newSession->Reason = ExtendedExecutionReason::SavingData;
newSession->Description = "Extended Execution";
sessionRevokedToken = (newSession->Revoked += ref new TypedEventHandler<Object^,
ExtendedExecutionRevokedEventArgs^>(this, &MainPage::SessionRevoked));
ExtendedExecutionRevokedEventArgs^>(this, &MainPage::SessionRevoked));
return create_task(newSession->RequestExtensionAsync())
.then([=](ExtendedExecutionResult result){
.then([=](ExtendedExecutionResult result) {
try {
switch (result)
{
......
......@@ -18,6 +18,8 @@
**************************************************************************/
#include "pch.h"
/* daemon */
#include <dring.h>
#include "callmanager_interface.h"
#include "configurationmanager_interface.h"
#include "presencemanager_interface.h"
......@@ -185,7 +187,7 @@ void RingClientUWP::RingD::sendSIPTextMessage(String^ message)
}
void
RingD::createRINGAccount(String^ alias, String^ archivePassword, bool upnp)
RingD::createRINGAccount(String^ alias, String^ archivePassword, bool upnp, String^ registeredName)
{
editModeOn_ = true;
......@@ -197,6 +199,7 @@ RingD::createRINGAccount(String^ alias, String^ archivePassword, bool upnp)
task->_alias = alias;
task->_password = archivePassword;
task->_upnp = upnp;
task->_registeredName = registeredName;
tasksList_.push(task);
}
......@@ -511,24 +514,6 @@ RingD::registerCallbacks()
ref new DispatchedHandler([=]() {
RingDebug::instance->print(toto);
}));
}),
DRing::exportable_callback<DRing::ConfigurationSignal::KnownDevicesChanged>([&](const std::string& accountId, const std::map<std::string, std::string>& devices)
{
dispatcher->RunAsync(CoreDispatcherPriority::High,
ref new DispatchedHandler([=]() {
RingDebug::instance->print("KnownDevicesChanged ---> C PAS FINI");
}));
}),
DRing::exportable_callback<DRing::ConfigurationSignal::ExportOnRingEnded>([&](const std::string& accountId, int status, const std::string& pin)
{
auto accountId2 = Utils::toPlatformString(accountId);
auto pin2 = (pin.empty()) ? "Error bad password" : "Your generated pin : " + Utils::toPlatformString(pin);
dispatcher->RunAsync(CoreDispatcherPriority::High,
ref new DispatchedHandler([=]() {
exportOnRingEnded(accountId2, pin2);
}));
})
};
registerCallHandlers(callHandlers);
......@@ -646,14 +631,43 @@ RingD::registerCallbacks()
nameRegistrationHandlers =
{
DRing::exportable_callback<DRing::ConfigurationSignal::NameRegistrationEnded>(
[this](const std::string &accountId, int status, const std::string &name) {
MSG_("\n<NameRegistrationEnded>\n");
DRing::exportable_callback<DRing::ConfigurationSignal::KnownDevicesChanged>([&](const std::string& accountId, const std::map<std::string, std::string>& devices)
{
dispatcher->RunAsync(CoreDispatcherPriority::High,
ref new DispatchedHandler([=]() {
RingDebug::instance->print("KnownDevicesChanged ---> C PAS FINI");
}));
}),
DRing::exportable_callback<DRing::ConfigurationSignal::ExportOnRingEnded>([&](const std::string& accountId, int status, const std::string& pin)
{
auto accountId2 = Utils::toPlatformString(accountId);
auto pin2 = (pin.empty()) ? "Error bad password" : "Your generated pin : " + Utils::toPlatformString(pin);
dispatcher->RunAsync(CoreDispatcherPriority::High,
ref new DispatchedHandler([=]() {
exportOnRingEnded(accountId2, pin2);
}));
}),
DRing::exportable_callback<DRing::ConfigurationSignal::RegisteredNameFound>(
[this](const std::string &accountId, int status, const std::string &address, const std::string &name) {
MSG_("<RegisteredNameFound>" + name + " : " + address);
//MSG_("<RegisteredNameFound>" + name + " : " + address + " status=" +std::to_string(status));
CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(CoreDispatcherPriority::Normal,
ref new DispatchedHandler([=]() {
switch (status)
{
case 0: // everything went fine. Name/address pair was found.
registeredNameFound(LookupStatus::SUCCESS);
break;
case 1: // provided name is not valid.
registeredNameFound(LookupStatus::INVALID_NAME);
break;
case 2: // everything went fine. Name/address pair was not found.
registeredNameFound(LookupStatus::NOT_FOUND);
break;
case 3: // An error happened
registeredNameFound(LookupStatus::ERRORR);
break;
}
}));
})
};
registerConfHandlers(nameRegistrationHandlers);
......@@ -732,7 +746,7 @@ RingD::startDaemon()
}
});
while (daemonRunning_) {
while (daemonRunning) {
DRing::pollEvents();
dequeueTasks();
Sleep(5);
......@@ -767,7 +781,14 @@ RingD::dequeueTasks()
ringAccountDetails.insert(std::make_pair(DRing::Account::ConfProperties::TYPE,"RING"));
ringAccountDetails.insert(std::make_pair(DRing::Account::ConfProperties::UPNP_ENABLED
, (task->_upnp)? ring::TRUE_STR : ring::FALSE_STR));
DRing::addAccount(ringAccountDetails);
ringAccountDetails.insert(std::make_pair(DRing::Account::VolatileProperties::REGISTERED_NAME
, Utils::toString(task->_registeredName)));
auto newAccountId = DRing::addAccount(ringAccountDetails);
if (!task->_registeredName->IsEmpty())
registerName_new(newAccountId, Utils::toString(task->_password), Utils::toString(task->_alias));
}
break;
case Request::AddSIPAccount:
......@@ -906,6 +927,37 @@ RingD::dequeueTasks()
bool muted = task->_muted;
DRing::muteLocalMedia(callId, DRing::Media::Details::MEDIA_TYPE_VIDEO, muted);
}
case Request::LookUpName:
{
auto alias = task->_alias;
DRing::lookupName("", "", Utils::toString(alias));
break;
}
case Request::LookUpAddress:
{
//DRing::lookupAddress(accountID.toStdString(), nameServiceURL.toStdString(), address.toStdString());
break;
}
case Request::RegisterName:
{
auto accountDetails = DRing::getAccountDetails(task->_accountId_new);
if (accountDetails[DRing::Account::ConfProperties::USERNAME].empty())
registerName_new(task->_accountId_new, task->_password_new, task->_publicUsername_new);
else
DRing::registerName(task->_accountId_new, task->_password_new, task->_publicUsername_new);
//const wchar_t* toto = task->_accountId->Data();
//auto accountId = ref new String(toto);// Utils::toString(task->_accountId);
//auto accountDetails = DRing::getAccountDetails(Utils::toString(accountId));
//if (accountDetails[DRing::Account::ConfProperties::USERNAME].empty())
// registerName(task->_accountId, task->_password, task->_registeredName);
//else
// DRing::registerName(Utils::toString(task->_accountId), Utils::toString(task->_password), Utils::toString(task->_registeredName));
break;
}
default:
break;
}
......@@ -959,6 +1011,55 @@ void RingClientUWP::RingD::muteVideo(String ^ callId, bool muted)
tasksList_.push(task);
}
void RingClientUWP::RingD::lookUpName(String ^ name)
{
auto task = ref new RingD::Task(Request::LookUpName);
task->_alias = name;
tasksList_.push(task);
}
void
RingD::registerName(String^ accountId, String^ password, String^ username)
{
auto task = ref new RingD::Task(Request::RegisterName);
task->_accountId = ref new String(accountId->Data());
task->_password = password;
task->_alias = username;
tasksList_.push(task);
}
void RingClientUWP::RingD::registerName_new(const std::string & accountId, const std::string & password, const std::string & username)
{
auto task = ref new RingD::Task(Request::RegisterName);
task->_accountId_new = accountId;
task->_password_new = password;
task->_publicUsername_new = username;
tasksList_.push(task);
}
std::map<std::string, std::string>
RingClientUWP::RingD::getVolatileAccountDetails(Account^ account)
{
return DRing::getVolatileAccountDetails(Utils::toString(account->accountID_));
}
void RingClientUWP::RingD::lookUpAddress(String^ address)
{
auto task = ref new RingD::Task(Request::LookUpAddress);
task->_address = address;
tasksList_.push(task);
}
std::string RingClientUWP::RingD::registeredName(Account^ account)
{
auto volatileAccountDetails = DRing::getVolatileAccountDetails(Utils::toString(account->accountID_));
return volatileAccountDetails[DRing::Account::VolatileProperties::REGISTERED_NAME];
}
RingClientUWP::CallStatus RingClientUWP::RingD::translateCallStatus(String^ state)
{
if (state == "INCOMING")
......
......@@ -38,6 +38,7 @@ delegate void ExportOnRingEnded(String^ accountId, String^ pin);
delegate void SummonWizard();
delegate void AccountUpdated(Account^ account);
delegate void IncomingVideoMuted(String^ callId, bool state);
delegate void RegisteredNameFound(LookupStatus status);
delegate void FinishCaptureDeviceEnumeration();
using SharedCallback = std::shared_ptr<DRing::CallbackWrapperBase>;
......@@ -87,7 +88,7 @@ internal:
void reloadAccountList();
void sendAccountTextMessage(String^ message);
void sendSIPTextMessage(String^ message);
void createRINGAccount(String^ alias, String^ archivePassword, bool upnp);
void createRINGAccount(String^ alias, String^ archivePassword, bool upnp, String^ registeredName = "");
void createSIPAccount(String^ alias, String^ sipPassword, String^ sipHostname, String^ sipusername);
void refuseIncommingCall(String^ call);
void acceptIncommingCall(String^ call);
......@@ -110,6 +111,12 @@ internal:
void killCall(String^ callId);
void switchDebug();
void muteVideo(String^ callId, bool muted);
void lookUpName(String^ name);
void registerName(String^ accountId, String^ password, String^ username);
void registerName_new(const std::string& accountId, const std::string& password, const std::string& username);
std::map<std::string, std::string> getVolatileAccountDetails(Account^ account);
void lookUpAddress(String^ address);
std::string registeredName(Account^ account);
/* TODO : move members */
String ^ currentCallId; // to save ongoing call id during visibility change
......@@ -125,6 +132,7 @@ internal:
event SummonWizard^ summonWizard;
event AccountUpdated^ accountUpdated;
event IncomingVideoMuted^ incomingVideoMuted;
event RegisteredNameFound^ registeredNameFound;
event FinishCaptureDeviceEnumeration^ finishCaptureDeviceEnumeration;
private:
......@@ -147,7 +155,10 @@ private:
GetCallsList,
KillCall,
switchDebug,
MuteVideo
MuteVideo,
LookUpName,
LookUpAddress,
RegisterName
};
......@@ -180,6 +191,13 @@ private:
property String^ _sipHostname;
property String^ _sipUsername;
property bool _muted;
property String^ _registeredName; // public username
property String^ _address; // ringId
internal:
std::string _accountId_new;
std::string _password_new;
std::string _publicUsername_new;
};
/* functions */
......@@ -204,4 +222,4 @@ private:
std::map<std::string, SharedCallback> outgoingVideoHandlers;
std::map<std::string, SharedCallback> nameRegistrationHandlers;
};
}
\ No newline at end of file
}
......@@ -75,4 +75,4 @@ void RingClientUWP::RingDebug::WriteLine(String^ str)
RingClientUWP::RingDebug::RingDebug()
{
}
\ No newline at end of file
}
This diff is collapsed.
This diff is collapsed.
......@@ -126,6 +126,8 @@ private:
void populateVideoDeviceSettingsComboBox();
void populateVideoResolutionSettingsComboBox();
void populateVideoRateSettingsComboBox();
void checkStateAddAccountMenu();
void checkStateEditionMenu();
/* members */
void _devicesMenuButton__Unchecked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
......@@ -143,12 +145,20 @@ private:
void OnaccountUpdated(RingClientUWP::Account ^account);
void _passwordBoxAccountCreationCheck__PasswordChanged(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _accountTypeComboBox__SelectionChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e);
void _ringAliasTextBox__TextChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::TextChangedEventArgs^ e);
void _accountAliasTextBox__TextChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::TextChangedEventArgs^ e);
void _accountAliasTextBoxEdition__TextChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::TextChangedEventArgs^ e);
void _selectedAccountAvatarContainer__PointerEntered(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e);
void _selectedAccountAvatarContainer__PointerReleased(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e);
void _selectedAccountAvatarContainer__PointerExited(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e);
void _smartList__PointerExited(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e);
void Grid_PointerMoved(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e);
void _registerOnBlockchainEdition__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _usernameTextBoxEdition__KeyUp(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e);
void OnregisteredNameFound(RingClientUWP::LookupStatus status);
void _RegisterState__Toggled(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _usernameTextBox__KeyUp(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e);
void _deleteAccountEdition__Toggled(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _RegisterStateEdition__Toggled(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
};
}
}
\ No newline at end of file
}
......@@ -117,6 +117,21 @@
<Setter Property="Foreground"
Value="Black"/>
</Style>
<Style x:Key="TextSegoeStyle-24pt-black"
TargetType="TextBlock">
<Setter Property="FontFamily"
Value="Segoe MDL2 Assets"/>
<Setter Property="FontSize"
Value="24"/>
<Setter Property="HorizontalAlignment"
Value="Left"/>
<Setter Property="VerticalAlignment"
Value="Bottom"/>
<Setter Property="Foreground"
Value="Black"/>
<Setter Property="Margin"
Value="0,0,10,0"/>
</Style>
<Style x:Key="TextSegoeStyle-Centered-40pt-white"
TargetType="TextBlock">
<Setter Property="FontFamily"
......@@ -130,6 +145,32 @@
<Setter Property="Foreground"
Value="White"/>
</Style>
<Style x:Key="TextSegoeStyle-20pt-green"
TargetType="TextBlock">
<Setter Property="HorizontalAlignment"
Value="Center"/>
<Setter Property="FontFamily"
Value="Segoe MDL2 Assets"/>
<Setter Property="VerticalAlignment"
Value="Center"/>
<Setter Property="Foreground"
Value="Green"/>
<Setter Property="FontSize"
Value="20"/>
</Style>
<Style x:Key="TextSegoeStyle-20pt-red"
TargetType="TextBlock">
<Setter Property="HorizontalAlignment"
Value="Center"/>
<Setter Property="FontFamily"
Value="Segoe MDL2 Assets"/>
<Setter Property="VerticalAlignment"
Value="Center"/>
<Setter Property="Foreground"
Value="Red"/>
<Setter Property="FontSize"
Value="20"/>
</Style>
<Style x:Key="ButtonStyle1"
TargetType="Button">
<Setter Property="Width"
......
This diff is collapsed.
......@@ -4,6 +4,8 @@
#include "MainPage.xaml.h"
#include "gnutls\gnutls.h"
using namespace RingClientUWP::Views;
using namespace Concurrency;
......@@ -26,17 +28,28 @@ using namespace Windows::UI::Xaml::Shapes;
Wizard::Wizard()
{
InitializeComponent();
/* connect to delegates */
RingD::instance->registeredNameFound += ref new RingClientUWP::RegisteredNameFound(this, &RingClientUWP::Views::Wizard::OnregisteredNameFound);
}
void RingClientUWP::Views::Wizard::OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs ^ e)
{
gnutls_global_init();
RingD::instance->registerCallbacks();
RingD::instance->initDaemon( DRing::DRING_FLAG_CONSOLE_LOG | DRing::DRING_FLAG_DEBUG );
Video::VideoManager::instance->captureManager()->EnumerateWebcamsAsync();
}
void
Wizard::_createAccountYes__Click(Object^ sender, RoutedEventArgs^ e)
{
auto alias = _aliasTextBox_->Text;
RingD::instance->_startingStatus = StartingStatus::REGISTERING_ON_THIS_PC;
//RingD::instance->_startingStatus = StartingStatus::REGISTERING_ON_THIS_PC;
this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::High, ref new Windows::UI::Core::DispatchedHandler([this] () {
this->Frame->Navigate(Windows::UI::Xaml::Interop::TypeName(RingClientUWP::MainPage::typeid));
RingD::instance->createRINGAccount(_aliasTextBox_->Text, _password_->Password, true);
RingD::instance->createRINGAccount(_fullnameTextBox_->Text
, _password_->Password
, true // upnp by default set to true
, (_RegisterState_->IsOn)? _usernameTextBox_->Text : "");
_password_->Password = "";
}));
}
......@@ -126,11 +139,172 @@ void RingClientUWP::Views::Wizard::_addAccountYes__Click(Platform::Object^ sende
}));
}
void RingClientUWP::Views::Wizard::_password__PasswordChanged(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
isPasswordValid = (_password_->Password->Length() > 0)
? true : false;
if (isPasswordValid) {
_createAccountYes_->IsEnabled = true;
_passwordValid_->Visibility = Windows::UI::Xaml::Visibility::Visible;
_passwordInvalid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
} else {
_createAccountYes_->IsEnabled = false;
_passwordValid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_passwordInvalid_->Visibility = Windows::UI::Xaml::Visibility::Visible;
}
isPasswordsMatching = (_password_->Password
== _passwordCheck_->Password
&& _password_->Password->Length() > 0)
? true : false;
void RingClientUWP::Views::Wizard::validatePassword(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
if (isPasswordsMatching) {
_passwordCheckValid_->Visibility = Windows::UI::Xaml::Visibility::Visible;
_passwordCheckInvalid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
}
else {
_passwordCheckValid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_passwordCheckInvalid_->Visibility = Windows::UI::Xaml::Visibility::Visible;
}
checkState();
}
void RingClientUWP::Views::Wizard::_passwordCheck__PasswordChanged(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
_createAccountYes_->IsEnabled = (_password_->Password
== _passwordCheck_->Password
&& _password_->Password->Length() > 0)
? true : false;
isPasswordsMatching = (_password_->Password
== _passwordCheck_->Password
&& _password_->Password->Length() > 0)
? true : false;
if (isPasswordsMatching) {
_passwordCheckValid_->Visibility = Windows::UI::Xaml::Visibility::Visible;
_passwordCheckInvalid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
}
else {
_passwordCheckValid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_passwordCheckInvalid_->Visibility = Windows::UI::Xaml::Visibility::Visible;
}
checkState();
}
void RingClientUWP::Views::Wizard::checkState()
{
if ((isPublic && isPasswordValid && isPasswordsMatching && isUsernameValid && isFullNameValid)
||(!isPublic && isPasswordValid && isPasswordsMatching && isFullNameValid))
_createAccountYes_->IsEnabled = true;
else
_createAccountYes_->IsEnabled = false;
}
void RingClientUWP::Views::Wizard::_usernameTextBox__KeyUp(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e)
{
auto alias = dynamic_cast<TextBox^>(sender)->Text;
if (alias->IsEmpty()) {
_usernameValid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_usernameInvalid_->Visibility = Windows::UI::Xaml::Visibility::Visible;
} else {
RingD::instance->lookUpName(alias);
_usernameValid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_usernameInvalid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
}
// checkState(); is made in OnregisteredNameFound
}
void RingClientUWP::Views::Wizard::_RegisterState__Toggled(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
auto toggleSwitch = dynamic_cast<ToggleSwitch^>(sender);
if (_usernameTextBox_ == nullptr) // avoid trouble when InitializeComponent is called for Wizard.
return;
isPublic = toggleSwitch->IsOn;
if (isPublic) {
_usernameTextBox_->IsEnabled = true;
_whatWilHappen_->Text = "peoples will find you with your username.";
} else {
_usernameTextBox_->IsEnabled = false;
_whatWilHappen_->Text = "you'll have to send your ringId.";
}
checkState();
}
void RingClientUWP::Views::Wizard::_fullnameTextBox__KeyUp(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e)
{
isFullNameValid = !_fullnameTextBox_->Text->IsEmpty();
if (isFullNameValid) {
_fullnameValid_->Visibility = Windows::UI::Xaml::Visibility::Visible;
_fullnameInvalid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
} else {
_fullnameValid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_fullnameInvalid_->Visibility = Windows::UI::Xaml::Visibility::Visible;
}
checkState();
}
void RingClientUWP::Views::Wizard::collapseMenus(Platform::Object^ sender, Windows::UI::Xaml::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::Collapsed;
_showCreateAccountMenuTitle_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_showCreateAccountMenuBtn_->Visibility = Windows::UI::Xaml::Visibility::Visible;
}
void RingClientUWP::Views::Wizard::_step1button__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
_step1Menu_->Visibility = Windows::UI::Xaml::Visibility::Visible;
_step2Menu_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_nextstep_->Visibility = Windows::UI::Xaml::Visibility::Visible;
_addAccountYes_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
}
void RingClientUWP::Views::Wizard::_step2button__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
_step1Menu_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_step2Menu_->Visibility = Windows::UI::Xaml::Visibility::Visible;
_nextstep_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_addAccountYes_->Visibility = Windows::UI::Xaml::Visibility::Visible;
}
void RingClientUWP::Views::Wizard::OnregisteredNameFound(LookupStatus status)
{
switch (status)
{
case LookupStatus::SUCCESS:
_usernameValid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_usernameInvalid_->Visibility = Windows::UI::Xaml::Visibility::Visible;
isUsernameValid = false;
break;
case LookupStatus::INVALID_NAME:
_usernameValid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_usernameInvalid_->Visibility = Windows::UI::Xaml::Visibility::Visible;
isUsernameValid = false;
break;
case LookupStatus::NOT_FOUND:
_usernameValid_->Visibility = Windows::UI::Xaml::Visibility::Visible;
_usernameInvalid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
isUsernameValid = true;
break;
case LookupStatus::ERRORR:
_usernameValid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_usernameInvalid_->Visibility = Windows::UI::Xaml::Visibility::Visible;
isUsernameValid = false;
break;
}
checkState();
}
......@@ -11,13 +11,33 @@ public ref class Wizard sealed
{
public:
Wizard();
protected:
virtual void OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override;
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);
void _avatarWebcamCaptureBtn__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _addAccountYes__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void validatePassword(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _usernameTextBox__KeyUp(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e);
void _RegisterState__Toggled(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _fullnameTextBox__KeyUp(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e);
void collapseMenus(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _step1button__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _step2button__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void OnregisteredNameFound(LookupStatus status);
void _password__PasswordChanged(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _passwordCheck__PasswordChanged(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void checkState();
/*members*/
bool isPasswordValid;
bool isPasswordsMatching;
bool isPublic = true;
bool isUsernameValid; // available
bool isFullNameValid;
};
}
......
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