コード例 #1
0
        private void LogoutPopup()
        {
            var popup = new TwoButtonPopup();

            var leftButton = new MenuItem()
            {
                IconImageSource = new FileImageSource {
                    File = Constants.iconButtonCancel
                },
                Command = new Command(() => {
                    popup.Dismiss();
                })
            };

            var rightButton = new MenuItem()
            {
                IconImageSource = new FileImageSource {
                    File = Constants.iconButtonDone
                },
                Command = new Command(() => {
                    // Remove all properties in secure storage
                    SecureStorage.RemoveAll();

                    // Remove preferences data
                    Preferences.Remove("rememberMe");

                    Application.Current.MainPage = new LoginView();
                    popup.Dismiss();
                })
            };

            popup.FirstButton  = leftButton;
            popup.SecondButton = rightButton;

            popup.Content = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Children          =
                {
                    new Label
                    {
                        Text = Constants.textPopupLogout,
                        VerticalTextAlignment   = TextAlignment.Center,
                        HorizontalTextAlignment = TextAlignment.Center
                    }
                }
            };

            popup.BackButtonPressed += (s, e) =>
            {
                popup.Dismiss();
            };

            popup.Show();
        }
コード例 #2
0
        void createPopup1()
        {
            var checkbox = new Check
            {
                DisplayStyle = CheckDisplayStyle.Small
            };

            checkbox.Toggled += (s, e) =>
            {
                Console.WriteLine($"checkbox toggled. checkbox.IsToggled:{checkbox.IsToggled}");
            };

            _popUp1              = new TwoButtonPopup();
            _popUp1.Title        = "Popup title";
            _popUp1.FirstButton  = _leftButton;
            _popUp1.SecondButton = _rightButton;
            _popUp1.Content      = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    new Label
                    {
                        Text = "Will be saved, and sound, only on the Gear.",
                    },
                    new StackLayout
                    {
                        Orientation = StackOrientation.Horizontal,
                        Padding     = new Thickness(0, 40, 0, 40),
                        Children    =
                        {
                            checkbox,
                            new Label
                            {
                                Text = "Do not repeat",
                            }
                        }
                    }
                }
            };

            _popUp1.BackButtonPressed += (s, e) =>
            {
                _popUp1?.Dismiss();
                _popUp1     = null;
                label1.Text = "Popup1 is dismissed";
            };

            _popUp1.FirstButton.Clicked  += (s, e) => Console.WriteLine("First(share) button clicked!");
            _popUp1.SecondButton.Clicked += (s, e) => Console.WriteLine("Second(delete) button clicked!");
        }
コード例 #3
0
        void createPopup3()
        {
            _jpgIconButton1 = new MenuItem
            {
                Icon = new FileImageSource
                {
                    File = "image/a.jpg",
                },
                Command = new Command(() =>
                {
                    Console.WriteLine("jpg button1 Command!!");
                    _popUp3?.Dismiss();
                    _popUp3 = null;
                })
            };

            _jpgIconButton2 = new MenuItem
            {
                Icon = new FileImageSource
                {
                    File = "image/b.jpg",
                },
                Command = new Command(() =>
                {
                    Console.WriteLine("jpg button2 Command!!");
                    _popUp3?.Dismiss();
                    _popUp3 = null;
                })
            };

            _popUp3 = new TwoButtonPopup();
            _popUp3.SetValue(TwoButtonPopup.TitleProperty, "Popup title");
            _popUp3.SetValue(TwoButtonPopup.ContentProperty, _content);
            _popUp3.SetValue(TwoButtonPopup.TextProperty, "Text area text. It can be overlapped content");
            _popUp3.SetValue(TwoButtonPopup.FirstButtonProperty, _jpgIconButton1);
            _popUp3.SetValue(TwoButtonPopup.SecondButtonProperty, _jpgIconButton2);

            _popUp3.BackButtonPressed += (s, e) =>
            {
                _popUp3?.Dismiss();
                _popUp3     = null;
                label1.Text = "Popup3 is dismissed";
            };

            _popUp3.FirstButton.Clicked  += (s, e) => Console.WriteLine("_popUp3 First button clicked!");
            _popUp3.SecondButton.Clicked += (s, e) => Console.WriteLine("_popUp3 Second button clicked!");
        }
