예제 #1
0
        /// <summary>
        /// Create closing animations for modal background and popup
        /// </summary>
        private Animation CreateClosingAnimation()
        {
            Animation animationGroup = new Animation();

            if (ClosingAnimation != null)
            {
                if (ClosingAnimation is IAnimation popupAnimation)
                {
                    animationGroup.Add(0, 1, popupAnimation.Create(_popupRootLayout));
                }
                else
                {
                    animationGroup.Add(0, 1, ClosingAnimation.Create(_popupRootLayout));
                }

                Animation modalAnim = PopupLayout.CreateModalBackgroundAnimation(false);
                if (ClosingAnimation.Duration > 0 && modalAnim != null && HasModalBackground)
                {
                    animationGroup.Add(0, 1, modalAnim);
                }
            }

            if (animationGroup.HasSubAnimations())
            {
                return(animationGroup);
            }
            else
            {
                return(null);
            }
        }
예제 #2
0
        /// <summary>
        /// Create opening animations for modal background and popup
        /// </summary>
        private Animation CreateOpeningAnimation()
        {
            Animation animationGroup = new Animation();

            if (OpeningAnimation != null)
            {
                if (OpeningAnimation is IAnimation popupAnimation)
                {
                    animationGroup.Add(0, 1, popupAnimation.Create(_popupRootLayout));
                }
                else
                {
                    animationGroup.Add(0, 1, OpeningAnimation.Create(_popupRootLayout));
                }

                Animation backgroundAnimation = PopupLayout.CreateModalBackgroundAnimation(true);
                if (backgroundAnimation != null && HasModalBackground)
                {
                    animationGroup.Add(0, 1, backgroundAnimation);
                }
            }

            if (animationGroup.HasSubAnimations())
            {
                return(animationGroup);
            }
            else
            {
                return(null);
            }
        }
예제 #3
0
 public void ClosePopupWindow()
 {
     popupLayout = Content as PopupLayout;
     if (popupLayout != null && popupLayout.IsPopupActive)
     {
         popupLayout.DismissPopup();
     }
 }
예제 #4
0
 public void CloseWindow()
 {
     popupLayout = this.Content as PopupLayout;
     if (popupLayout.IsPopupActive)
     {
         _model.StopPlayer();
         this._model.IsPlaying = false;
         popupLayout.DismissPopup();
     }
 }
예제 #5
0
 public void CloseWindow()
 {
     _popupLayout = Content as PopupLayout;
     if (_popupLayout.IsPopupActive)
     {
         _model.StopPlayer();
         _model.IsPlaying = false;
         _popupLayout.DismissPopup();
     }
 }
예제 #6
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);
        }
예제 #7
0
        private async void ShowFilesDirectory()
        {
            if (popupListView == null)
            {
                popupListView = new PopupListView(this, PopupLayout);
                PopupLayout.PopupView.ContentTemplate = new DataTemplate(() => { return(popupListView); });
                PopupLayout.PopupView.ShowCloseButton = true;
                PopupLayout.PopupView.ShowFooter      = false;
                PopupLayout.PopupView.ShowHeader      = true;
                PopupLayout.PopupView.HeaderTitle     = "Choose a File";

                if (Device.Idiom == TargetIdiom.Phone)
                {
                    PopupLayout.PopupView.WidthRequest = this.Width - 50;
                }
                else if (Device.Idiom == TargetIdiom.Tablet)
                {
                    PopupLayout.PopupView.HeightRequest = this.Height / 2;
                    PopupLayout.PopupView.WidthRequest  = this.Width / 1.5;
                    PopupLayout.ShowOverlayAlways       = true;
                    PopupLayout.Show();
                }
                else if (Device.Idiom == TargetIdiom.Desktop)
                {
                    PopupLayout.PopupView.WidthRequest = 750;
                }
            }

            List <ListViewItem> listViewItems = new List <ListViewItem>();
            var filesCollection = await pdfViewerBindingContext.GetPdfFiles();

            PopupLayout.Show();
            foreach (var file in filesCollection)
            {
                listViewItems.Add(
                    new ListViewItem
                {
                    FileName = file,
                    Icon     = "PDF.png"
                });
            }
            popupListView.SetItemSourceForListView(listViewItems);
        }
