Example #1
0
 /// <summary>
 /// Method that handles a PauseError from the viewmodel
 /// Reinitializes the toggle button and shows error popup
 /// </summary>
 public void HandlePauseError()
 {
     if (_pauseButton.Text != _driveAgain)
     {
         Device.BeginInvokeOnMainThread(() =>
         {
             _pauseButton.Text = _driveAgain;
             _popUpLayout.ShowPopup(PauseSpaceTooBigPopUp());
         });
     }
 }
Example #2
0
 /// <summary>
 /// Method that handles displaying of an alert popup with the correct
 /// message to notify the user that something is missing
 /// </summary>
 private void StartDrive()
 {
     if (String.IsNullOrWhiteSpace(Definitions.Purpose))
     {
         _popUpLayout.ShowPopup(CreatePopup("VƦlg venligst et formƄl"));
         return;
     }
     if (Definitions.Organization == null)
     {
         _popUpLayout.ShowPopup(CreatePopup("VƦlg venligst en stilling og ansƦttelsessted"));
         return;
     }
     if (Definitions.Rate == null)
     {
         _popUpLayout.ShowPopup(CreatePopup("VƦlg venligst en takst"));
         return;
     }
     MessagingCenter.Send <MainPage>(this, "Start");
 }
Example #3
0
        private async Task LoginWithWeibo()
        {
            await Application.Current.MainPage.DisplayAlert("TODO", "TODO: Login using Weibo OAuth 2.0", "Got it");

            var popup = new PopupLayout
            {
                Content = new WebView
                {
                    Source = "http://open.weibo.com/wiki/Oauth2/authorize"
                }
            };

            popup.ShowPopup(popup);
        }