コード例 #4
0
        void createPopup2()
        {
            var leftButton2 = new MenuItem
            {
                Icon = new FileImageSource
                {
                    File = "image/tw_ic_popup_btn_check.png",
                },
                Command = new Command(() =>
                {
                    Console.WriteLine("left button2 Command!!");
                    _popUp2?.Dismiss();
                    _popUp2 = null;
                })
            };

            var rightButton2 = new MenuItem
            {
                Icon = new FileImageSource
                {
                    File = "image/tw_ic_popup_btn_delete.png",
                },
                Command = new Command(() =>
                {
                    Console.WriteLine("right button2 Command!!");
                    _popUp2?.Dismiss();
                    _popUp2 = null;
                })
            };

            _popUp2       = new TwoButtonPopup();
            _popUp2.Title = "Popup title";
            _popUp2.Text  = _longText;
            _popUp2.SetValue(TwoButtonPopup.FirstButtonProperty, leftButton2);
            _popUp2.SetValue(TwoButtonPopup.SecondButtonProperty, rightButton2);

            _popUp2.BackButtonPressed += (s, e) =>
            {
                _popUp2?.Dismiss();
                _popUp2     = null;
                label1.Text = "Popup2 is dismissed";
            };

            _popUp2.FirstButton.Clicked  += (s, e) => Console.WriteLine("_popUp2 First button clicked!");
            _popUp2.SecondButton.Clicked += (s, e) => Console.WriteLine("_popUp2 Second button clicked!");
        }
コード例 #5
0
        private void OnChangeColorRightClicked(object sender, EventArgs e)
        {
            createPopup1();

            _colorRightButton = new ColorMenuItem
            {
                IconImageSource = ImageSource.FromFile("image/b_option_list_icon_delete.png"),
                BackgroundColor = Color.Blue,
                Command         = new Command(() =>
                {
                    Console.WriteLine("right button1 Command!!");
                    _popUp1?.Dismiss();
                    _popUp1 = null;
                })
            };

            _popUp1.FirstButton  = _leftButton;
            _popUp1.SecondButton = _colorRightButton;
            _popUp1.Show();
        }
コード例 #6
0
        // TwoButtonPopup contains two buttons located at both ends.
        // The two buttons only display Icon.
        // Note that the text is not displayed even if the button's Text property is set.
        private void ShowTwoButtonPopup()
        {
            var twoButtonPopup = new TwoButtonPopup();

            twoButtonPopup.Title   = AppResources.WatchItemNamePagePopupTitle;
            twoButtonPopup.Content = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Children          =
                {
                    new Label
                    {
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                        VerticalOptions   = LayoutOptions.CenterAndExpand,
                        Text = AppResources.WatchItemNamePagePopupText
                    }
                }
            };

            twoButtonPopup.FirstButton = new MenuItem()
            {
                IconImageSource = new FileImageSource()
                {
                    File = "WatchItemNameCancel.png"
                },
                Command = new Command(() => {
                    twoButtonPopup?.Dismiss();
                    twoButtonPopup = null;
                })
            };
            twoButtonPopup.SecondButton = new MenuItem()
            {
                IconImageSource = new FileImageSource()
                {
                    File = "WatchItemNameCheck.png"
                }
            };

            twoButtonPopup.Show();
        }
コード例 #7
0
ファイル: MainPage.xaml.cs プロジェクト: mlad/tizen-wol
        private void ToolbarDeleteClicked(object sender, EventArgs e)
        {
            var selectedPcs = LanPc.List.Where(x => x.Selected).ToList();

            var leftButton = new MenuItem()
            {
                Icon = new FileImageSource {
                    File = "back.png"
                }
            };
            var rightButton = new MenuItem()
            {
                Icon = new FileImageSource {
                    File = "delete.png"
                }
            };

            var confirmPopup = new TwoButtonPopup
            {
                Title        = Resx.AppResources.Delete,
                Text         = string.Format(Resx.AppResources.DeleteConfirm, selectedPcs.Count),
                FirstButton  = leftButton,
                SecondButton = rightButton,
            };

            leftButton.Command  = new Command(() => confirmPopup.Dismiss());
            rightButton.Command = new Command(() =>
            {
                PcList.BeginRefresh();
                foreach (var i in selectedPcs)
                {
                    LanPc.List.Remove(i);
                }
                PcList.EndRefresh();

                RefreshPlaceholder();
                confirmPopup.Dismiss();
            });

            confirmPopup.Show();
        }
