ui/ux: remove dynamic positioning of loading spinner and splash
- fixes loading spinner and image postioning
- adds loading status text block
Change-Id: Ica5d523ffb332891edcd402f5f7e351e961a1db5
Tuleap: #790
diff --git a/MainPage.xaml.cpp b/MainPage.xaml.cpp
index 99e016d..52e093f 100644
--- a/MainPage.xaml.cpp
+++ b/MainPage.xaml.cpp
@@ -95,6 +95,13 @@
RingD::instance->registrationStateErrorGeneric += ref new RingClientUWP::RegistrationStateErrorGeneric(this, &RingClientUWP::MainPage::OnregistrationStateErrorGeneric);
RingD::instance->registrationStateRegistered += ref new RingClientUWP::RegistrationStateRegistered(this, &RingClientUWP::MainPage::OnregistrationStateRegistered);
RingD::instance->callPlaced += ref new RingClientUWP::CallPlaced(this, &RingClientUWP::MainPage::OncallPlaced);
+
+ RingD::instance->setLoadingStatusText += ref new SetLoadingStatusText([this](String^ statusText, String^ color){
+ _loadingStatus_->Text = statusText;
+ auto col = Utils::ColorFromString(color);
+ auto brush = ref new Windows::UI::Xaml::Media::SolidColorBrush(col);
+ _loadingStatus_->Foreground = brush;
+ });
}
void
@@ -158,17 +165,6 @@
_loadingOverlayRect_->Fill = whiteBrush;
_loadingOverlayRect_->Opacity = 1.0;
}
- TimeSpan delay;
- delay.Duration = 10000 * 50;
- ThreadPoolTimer^ delayTimer = ThreadPoolTimer::CreateTimer(
- ref new TimerElapsedHandler([this](ThreadPoolTimer^ source)
- {
- Dispatcher->RunAsync(CoreDispatcherPriority::High,
- ref new DispatchedHandler([this]()
- {
- OnResize(nullptr, nullptr);
- }));
- }), delay);
}
else if (!load && isLoading) {
isLoading = false;
@@ -177,43 +173,8 @@
}
void
-RingClientUWP::MainPage::PositionImage()
-{
- bounds = ApplicationView::GetForCurrentView()->VisibleBounds;
-
- auto img = ref new Image();
- auto bitmapImage = ref new Windows::UI::Xaml::Media::Imaging::BitmapImage();
- Windows::Foundation::Uri^ uri;
-
- _loadingImage_->SetValue(Canvas::LeftProperty, bounds.Width * 0.5 - _loadingImage_->Width * 0.5);
- _loadingImage_->SetValue(Canvas::TopProperty, bounds.Height * 0.5 - _loadingImage_->Height * 0.5);
-}
-
-void
-RingClientUWP::MainPage::PositionRing()
-{
- double left;
- double top;
-
- _splashProgressRing_->Width = 144;
- _splashProgressRing_->Height = 144;
-
- left = bounds.Width * 0.5 - _loadingImage_->Width * 0.5 + 139;
- top = bounds.Height * 0.5 - _loadingImage_->Height * 0.5 + 78;
-
- _splashProgressRing_->SetValue(Canvas::LeftProperty, left);
- _splashProgressRing_->SetValue(Canvas::TopProperty, top);
-}
-
-void
RingClientUWP::MainPage::OnResize(Platform::Object^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ e)
{
- Dispatcher->RunAsync(CoreDispatcherPriority::High,
- ref new DispatchedHandler([this]()
- {
- PositionImage();
- PositionRing();
- }));
}
void