Example #4
0
        public async void OpenPopupWindow()
        {
            var   imageSize = App.Configuration.GetImageSizeByID(ImageIdentity.BADGE_HINT_WINDOW);
            short height = 330, width = 306;

            if (imageSize != null)
            {
                height = (short)imageSize.Height;
                width  = (short)imageSize.Width;
            }

            ClosePopupWindow();
            popupLayout = Content as PopupLayout;
            var stackLayout = new StackLayout()
            {
                HorizontalOptions    = LayoutOptions.Center,
                VerticalOptions      = LayoutOptions.Center,
                BackgroundColor      = Palette._Transparent,
                WidthRequest         = width,
                HeightRequest        = height,
                MinimumWidthRequest  = width,
                MinimumHeightRequest = height,
            };

            var stackInner = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Orientation       = StackOrientation.Vertical,
                Margin            = new Thickness(0)
            };

            stackLayout.Children.Add(stackInner);

            var closeImageSize = App.Configuration.GetImageSizeByID(ImageIdentity.BADGE_HINT_WINDOW_CLOSE);
            var closeImage     = new Image()
            {
                Source            = ImageResizer.ResizeImage(TextResources.icon_BadgeCloseCircle, closeImageSize),
                Style             = (Style)App.CurrentApp.Resources["imageBadgeHintClose"],
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Margin            = new Thickness(0, 0, 0, -10),
            };

            if (closeImageSize != null)
            {
                closeImage.WidthRequest         = closeImageSize.Width;
                closeImage.HeightRequest        = closeImageSize.Height;
                closeImage.MinimumWidthRequest  = closeImageSize.Width;
                closeImage.MinimumHeightRequest = closeImageSize.Height;
            }

            var tapGestureRecognizer = new TapGestureRecognizer()
            {
                Command = new Command((obj) => { ClosePopupWindow(); })
            };

            closeImage.GestureRecognizers.Add(tapGestureRecognizer);
            stackInner.Children.Add(closeImage);

            var gridMain = new Grid()
            {
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                WidthRequest      = width,
                HeightRequest     = height,
                Margin            = new Thickness(0),
                ColumnDefinitions =
                {
                    new ColumnDefinition()
                    {
                        Width = GridLength.Star
                    }
                },
                RowDefinitions =
                {
                    new RowDefinition()
                    {
                        Height = 10
                    },
                    new RowDefinition()
                    {
                        Height = GridLength.Auto
                    },
                    new RowDefinition()
                    {
                        Height = GridLength.Auto
                    },
                    new RowDefinition()
                    {
                        Height = GridLength.Star
                    },
                }
            };

            var backgroundImage = new Image()
            {
                Source = ImageResizer.ResizeImage(TextResources.image_BadgeHintBackground, 300, 500),
                Aspect = Aspect.Fill
            };

            Grid.SetRowSpan(backgroundImage, 4);
            gridMain.Children.Add(backgroundImage);

            var titleLabel = new Label()
            {
                Text              = TextResources.BadgesCAPS,
                Style             = (Style)App.CurrentApp.Resources["labelStyleLargeMedium"],
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Margin            = new Thickness(0, 15, 0, 0)
            };

            gridMain.Children.Add(titleLabel, 0, 1);

            var subTitleLabel = new Label()
            {
                Text              = TextResources.BadgeHintSubTitle,
                Style             = (Style)App.CurrentApp.Resources["labelStyleSmall"],
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Margin            = new Thickness(0, -5, 0, 0)
            };

            gridMain.Children.Add(subTitleLabel, 0, 2);

            var gridRows = new Grid()
            {
                VerticalOptions   = LayoutOptions.StartAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Margin            = new Thickness(0, 10, 0, 0),
                ColumnDefinitions =
                {
                    new ColumnDefinition()
                    {
                        Width = GridLength.Auto
                    },
                    new ColumnDefinition()
                    {
                        Width = GridLength.Star
                    }
                },
                RowDefinitions =
                {
                    new RowDefinition()
                    {
                        Height = GridLength.Auto
                    },
                    new RowDefinition()
                    {
                        Height = GridLength.Auto
                    },
                    new RowDefinition()
                    {
                        Height = GridLength.Auto
                    },
                }
            };

            gridMain.Children.Add(gridRows, 0, 3);

            var badgeImageSize = App.Configuration.GetImageSizeByID(ImageIdentity.BADGE_HINT_ICON);

            // Bronze hint description
            var bronzeImage = new Image()
            {
                Source            = ImageResizer.ResizeImage(TextResources.Badge_Bronze, badgeImageSize),
                Style             = (Style)App.CurrentApp.Resources["imageBadgeHintIcon"],
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center
            };

            gridRows.Children.Add(bronzeImage, 0, 0);

            var bronzeLabel = new Label()
            {
                Text              = TextResources.Badge_Bronze_Hint,
                Style             = (Style)App.CurrentApp.Resources["labelStyleXSmall"],
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions   = LayoutOptions.Center
            };

            gridRows.Children.Add(bronzeLabel, 1, 0);

            // Silver hint description
            var silverImage = new Image()
            {
                Source            = ImageResizer.ResizeImage(TextResources.Badge_Silver, badgeImageSize),
                Style             = (Style)App.CurrentApp.Resources["imageBadgeHintIcon"],
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Center
            };

            gridRows.Children.Add(silverImage, 0, 1);

            var silverLabel = new Label()
            {
                Text              = TextResources.Badge_Silver_Hint,
                Style             = (Style)App.CurrentApp.Resources["labelStyleXSmall"],
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions   = LayoutOptions.Center
            };

            gridRows.Children.Add(silverLabel, 1, 1);

            // Gold hint description
            var goldImage = new Image()
            {
                Source            = ImageResizer.ResizeImage(TextResources.Badge_Gold, badgeImageSize),
                Style             = (Style)App.CurrentApp.Resources["imageBadgeHintIcon"],
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center
            };

            gridRows.Children.Add(goldImage, 0, 2);

            var goldLabel = new Label()
            {
                Text              = TextResources.Badge_Gold_Hint,
                Style             = (Style)App.CurrentApp.Resources["labelStyleXSmall"],
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions   = LayoutOptions.Center
            };

            gridRows.Children.Add(goldLabel, 1, 2);

            if (badgeImageSize != null)
            {
                bronzeImage.WidthRequest  = badgeImageSize.Width;
                bronzeImage.HeightRequest = badgeImageSize.Height;

                silverImage.WidthRequest  = badgeImageSize.Width;
                silverImage.HeightRequest = badgeImageSize.Height;

                goldImage.WidthRequest  = badgeImageSize.Width;
                goldImage.HeightRequest = badgeImageSize.Height;
            }

            stackInner.Children.Add(gridMain);
            popupLayout.ShowPopup(stackLayout);
            await Task.Delay(TimeSpan.FromMilliseconds(1));
        }
        public async void OpenPopupWindow()
        {
            var imageSizeWindow = await App.Configuration.GetImageSizeByIDAsync(ImageIdentity.WORKOUT_VIDEO_WINDOW);

            int height = 340, width = 360;

            if (imageSizeWindow != null)
            {
                height = (int)imageSizeWindow.Height;
                width  = (int)imageSizeWindow.Width;
            }

            if (_deviceInfo.WidthPixels != 0)
            {
                var d = _deviceInfo.ScaledDensity;
                width  = _deviceInfo.WidthPixels / (int)d;
                width -= 60;
                height = width - 10;
            }

            CloseWindow();
            _popupLayout = Content as PopupLayout;
            var stackLayout = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Center,
                BackgroundColor   = Palette._Transparent,
                Orientation       = StackOrientation.Vertical,
                HeightRequest     = height,
                WidthRequest      = width
            };
            StackLayout stackLayoutTitle = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.End,
                Orientation       = StackOrientation.Horizontal,
                BackgroundColor   = Palette._Transparent,
            };
            //Label labelTitle = new Label()
            //{
            //    Text = _model.CurrentMediaContent.MediaTitle,
            //    LineBreakMode = LineBreakMode.TailTruncation,
            //    Style = (Style) App.CurrentApp.Resources["labelStyleInfoHeading"],
            //    HorizontalOptions = LayoutOptions.Start,
            //    Margin = new Thickness(3, 0, 0, 0)
            //};
            //Label labelSets = new Label()
            //{
            //    Text = (_model.CurrentMediaContent.SetsAndRepeats != null &&
            //            _model.CurrentMediaContent.SetsAndRepeats.Trim().Length > 0
            //        ? " [" + _model.CurrentMediaContent.SetsAndRepeats + "]"
            //        : ""),
            //    LineBreakMode = LineBreakMode.TailTruncation,
            //    Style = (Style) App.CurrentApp.Resources["labelStyleInfoHeading"],
            //    HorizontalOptions = LayoutOptions.StartAndExpand,
            //};
            //var imageSize = App.Configuration.GetImageSizeByID(ImageIdentity.TOP_BAR_CLOSE);
            //Image imageClose = new Image()
            //{
            //    Source = ImageResizer.ResizeImage(TextResources.icon_close, imageSize),
            //    Style = (Style) App.CurrentApp.Resources["imagePopupClose"],
            //    Margin = new Thickness(0, 2, 5, 2)
            //};

            var closeImageSize = App.Configuration.GetImageSizeByID(ImageIdentity.BADGE_HINT_WINDOW_CLOSE);
            var closeImage     = new Image()
            {
                Source            = ImageResizer.ResizeImage(TextResources.icon_BadgeCloseCircle, closeImageSize),
                Style             = (Style)App.CurrentApp.Resources["imageBadgeHintClose"],
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Margin            = new Thickness(0),
                WidthRequest      = 60,
                HeightRequest     = 60
            };

            GestureRecognizer gestureRecognizer = new TapGestureRecognizer()
            {
                Command = new Command(CloseWindow)
            };

            closeImage.GestureRecognizers.Add(gestureRecognizer);
            //if (imageSize != null)
            //{
            //    imageClose.HeightRequest = imageSize.Height;
            //    imageClose.WidthRequest = imageSize.Width;
            //}

            //stackLayoutTitle.Children.Add(labelTitle);
            //stackLayoutTitle.Children.Add(labelSets);
            stackLayoutTitle.Children.Add(closeImage);

            var videoView = new VideoView()
            {
                HeightRequest     = height,
                WidthRequest      = width,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                BackgroundColor   = Palette._Transparent
            };

            videoView.SetBinding(VideoView.SourceProperty,
                                 new Binding("Source", BindingMode.OneWay, null, null, "{0}"));

            stackLayout.Children.Add(stackLayoutTitle);
            stackLayout.Children.Add(videoView);
            _popupLayout.ShowPopup(stackLayout);
            _model.UpdateCurrentMedia();
        }