コード例 #8
0
        private void OnLeftOnlyClicked(object sender, EventArgs e)
        {
            createPopup1();
            _popUp1.FirstButton  = _leftButton;
            _popUp1.SecondButton = null;
            _popUp1.Show();

            Device.StartTimer(TimeSpan.FromMilliseconds(3000), () =>
            {
                _popUp1?.SetValue(TwoButtonPopup.TitleProperty, "Popup title changed");
                _popUp1?.SetValue(TwoButtonPopup.ContentProperty, _content);
                _popUp1?.SetValue(TwoButtonPopup.SecondButtonProperty, new MenuItem
                {
                    Text    = "Dismiss",
                    Command = new Command(() => {
                        _popUp1?.Dismiss();
                        _popUp1 = null;
                    })
                });
                return(false);
            });
        }
コード例 #9
0
        private void OnChangeColorLeftClicked(object sender, EventArgs e)
        {
            createPopup1();

            _colorleftButton = new ColorMenuItem
            {
                Icon = new FileImageSource
                {
                    File = "image/b_option_list_icon_share.png",
                },
                BackgroundColor = Color.Green,
                Command         = new Command(() =>
                {
                    Console.WriteLine("left button1 Command!!");
                    _popUp1?.Dismiss();
                    _popUp1 = null;
                })
            };

            _popUp1.FirstButton  = _colorleftButton;
            _popUp1.SecondButton = _rightButton;
            _popUp1.Show();
        }
コード例 #10
0
        private void OnDeleteButtonClicked(object sender, EventArgs e)
        {
            if (RateListView.SelectedItem == null)
            {
                return;
            }

            var selectedRate = RateListView.SelectedItem as CurrencyRate;

            var popup = new TwoButtonPopup()
            {
                FirstButton = new MenuItem()
                {
                    IconImageSource = "ic_popup_btn_check.png",
                    IsDestructive   = true
                },
                SecondButton = new MenuItem()
                {
                    IconImageSource = "ic_popup_btn_cancel.png"
                },
                Content = new Label {
                    Text                    = $"{AppResources.DeleteRateQuestion}\n{selectedRate}?",
                    VerticalOptions         = LayoutOptions.FillAndExpand,
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center
                }
            };

            popup.BackButtonPressed    += (s, args) => { popup.Dismiss(); };
            popup.SecondButton.Clicked += (s, args) => { popup.Dismiss(); };
            popup.FirstButton.Clicked  += (s, args) => {
                CurrencyRatesModel.Instance.DeleteCurrencyRate(selectedRate);
                popup.Dismiss();
            };
            popup.Show();
        }
コード例 #11
0
        public TCTwoButtonPopup()
        {
            InitializeComponent();

            _leftButton = new MenuItem
            {
                Icon = new FileImageSource
                {
                    File = "image/b_option_list_icon_share.png",
                },
                Command = new Command(() =>
                {
                    Console.WriteLine("left button1 Command!!");
                    _popUp1?.Dismiss();
                    _popUp1 = null;
                })
            };

            _rightButton = new MenuItem
            {
                Icon = new FileImageSource
                {
                    File = "image/b_option_list_icon_delete.png",
                },
                Command = new Command(() =>
                {
                    Console.WriteLine("right button1 Command!!");
                    _popUp1?.Dismiss();
                    _popUp1 = null;
                })
            };

            _noIconLeftButton = new MenuItem
            {
                Text    = "No icon left button",
                Command = new Command(() =>
                {
                    Console.WriteLine("No icon left button Command!!");
                    _popUp1?.Dismiss();
                    _popUp1 = null;
                })
            };

            _noIconRightButton = new MenuItem
            {
                Text    = "No icon right button",
                Command = new Command(() =>
                {
                    Console.WriteLine("no icon right button Command!!");
                    _popUp1?.Dismiss();
                    _popUp1 = null;
                })
            };

            _content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    new Label
                    {
                        Text      = "This is Label of Content area on Two button Popup.",
                        TextColor = Color.LightSkyBlue,
                    },
                    new StackLayout
                    {
                        Orientation = StackOrientation.Horizontal,
                        Padding     = new Thickness(0, 40, 0, 40),
                        Children    =
                        {
                            new Check
                            {
                                DisplayStyle = CheckDisplayStyle.Small
                            },
                            new Label
                            {
                                Text = "Do not repeat",
                            }
                        }
                    }
                }
            };

            _longText = @"This is scrollable popup text.
