Exemplo n.º 1
0
 public void ClosePopupWindow()
 {
     popupLayout = Content as PopupLayout;
     if (popupLayout != null && popupLayout.IsPopupActive)
     {
         popupLayout.DismissPopup();
     }
 }
Exemplo n.º 2
0
 public void CloseWindow()
 {
     _popupLayout = Content as PopupLayout;
     if (_popupLayout.IsPopupActive)
     {
         _model.StopPlayer();
         _model.IsPlaying = false;
         _popupLayout.DismissPopup();
     }
 }
Exemplo n.º 3
0
 public void CloseWindow()
 {
     popupLayout = this.Content as PopupLayout;
     if (popupLayout.IsPopupActive)
     {
         _model.StopPlayer();
         this._model.IsPlaying = false;
         popupLayout.DismissPopup();
     }
 }
Exemplo n.º 4
0
        private async void OnTaskSaved(TodoTask task)
        {
            if (task.IsValid())
            {
                await TaskHelper.SaveTask(task);

                popupLayout.DismissPopup();
                UpdateList();
            }
            else
            {
                await DisplayAlert("Error", "Please make sure you filled in all task fields", "OK");

                ShowPopup(task);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Method that closes the popup
 /// </summary>
 public void ClosePopup()
 {
     PopUpLayout.DismissPopup();
     List.SelectedItem = null;
 }
        /// <summary>
        /// Creates a view for the HomeToBorderDistance popup
        /// </summary>
        /// <returns>Stacklayout of the popup content</returns>
        public StackLayout HomeToBorderDistancePopup()
        {
            var display = Resolver.Resolve <IDevice>().Display;
            var header  = new Label
            {
                Text              = "Antal km",
                TextColor         = Color.FromHex(Definitions.TextColor),
                FontSize          = Definitions.HeaderFontSize,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                YAlign            = TextAlignment.Center,
                XAlign            = TextAlignment.Center,
            };


            var headerstack = new StackLayout
            {
                Orientation       = StackOrientation.Vertical,
                BackgroundColor   = Color.FromHex(Definitions.PrimaryColor),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    header,
                }
            };
            var text = new Label
            {
                Text              = "Angiv antal km mellem din bopæl og kommunegrænsen (hele km, meter). OS2Indberetning fordobler automatisk afstanden, hvis du både er startet og stoppet hjemme.",
                TextColor         = Color.FromHex(Definitions.DefaultTextColor),
                FontSize          = Definitions.PopupTextSize,
                HorizontalOptions = LayoutOptions.Center,
                YAlign            = TextAlignment.Center,
            };

            var entry = new Entry
            {
                TextColor         = Color.FromHex(Definitions.DefaultTextColor),
                Keyboard          = Keyboard.Numeric,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            entry.SetBinding(Entry.TextProperty, FinishDriveViewModel.HomeToBorderDistanceProperty);
            entry.Focus();

            var noButton = new ButtomButton("Fortryd", () => PopUpLayout.DismissPopup());
            var noStack  = new StackLayout
            {
                VerticalOptions   = LayoutOptions.End,
                HorizontalOptions = LayoutOptions.Start,
                HeightRequest     = Definitions.ButtonHeight,
                WidthRequest      = _yesNoButtonWidth,
                Children          = { noButton }
            };
            var yesButton = new ButtomButton("Gem", SendHomeToBorderDistanceMessage);
            var yesStack  = new StackLayout
            {
                VerticalOptions   = LayoutOptions.End,
                HorizontalOptions = LayoutOptions.End,
                HeightRequest     = Definitions.ButtonHeight,
                WidthRequest      = _yesNoButtonWidth,
                Children          = { yesButton }
            };

            var ButtonStack = new StackLayout
            {
                BackgroundColor   = Color.White, // for Android and WP
                Orientation       = StackOrientation.Horizontal,
                VerticalOptions   = LayoutOptions.End,
                Padding           = new Thickness(Definitions.Padding, 0, Definitions.Padding, Definitions.Padding),
                Spacing           = Definitions.Padding,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    noStack,
                    yesStack
                }
            };

            var PopUp = new StackLayout
            {
                WidthRequest = _popupWidth,

                BackgroundColor   = Color.White,
                Orientation       = StackOrientation.Vertical,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
                Spacing           = Definitions.Padding,
                Children          =
                {
                    headerstack,
                    text,
                    entry,
                    ButtonStack
                }
            };
            var topPadding      = display.Height / 2 - 150;
            var PopUpBackground = new StackLayout
            {
                Padding         = new Thickness(0, topPadding, 0, 0),
                WidthRequest    = display.Width,
                HeightRequest   = display.Height,
                BackgroundColor = Color.FromRgba(0, 0, 0, 0.85),
                Orientation     = StackOrientation.Vertical,
                VerticalOptions = LayoutOptions.Center,
                Children        =
                {
                    PopUp
                }
            };

            return(PopUpBackground);
        }
Exemplo n.º 7
0
 /// <summary>
 /// Method that handles closing the popup
 /// </summary>
 private void ClosePopup()
 {
     _popUpLayout.DismissPopup();
 }
Exemplo n.º 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);
            }
        }
Exemplo n.º 9
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;
        }