Commit 38dd4429 authored by Nicolas Jager's avatar Nicolas Jager

fix : multi device ui

Change-Id: Ib45aa0036febde4d117be67d426cfca5c1524117
Tulesp: #1220
parent 3f7f5533
......@@ -384,7 +384,7 @@ RingClientUWP::RingD::startDaemon()
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);
auto pin2 = (pin.empty()) ? "Error bad password" : "Your generated pin : " + Utils::toPlatformString(pin);
dispatcher->RunAsync(CoreDispatcherPriority::High,
ref new DispatchedHandler([=]() {
exportOnRingEnded(accountId2, pin2);
......@@ -611,6 +611,7 @@ RingD::dequeueTasks()
ref new DispatchedHandler([=]() {
devicesListRefreshed(devicesList2);
}));
break;
}
case Request::ExportOnRing:
{
......
......@@ -546,14 +546,23 @@
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<TextBlock Text="Device ID:"
Margin="10"
Grid.Row="0"
HorizontalAlignment="Center"/>
<TextBlock x:Name="_deviceId_"
Margin="10"
Text="[TEXT_MISSING]"
TextTrimming="CharacterEllipsis"
Grid.Row="1"
IsTextSelectionEnabled="True"
HorizontalAlignment="Center"/>
<TextBlock x:Name="_waitingDevicesList_"
Text="waiting for devices list..."
Grid.Row="2"
IsTextSelectionEnabled="True"
HorizontalAlignment="Center"/>
<ListBox x:Name="_devicesIdList_"
Visibility="Collapsed"
Grid.Row="2"/>
</Grid>
<Button x:Name="_addDevice_"
......@@ -632,7 +641,26 @@
Grid.Row="0"
Margin="10,10,0,10"/>
</Grid>
<Grid Grid.Row="1">
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Center">
<Button x:Name="_closePin_"
Grid.Row="1"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Content="&#xE081;"
Click="_closePin__Click"
Style="{StaticResource ButtonStyle5}"/>
</StackPanel>
</Grid>
</Grid>
</Grid>
<!-- smartList and settings. -->
<Grid Grid.Row="1">
......
......@@ -147,9 +147,6 @@ RingClientUWP::Views::SmartPanel::updatePageContent()
_devicesMenuButton_->Visibility = (account->accountType_ == "RING")
? Windows::UI::Xaml::Visibility::Visible
: Windows::UI::Xaml::Visibility::Collapsed;
RingD::instance->askToRefreshKnownDevices(name);
}
void RingClientUWP::Views::SmartPanel::_accountsMenuButton__Checked(Object^ sender, RoutedEventArgs^ e)
......@@ -498,11 +495,22 @@ void RingClientUWP::Views::SmartPanel::_devicesMenuButton__Unchecked(Platform::O
{
_devicesMenuGrid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_addingDeviceGrid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_waitingForPin_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_passwordForPinGenerator_->Password = "";
// refacto : do something better...
_waitingAndResult_->Text = "Exporting account on the Ring...";
}
void RingClientUWP::Views::SmartPanel::_devicesMenuButton__Checked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
_waitingDevicesList_->Visibility = Windows::UI::Xaml::Visibility::Visible;
_devicesIdList_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
auto accountId = AccountsViewModel::instance->selectedAccount->accountID_;
RingD::instance->askToRefreshKnownDevices(accountId);
_shareMenuGrid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_accountsMenuGrid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_accountCreationMenuGrid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
......@@ -517,13 +525,16 @@ void RingClientUWP::Views::SmartPanel::_addDevice__Click(Platform::Object^ sende
{
_devicesMenuGrid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_addingDeviceGrid_->Visibility = Windows::UI::Xaml::Visibility::Visible;
_closePin_->Visibility = Windows::UI::Xaml::Visibility::Visible;
}
void RingClientUWP::Views::SmartPanel::OndevicesListRefreshed(Platform::Collections::Vector<Platform::String ^, std::equal_to<Platform::String ^>, true> ^devicesList)
{
_waitingDevicesList_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
AccountsViewModel::instance->selectedAccount->_devicesIdList = devicesList;
_devicesIdList_->ItemsSource = devicesList;
_devicesIdList_->Visibility = Windows::UI::Xaml::Visibility::Visible;
}
......@@ -534,6 +545,10 @@ void RingClientUWP::Views::SmartPanel::_pinGeneratorYes__Click(Platform::Object^
auto accountId = AccountsViewModel::instance->selectedAccount->accountID_;
auto password = _passwordForPinGenerator_->Password;
_passwordForPinGenerator_->Password = "";
/* hide the button while we are waiting... */
_closePin_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
RingD::instance->askToExportOnRing(accountId, password);
}
......@@ -543,11 +558,23 @@ void RingClientUWP::Views::SmartPanel::_pinGeneratorNo__Click(Platform::Object^
{
_addingDeviceGrid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_devicesMenuButton_->IsChecked = false;
_passwordForPinGenerator_->Password = "";
}
void RingClientUWP::Views::SmartPanel::OnexportOnRingEnded(Platform::String ^accountId, Platform::String ^pin)
{
MSG_("XXXX");
_waitingAndResult_->Text = pin;
_closePin_->Visibility = Windows::UI::Xaml::Visibility::Visible;
}
void RingClientUWP::Views::SmartPanel::_closePin__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
_waitingForPin_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_devicesMenuButton_->IsChecked = false;
// refacto : do something better...
_waitingAndResult_->Text = "Exporting account on the Ring...";
}
......@@ -102,6 +102,7 @@ private:
void _pinGeneratorYes__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _pinGeneratorNo__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void OnexportOnRingEnded(Platform::String ^accountId, Platform::String ^pin);
void _closePin__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
};
}
}
\ No newline at end of file
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