예제 #8
0
            /// <summary>
            /// Measure all child based on popup layout size NOT container available size
            /// </summary>
            protected override SizeRequest OnMeasure(double widthConstraint, double heightConstraint)
            {
                Size totalSize = new Size();

                PopupLayout popupLayout = VisualTreeHelper.GetParent <PopupLayout>(this);

                foreach (View child in Children)
                {
                    if (child.HorizontalOptions.Alignment == LayoutAlignment.Fill && child.VerticalOptions.Alignment == LayoutAlignment.Fill)
                    {
                        totalSize  = new Size(popupLayout.Width, popupLayout.Height);
                        _childSize = totalSize;
                        break;
                    }

                    _childSize = child.Measure(popupLayout.Width, popupLayout.Height, MeasureFlags.IncludeMargins).Request;

                    if (child.HorizontalOptions.Alignment == LayoutAlignment.Fill)
                    {
                        totalSize.Width = Math.Max(popupLayout.Width, _childSize.Width);
                    }
                    else
                    {
                        totalSize.Width = Math.Max(totalSize.Width, _childSize.Width);
                    }

                    if (child.VerticalOptions.Alignment == LayoutAlignment.Fill)
                    {
                        totalSize.Height = Math.Max(totalSize.Height, popupLayout.Height);
                    }
                    else
                    {
                        totalSize.Height = Math.Max(totalSize.Height, _childSize.Height);
                    }
                }

                return(new SizeRequest(totalSize, totalSize));
            }
예제 #9
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));
        }
예제 #10
0
        /// <summary>
        /// Method that creates the page content
        /// </summary>
        public View SetContent()
        {
            var signalStatus = new Label
            {
                TextColor         = Color.Red,
                FontSize          = Definitions.AccuracyTextSize,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                YAlign            = TextAlignment.Center,
                Text = "Intet GPS signal",
            };

            signalStatus.SetBinding(Label.IsVisibleProperty, GpsViewModel.SignalProperty);

            var signalStack = new StackLayout
            {
                HeightRequest = 45,
                Children      = { signalStatus }
            };
            var gpsStatus = new Label
            {
                TextColor         = Color.FromHex(Definitions.DefaultTextColor),
                FontSize          = Definitions.AccuracyTextSize,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                YAlign            = TextAlignment.Center,
            };

            gpsStatus.SetBinding(Label.TextProperty, GpsViewModel.AccuracyProperty);

            var gpsDriven = new Label
            {
                TextColor         = Color.FromHex(Definitions.DefaultTextColor),
                FontSize          = Definitions.DrivenTextSize,
                FontAttributes    = FontAttributes.Bold,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                YAlign            = TextAlignment.Center,
                XAlign            = TextAlignment.Center,
                WidthRequest      = _popupWidth - 80
            };

            gpsDriven.SetBinding(Label.TextProperty, GpsViewModel.DrivenProperty);

            var gpsUpdate = new Label
            {
                TextColor         = Color.FromHex(Definitions.DefaultTextColor),
                FontSize          = Definitions.LastupdateTextSize,
                FontAttributes    = FontAttributes.Italic,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                YAlign            = TextAlignment.Center,
            };

            gpsUpdate.SetBinding(Label.TextProperty, GpsViewModel.LastUpdateProperty);

            var gpsTextStack = new StackLayout
            {
                Orientation     = StackOrientation.Vertical,
                BackgroundColor = Color.FromHex(Definitions.BackgroundColor),
                VerticalOptions = LayoutOptions.Center,
                Padding         = new Thickness(0, 80, 0, 100),
                Children        =
                {
                    signalStack,
                    gpsStatus,
                    gpsDriven,
                    gpsUpdate,
                }
            };

            _pauseButton = new ToggleButton(_startDrive, _pauseDrive, _driveAgain, SendToggleMessage);
            var finishButton = new ButtomButton("Afslut kørsel", OpenPopup);

            _pauseButton.Height = Definitions.GpsButtonHeight;
            finishButton.Height = Definitions.GpsButtonHeight;

            var buttomStack = new StackLayout
            {
                VerticalOptions = LayoutOptions.Center,
                Padding         = new Thickness(50, 0, 50, 0),
                Spacing         = 30,
                Children        = { _pauseButton, finishButton }
            };

            var gpsStack = new StackLayout
            {
                Orientation     = StackOrientation.Vertical,
                BackgroundColor = Color.FromHex(Definitions.BackgroundColor),
                VerticalOptions = LayoutOptions.FillAndExpand,
                Padding         = new Thickness(10, 50, 10, 50),
                Children        =
                {
                    gpsTextStack,
                    buttomStack
                }
            };

            _popUpLayout         = new PopupLayout();
            _popUpLayout.Content = gpsStack;
            return(_popUpLayout);
        }
