void LoadUrl(object sender, EventArgs args) { UrlView.Unfocus(); _viewModel.UrlFocused = false; _viewModel.LoadCurrentUrl(); ShowServo(); }
public IHttpActionResult Create(UrlView url) { Uri uriResult; if (Uri.TryCreate(url.OriginalUrl, UriKind.Absolute, out uriResult) && (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps)) { return(Ok(_reducerRepository.Create(url.OriginalUrl))); } return(BadRequest("url is invalid")); }
void ShowServo(bool immediate = false) { uint delay = 500; if (immediate) { delay = 0; } UrlView.TranslateTo(0, 0, delay, Easing.SpringOut); ServoView.TranslateTo(0, 0, delay, Easing.SpringOut); StatusView.ScaleTo(1, delay, Easing.Linear); _viewModel.ToolbarHeight = (int)ServoView.Bounds.Top; }
void HideServo(bool immediate = false) { uint delay = 500; var deviceFactor = 1; var offset = 0.25; if (immediate) { delay = 0; } if (Device.RuntimePlatform == Device.macOS) { deviceFactor = -1; offset = 0.5; } UrlView.TranslateTo(0, deviceFactor * offset * ServoView.Bounds.Height, delay, Easing.SpringIn); ServoView.TranslateTo(0, deviceFactor * ServoView.Bounds.Height, delay, Easing.SpringIn); StatusView.ScaleTo(0, delay, Easing.Linear); }
void ViewModelOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs) { if (propertyChangedEventArgs.PropertyName == nameof(_viewModel.FloatingButtonVisibility)) { EraseFloatingButton.ScaleTo(_viewModel.FloatingButtonVisibility ? 1 : 0, easing: Easing.Linear); } else if (propertyChangedEventArgs.PropertyName == nameof(_viewModel.ServoVisibility)) { if (_viewModel.ServoVisibility) { ShowServo(); } else { HideServo(); } } else if (propertyChangedEventArgs.PropertyName == nameof(_viewModel.UrlFocused)) { var black = Color.FromRgba(0, 0, 0, 100); UrlBackground.BackgroundColor = _viewModel.UrlFocused ? black : Color.Transparent; } else if (propertyChangedEventArgs.PropertyName == nameof(_viewModel.CanGoBack)) { BackButton.Scale = _viewModel.CanGoBack ? 1 : 0; } else if (propertyChangedEventArgs.PropertyName == nameof(_viewModel.ToolbarOffset)) { var deviceFactor = -1; if (Device.RuntimePlatform == Device.macOS) { deviceFactor = 1; } MainStackLayout.TranslateTo(0, deviceFactor * _viewModel.ToolbarOffset); float factor = (float)_viewModel.ToolbarOffset / (float)_viewModel.ToolbarHeight; UrlView.FadeTo(1 - 3 * factor); } }