Example #6
0
        /// <summary>
        /// Method that creates the page content
        /// </summary>
        public View SetContent()
        {
            var header = new Label
            {
                Text              = "Gemte Rapporteringer",
                TextColor         = Color.FromHex(Definitions.TextColor),
                FontSize          = Definitions.HeaderFontSize,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                YAlign            = TextAlignment.Center,
            };
            var backButton = new BackButton(SendBackMessage);
            var filler     = new Filler();

            var headerstack = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                BackgroundColor = Color.FromHex(Definitions.PrimaryColor),
                HeightRequest   = Definitions.HeaderHeight,
                Padding         = 5,
                Children        =
                {
                    backButton,
                    header,
                    filler,
                }
            };

            var topText = new Label
            {
                Text              = "Klik pƄ rapporten for enten at sende eller slette den",
                TextColor         = Color.FromHex(Definitions.DefaultTextColor),
                FontSize          = Definitions.LoginLabelText,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                YAlign            = TextAlignment.Center,
                XAlign            = TextAlignment.Center,
            };

            List = new ListView
            {
                ItemTemplate        = new DataTemplate(typeof(StoredReportCell)),
                SeparatorColor      = Color.FromHex("#EE2D2D"),
                SeparatorVisibility = SeparatorVisibility.Default,
                VerticalOptions     = LayoutOptions.StartAndExpand,
            };
            List.SetBinding(ListView.ItemsSourceProperty, StoredReportsViewModel.ListProperty);



            List.ItemSelected += async(sender, e) =>
            {
                if (e.SelectedItem == null)
                {
                    return;
                }
                var selectedItem = (StoredReportCellModel)e.SelectedItem;
                var d            = Convert.ToDateTime(selectedItem.report.Date);
                var t            = d.ToString("d/M/yyyy");

                PopUpLayout.ShowPopup(CreatePopup("Send rapport fra d. " + t + " ?"));
            };

            var layout = new StackLayout
            {
                Spacing  = 8,
                Children =
                {
                    headerstack,
                    topText,
                    List,
                },
                BackgroundColor = Color.FromHex(Definitions.BackgroundColor),
            };

            PopUpLayout         = new PopupLayout();
            PopUpLayout.Content = layout;
            return(PopUpLayout);
        }
 /// <summary>
 /// Opens the delete report popup
 /// </summary>
 private void OpenPopup()
 {
     PopUpLayout.ShowPopup(CreateDeletePopup());
 }