예제 #11
0
        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();
        }
예제 #12
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>
        /// Method that creates the view content
        /// </summary>
        /// <returns>the view to be displayed</returns>
        public View SetContent()
        {
            // View Title
            var header = new Label
            {
                Text              = "Afslut kørsel",
                TextColor         = Color.FromHex(Definitions.TextColor),
                FontSize          = Definitions.HeaderFontSize,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                YAlign            = TextAlignment.Center,
            };

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

            // Date View
            var date = new Label
            {
                TextColor         = Color.FromHex(Definitions.DefaultTextColor),
                BackgroundColor   = Color.FromHex(Definitions.BackgroundColor),
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                FontSize          = Definitions.LoginLabelText,
                HeightRequest     = 35,
            };

            date.SetBinding(Label.TextProperty, FinishDriveViewModel.DateProperty);
            var user = new Label
            {
                TextColor         = Color.FromHex(Definitions.DefaultTextColor),
                BackgroundColor   = Color.FromHex(Definitions.BackgroundColor),
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                FontSize          = Definitions.LoginLabelText,
                HeightRequest     = 35,
            };

            user.SetBinding(Label.TextProperty, FinishDriveViewModel.UsernameProperty);

            // Purpose View
            var purpose = new DriveFinishedCommonCell(SendPurposeMessage);

            purpose.Title = PurposeText;
            purpose.SetBinding(DriveFinishedCommonCell.DetailsProperty, FinishDriveViewModel.PurposeProperty);

            // Organization View
            var organization = new DriveFinishedCommonCell(SendOrganizationMessage);

            organization.Title = OrganizationText;
            organization.SetBinding(DriveFinishedCommonCell.DetailsProperty, FinishDriveViewModel.OrganizationProperty);

            // Rate View
            var rate = new DriveFinishedCommonCell(SendRateMessage);

            rate.Title = RateText;
            rate.SetBinding(DriveFinishedCommonCell.DetailsProperty, FinishDriveViewModel.RateProperty);

            // Remark View
            var remark = new DriveFinishedCommonCell(SendRemarkMessage);

            remark.Title = RemarkText;
            remark.SetBinding(DriveFinishedCommonCell.DetailsProperty, FinishDriveViewModel.RemarkProperty);

            // Total Km View
            var totalKm = new DriveFinishedCommonCell(SendSelectNewKmMessage, clickable: false);

            totalKm.Title = NewKmText;
            totalKm.SetBinding(DriveFinishedCommonCell.DetailsProperty, FinishDriveViewModel.NewKmProperty);

            // Home to Border Distance View
            var homeToBorderDistance = new DriveFinishedCommonCell(SendSelectHomeToBorderDistanceMessage);

            homeToBorderDistance.Title = HomeToBorderDistanceText;
            homeToBorderDistance.SetBinding(DriveFinishedCommonCell.DetailsProperty, FinishDriveViewModel.HomeToBorderDistanceProperty);
            homeToBorderDistance.SetBinding(DriveFinishedCommonCell.IsVisibleProperty, FinishDriveViewModel.FourKmRuleCheckProperty);

            // Cancel and send buttons
            var startButton  = new ButtomButton("Indsend kørsel", SendUploadMessage);
            var cancelButton = new ButtomButton("Annuller og slet", OpenPopup);

            startButton.FontSize  = 24;
            cancelButton.FontSize = 24;
            var width = Resolver.Resolve <IDevice>().Display.Width;

            startButton.Width  = width / 2;
            cancelButton.Width = width / 2;

            var buttomStack = new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                VerticalOptions   = LayoutOptions.End,
                Padding           = Definitions.Padding,
                Spacing           = Definitions.Padding,
                HeightRequest     = Definitions.ButtonHeight + 20,
                HorizontalOptions = LayoutOptions.Fill,
                Children          = { cancelButton, startButton }
            };

            // Header View Container
            var headerLayout = new StackLayout
            {
                Spacing  = 2,
                Children =
                {
                    headerstack,
                    date,
                    user
                },
                BackgroundColor = Color.FromHex(Definitions.BackgroundColor)
            };

            // Content View Container
            var contentLayout = new StackLayout
            {
                Spacing  = 2,
                Children =
                {
                    purpose,
                    organization,
                    rate,
                    remark,
                    totalKm,
                    StartCheck(),
                    EndCheck(),
                    FourKmRuleCheck(),
                    homeToBorderDistance,
                    buttomStack
                },
                BackgroundColor = Color.FromHex(Definitions.BackgroundColor),
            };

            // Add content view to a scrollview
            var scrollView = new ScrollView
            {
                Content = contentLayout,
            };

            // Add Header and Content View Containers to a container
            var layout = new StackLayout
            {
                Spacing  = 2,
                Children =
                {
                    headerLayout,
                    scrollView
                },
                BackgroundColor = Color.FromHex(Definitions.BackgroundColor)
            };

            // Add layout to a PopUpLayout
            PopUpLayout         = new PopupLayout();
            PopUpLayout.Content = layout;

            return(PopUpLayout);
        }