This part is made by adding long text in popup. Popup internally added
scroller to this layout when size of text is greater than total popup
height. This has two button in action area and title text in title area";
        }
コード例 #12
0
        public TCTwoButtonPopup()
        {
            InitializeComponent();

            var leftButton = new MenuItem()
            {
                Icon = new FileImageSource
                {
                    File = "image/b_option_list_icon_share.png",
                },
                Command = new Command(() =>
                {
                    Console.WriteLine("left button1 Command!!");
                    _popUp1.Dismiss();
                })
            };

            var rightButton = new MenuItem()
            {
                Icon = new FileImageSource
                {
                    File = "image/b_option_list_icon_delete.png",
                },
                Command = new Command(() =>
                {
                    Console.WriteLine("right button1 Command!!");
                    _popUp1.Dismiss();
                })
            };

            var checkbox = new Check
            {
                DisplayStyle = CheckDisplayStyle.Small
            };

            checkbox.Toggled += (s, e) =>
            {
                Console.WriteLine($"checkbox toggled. checkbox.IsToggled:{checkbox.IsToggled}");
            };

            _popUp1              = new TwoButtonPopup();
            _popUp1.FirstButton  = leftButton;
            _popUp1.SecondButton = rightButton;
            _popUp1.Title        = "Popup title";
            _popUp1.Content      = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    new Label
                    {
                        Text = "Will be saved, and sound, only on the Gear.",
                    },
                    new StackLayout
                    {
                        Orientation = StackOrientation.Horizontal,
                        Padding     = new Thickness(0, 30, 0, 30),
                        Children    =
                        {
                            checkbox,
                            new Label
                            {
                                Text = "Do not repeat",
                            }
                        }
                    }
                }
            };

            _popUp1.BackButtonPressed += (s, e) =>
            {
                _popUp1.Dismiss();
                label1.Text = "Popup1 is dismissed";
            };

            var leftButton2 = new MenuItem()
            {
                Icon = new FileImageSource
                {
                    File = "image/tw_ic_popup_btn_check.png",
                },
                Command = new Command(() =>
                {
                    Console.WriteLine("left button2 Command!!");
                    _popUp2.Dismiss();
                })
            };

            var rightButton2 = new MenuItem()
            {
                Icon = new FileImageSource
                {
                    File = "image/tw_ic_popup_btn_delete.png",
                },
                Command = new Command(() =>
                {
                    Console.WriteLine("right button2 Command!!");
                    _popUp2.Dismiss();
                })
            };

            _popUp2              = new TwoButtonPopup();
            _popUp2.FirstButton  = leftButton2;
            _popUp2.SecondButton = rightButton2;
            _popUp2.Title        = "Popup title";
            _popUp2.Text         = @"This is scrollable popup text.
This part is made by adding long text in popup. Popup internally added
scroller to this layout when size of text is greater than total popup
height. This has two button in action area and title text in title area";

            _popUp2.BackButtonPressed += (s, e) =>
            {
                _popUp2.Dismiss();
                label1.Text = "Popup2 is dismissed";
            };

            _popUp1.FirstButton.Clicked  += (s, e) => Console.WriteLine("First(share) button clicked!");
            _popUp1.SecondButton.Clicked += (s, e) => Console.WriteLine("Second(delete) button clicked!");
        }
