Exemplo n.º 1
0
        void LoadUrl(object sender, EventArgs args)
        {
            UrlView.Unfocus();
            _viewModel.UrlFocused = false;

            _viewModel.LoadCurrentUrl();
            ShowServo();
        }
Exemplo n.º 2
0
        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"));
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
 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);
     }
 }