Example #8
0
        public void popupview(string id)
        {
            popupLayout = this.Content as PopupLayout;

            if (popupLayout.IsPopupActive)
            {
                popupLayout.DismissPopup();
            }
            else
            {
                StackLayout MainStack = new StackLayout()
                {
                    BackgroundColor   = Color.White,
                    HeightRequest     = this.Height * .5,
                    WidthRequest      = this.Width * .8,
                    HorizontalOptions = LayoutOptions.Center,
                    VerticalOptions   = LayoutOptions.Center,
                    Padding           = new Thickness(5, 5, 5, 5)
                };
                StackLayout ImageStack = new StackLayout()
                {
                    HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center
                };

                if (PHOTOSLIST != null)
                {
                    for (int i = 0; i < PHOTOSLIST.Count; i++)
                    {
                        if (PHOTOSLIST[i].leftId == id)
                        {
                            PopupPhotoList = new ObservableCollection <ServicesClasses.Photo>();
                            PopupPhotoList = PHOTOSLIST[i].photosLeft;
                        }
                        if (PHOTOSLIST[i].rightId != null)
                        {
                            if (PHOTOSLIST[i].rightId == id)
                            {
                                PopupPhotoList = new ObservableCollection <ServicesClasses.Photo>();
                                PopupPhotoList = PHOTOSLIST[i].photosLeft;
                            }
                        }
                    }
                }

                Image ImageContent = new Image()
                {
                    Aspect        = Aspect.Fill,
                    HeightRequest = this.Height * .4,
                    WidthRequest  = this.Width * .8
                };

                #region bottom stack

                StackLayout BottomStack = new StackLayout()
                {
                    Orientation     = StackOrientation.Horizontal,
                    BackgroundColor = Color.White,
                    HeightRequest   = this.Height * .1,
                    WidthRequest    = this.Width * .8,
                    VerticalOptions = LayoutOptions.Center
                };
                Label ImageNumber = new Label()
                {
                    BackgroundColor = Color.White, TextColor = Color.FromHex("#09091a"), VerticalOptions = LayoutOptions.Center
                };

                Image LeftArrow = new Image()
                {
                    Source = "ico_down_arrow2_right.png", VerticalOptions = LayoutOptions.Center
                };
                Image RightArrow = new Image()
                {
                    Source = "ico_down_arrow2_right.png", VerticalOptions = LayoutOptions.Center
                };
                int PhotoCountValue = 0;
                ImageContent.Source = PopupPhotoList[PhotoCountValue].photo_path;
                ImageNumber.Text    = PhotoCountValue + " of " + PopupPhotoList.Count;
                var LeftArrowTap = new TapGestureRecognizer(); LeftArrowTap.Tapped += (object sender, EventArgs e) =>
                {
                    if (PhotoCountValue <= 0)
                    {
                    }
                    else
                    {
                        PhotoCountValue     = PhotoCountValue - 1;
                        ImageContent.Source = PopupPhotoList[PhotoCountValue].photo_path;
                        ImageNumber.Text    = PhotoCountValue + " of " + PopupPhotoList.Count;
                    }
                };
                var RightArrowTap = new TapGestureRecognizer(); RightArrowTap.Tapped += (object sender, EventArgs e) =>
                {
                    if (PhotoCountValue >= PopupPhotoList.Count)
                    {
                    }
                    else
                    {
                        PhotoCountValue     = PhotoCountValue + 1;
                        ImageContent.Source = PopupPhotoList[PhotoCountValue].photo_path;
                        ImageNumber.Text    = PhotoCountValue + " of " + PopupPhotoList.Count;
                    }
                };
                LeftArrow.GestureRecognizers.Add(LeftArrowTap);
                RightArrow.GestureRecognizers.Add(RightArrowTap);
                BottomStack.Children.Add(LeftArrow);
                BottomStack.Children.Add(RightArrow);
                BottomStack.Children.Add(ImageNumber);

                #endregion

                ImageStack.Children.Add(ImageContent);
                ImageStack.Children.Add(BottomStack);

                MainStack.Children.Add(ImageStack);

                popupLayout.ShowPopup(MainStack);
            }
        }