예제 #14
0
        /// <summary>
        /// Method that creates the page content
        /// </summary>
        /// <returns>View of the content to be displayed</returns>
        public View SetContent()
        {
            var header = new Label
            {
                Text              = "Ny kørsel",
                TextColor         = Color.FromHex(Definitions.TextColor),
                FontSize          = Definitions.HeaderFontSize,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                YAlign            = TextAlignment.Center,
            };
            var vertButton = new VertsButton(SendViewStoredMessage, Definitions.storedReportsCount.ToString());
            var exitButton = new LogoutButton(ShowLogoutPopup);

            vertButton.WidthRequest  = 100;
            vertButton.HeightRequest = 60;
            exitButton.WidthRequest  = 100;
            exitButton.HeightRequest = 60;

            _header = new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                HeightRequest     = Definitions.HeaderHeight,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Padding           = 5,
                Children          =
                {
                    exitButton,
                    header,
                    vertButton,
                }
            };
            _header.SetBinding(StackLayout.BackgroundColorProperty, MainViewModel.PrimaryHexProperty);

            Definitions.DateToView = DateTime.Now.ToString("d/M/yyyy");
            Definitions.DateToApi  = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
            var date = new Label
            {
                Text              = Definitions.DateToView,
                TextColor         = Color.FromHex(Definitions.DefaultTextColor),
                BackgroundColor   = Color.FromHex(Definitions.BackgroundColor),
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                FontSize          = Definitions.LoginLabelText,
                HeightRequest     = 40,
            };

            List = new ListView
            {
                ItemTemplate        = new DataTemplate(typeof(DriveReportCell)),
                SeparatorColor      = Color.FromHex("#EE2D2D"),
                SeparatorVisibility = SeparatorVisibility.Default,
                VerticalOptions     = LayoutOptions.StartAndExpand,
                HorizontalOptions   = LayoutOptions.FillAndExpand
            };
            List.SetBinding(ListView.ItemsSourceProperty, MainViewModel.DriveProperty);

            List.ItemSelected += async(sender, e) =>
            {
                if (e.SelectedItem == null)
                {
                    return;
                }
                var selectedItem = (DriveReportCellModel)e.SelectedItem;
                SendSelectedMessage();
            };

            var startButton = new ButtomButton("Start kørsel", StartDrive);

            var buttomStack = new StackLayout
            {
                VerticalOptions = LayoutOptions.End,
                Padding         = Definitions.Padding,
                HeightRequest   = Definitions.ButtonHeight,

                Children = { startButton }
            };

            var layout = new StackLayout
            {
                Spacing  = 2,
                Children =
                {
                    _header,
                    date,
                    List,
                    CheckStack(),
                    buttomStack
                },
                BackgroundColor = Color.FromHex(Definitions.BackgroundColor),
            };

            _popUpLayout         = new PopupLayout();
            _popUpLayout.Content = layout;
            return(_popUpLayout);
        }
 private void Button_Clicked1(object sender, EventArgs e)
 {
     PopupLayout.ShowRelativeToView(btn, RelativePosition.AlignBottom, 0, 0);
 }