コード例 #13
0
        private void submitClickedFunc(Object sender, EventArgs e)
        {
            try
            {
                amount = System.Convert.ToDouble(pex.Text);
            }
            catch (FormatException)
            {
                Toast.DisplayIconText("您需要输入一个数字", "warning.png");
                Navigation.PopModalAsync();
                Navigation.PopModalAsync();
                Navigation.PushModalAsync(new AddRecord());
                return;
            }
            if (isOut == true && amount > 0)
            {
                amount = 0 - amount;
            }
            //TagProvider tp = new TagProvider();
            tagInput  = idb.path;
            descInput = desc.Text;
            DataInteractionV2 di             = new DataInteractionV2();
            TwoButtonPopup    twoButtonPopup = new TwoButtonPopup();
            var confirmButton = new MenuItem()
            {
                IconImageSource = new FileImageSource()
                {
                    File = "Accept.png"
                },
                Command = new Command(() => {
                    if (di.writeRec(descInput, tagInput, amount))
                    {
                        Toast.DisplayIconText("已成功添加", "Accept.png");
                    }
                    twoButtonPopup.Dismiss();
                    pex.Text  = "请输入金额";
                    desc.Text = "输入描述(可选)";
                })
            };
            var cancelButton = new MenuItem()
            {
                IconImageSource = new FileImageSource()
                {
                    File = "cancel.png"
                },
                Command = new Command(() => { twoButtonPopup.Dismiss(); }),
            };

            twoButtonPopup.FirstButton  = confirmButton;
            twoButtonPopup.SecondButton = cancelButton;
            twoButtonPopup.Title        = "提交确认";
            twoButtonPopup.Content      = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          = { new Xamarin.Forms.Label {
                                          Text = "您确定要提交吗?"
                                      } }
            };
            inBtn.IsVisible       = true;
            inBtn.BackgroundColor = Color.Green;
            isOut                  = false;
            outBtn.IsVisible       = true;
            outBtn.BackgroundColor = Color.Red;
            twoButtonPopup.Show();
            Navigation.PopModalAsync();
        }
コード例 #14
0
        public TCTwoButtonPopup()
        {
            InitializeComponent();

            _leftButton = new MenuItem
            {
#pragma warning disable CS0618 // Icon is obsolete. This code is for checking backword compatibility.
                Icon = new FileImageSource
#pragma warning restore CS0618
                {
                    File = "image/b_option_list_icon_share.png",
                },
                Command = new Command(() =>
                {
                    Console.WriteLine("left button1 Command!!");
                    _popUp1?.Dismiss();
                    _popUp1 = null;
                })
            };

            _rightButton = new MenuItem
            {
#pragma warning disable CS0618 // Icon is obsolete. This code is for checking backword compatibility.
                Icon = new FileImageSource
#pragma warning restore CS0618
                {
                    File = "image/b_option_list_icon_delete.png",
                },
                Command = new Command(() =>
                {
                    Console.WriteLine("right button1 Command!!");
                    _popUp1?.Dismiss();
                    _popUp1 = null;
                })
            };

            _noIconLeftButton = new MenuItem
            {
                Text    = "No icon left button",
                Command = new Command(() =>
                {
                    Console.WriteLine("No icon left button Command!!");
                    _popUp1?.Dismiss();
                    _popUp1 = null;
                })
            };

            _noIconRightButton = new MenuItem
            {
                Text    = "No icon right button",
                Command = new Command(() =>
                {
                    Console.WriteLine("no icon right button Command!!");
                    _popUp1?.Dismiss();
                    _popUp1 = null;
                })
            };

            var mySwitch = new Switch();
            mySwitch.On <Xamarin.Forms.PlatformConfiguration.Tizen>().SetStyle("small");

            _content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    new Label
                    {
                        Text      = "This is Label of Content area on Two button Popup.",
                        TextColor = Color.LightSkyBlue,
                    },
                    new StackLayout
                    {
                        Orientation = StackOrientation.Horizontal,
                        Padding     = new Thickness(0, 40, 0, 40),
                        Children    =
                        {
                            mySwitch,
                            new Label
                            {
                                Text = "Do not repeat",
                            }
                        }
                    }
                }
            };

            _longText = @"This is scrollable popup text.
This part is made by adding long text in popup. Popup internally added
scroller to this layout when size of text is greater than total popup
height. This has two button in action area and title text in title area";
        }