예제 #16
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);
            }
        }
예제 #17
0
        /// <summary>
        /// Costruisce la popup per la password sulla pagina di settings
        /// </summary>
        /// <param name="popupLayout"></param>
        /// <param name="rootLayout"></param>
        /// <param name="pageCaller"></param>
        public static void BuildSettingsPasswordPopup(ref PopupLayout popupLayout,
                                                      ref StackLayout rootLayout, ContentPage pageCaller)
        {
            popupLayout = new PopupLayout();
            PopupLayout innerPopupLayout = popupLayout;

            popupLayout.Content = pageCaller.Content;
            pageCaller.Content  = popupLayout;

            rootLayout = new StackLayout();
            rootLayout.BackgroundColor = Color.FromHex("C4C4C4");
            rootLayout.Opacity         = 1.0d;
            rootLayout.Orientation     = StackOrientation.Horizontal;
            rootLayout.WidthRequest    = pageCaller.Width / 2;
            rootLayout.HeightRequest   = pageCaller.Height / 3;
            rootLayout.Padding         = new Thickness(10, 0, 10, 0);

            StackLayout innerRootLayout = rootLayout;

            StackLayout rootStk = new StackLayout();

            //rootStk.Margin = new Thickness(5, 0, 5, 0);
            rootStk.HorizontalOptions = LayoutOptions.FillAndExpand;
            rootStk.VerticalOptions   = LayoutOptions.Center;

            Label lblPassword = new Label();

            lblPassword.WidthRequest    = 70;
            lblPassword.Text            = "Password";
            lblPassword.FontAttributes  = FontAttributes.Bold;
            lblPassword.VerticalOptions = LayoutOptions.Center;

            Entry passwordEntry = new Entry();

            passwordEntry.IsPassword        = true;
            passwordEntry.HorizontalOptions = LayoutOptions.FillAndExpand;

            StackLayout buttonsStk = new StackLayout();

            buttonsStk.Orientation = StackOrientation.Horizontal;

            Button submitBtn = new Button();

            submitBtn.Text            = Application.Current.Resources["unlock"].ToString();
            submitBtn.BackgroundColor = Color.Blue;
            submitBtn.TextColor       = Color.White;
            //submitBtn.HorizontalOptions = LayoutOptions.FillAndExpand;
            //submitBtn.VerticalOptions = LayoutOptions.End;
            submitBtn.Clicked += async(sender, e) => {
                //controllo che la password inserita sia corretta, se lo e' apro l'altra pagina
                if (passwordEntry.Text != null && passwordEntry.Text.Equals(App.config.GetPassUser()))
                {
                    await pageCaller.Navigation.PushAsync(new SettingsPage());

                    innerPopupLayout.DismissPopup();
                }
                else
                {
                    StartAnimationBlinkTwice(innerRootLayout);
                }

                passwordEntry.Text = null;
            };

            Button cancelBtn = new Button();

            cancelBtn.Text            = Application.Current.Resources["cancel"].ToString();
            cancelBtn.BackgroundColor = Color.Blue;
            cancelBtn.TextColor       = Color.Red;
            cancelBtn.Clicked        += (sender, e) => {
                innerPopupLayout.DismissPopup();
            };

            buttonsStk.Children.Add(submitBtn);
            buttonsStk.Children.Add(cancelBtn);

            rootStk.Children.Add(lblPassword);
            rootStk.Children.Add(passwordEntry);
            rootStk.Children.Add(buttonsStk);

            rootLayout.Children.Add(rootStk);

            popupLayout.IsVisible = true;
        }