From: Geunsun, Lee Date: Thu, 6 Apr 2017 05:55:57 +0000 (+0900) Subject: Modify an invisible ContextPopup X-Git-Tag: submit/tizen/20170808.015446~120 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c16c03f7caeab7c3403bdc8c3c8b7aad03d81089;p=profile%2Ftv%2Fapps%2Fdotnet%2Fhome.git Modify an invisible ContextPopup Change-Id: I5a4b30938062aed964aebbc72004f4118d6be4de --- diff --git a/TVApps/TVApps/Views/FooterNormalStatus.xaml.cs b/TVApps/TVApps/Views/FooterNormalStatus.xaml.cs index adb9031..ec7e207 100644 --- a/TVApps/TVApps/Views/FooterNormalStatus.xaml.cs +++ b/TVApps/TVApps/Views/FooterNormalStatus.xaml.cs @@ -27,9 +27,11 @@ namespace TVApps.Views /// public partial class FooterNormalStatus : Grid { - static ContextPopup popup; private bool isPopupShowing = false; + /// + /// A command will be executed if the Pin option is selected + /// public static readonly BindableProperty PinAppCommandProperty = BindableProperty.Create("PinAppCommand", typeof(Command), typeof(FooterNormalStatus), null); public ICommand PinAppCommand { @@ -37,6 +39,9 @@ namespace TVApps.Views set { SetValue(PinAppCommandProperty, value); } } + /// + /// A command will be executed if the Delete option is selected + /// public static readonly BindableProperty DeleteAppCommandProperty = BindableProperty.Create("DeleteAppCommand", typeof(Command), typeof(FooterNormalStatus), null); public ICommand DeleteAppCommand { @@ -44,15 +49,22 @@ namespace TVApps.Views set { SetValue(DeleteAppCommandProperty, value); } } - /// /// A constructor /// public FooterNormalStatus() { InitializeComponent(); + } - popup = new ContextPopup + void OnOptionsClicked(object sender, EventArgs e) + { + if (isPopupShowing) + { + return; + } + + ContextPopup popup = new ContextPopup { IsAutoHidingEnabled = true, Orientation = ContextPopupOrientation.Vertical, @@ -63,17 +75,19 @@ namespace TVApps.Views popup.Items.Add(new ContextPopupItem("DELETE")); //TODO: need to change the event callback - popup.SelectedIndexChanged += (s, e) => + popup.SelectedIndexChanged += (s, args) => { var ctxPopup = s as ContextPopup; DebuggingUtils.Dbg("selected item : " + (ctxPopup.SelectedItem as ContextPopupItem).Label + " (" + ctxPopup.SelectedIndex + ")"); switch (ctxPopup.SelectedIndex) { - case 0: //PIN + case 0: + //PIN PinAppCommand?.Execute(""); break; - case 1: //DELETE + case 1: + //DELETE DeleteAppCommand?.Execute(""); break; default: @@ -83,18 +97,10 @@ namespace TVApps.Views popup.Dismiss(); }; - popup.Dismissed += (s, e) => + popup.Dismissed += (s, args) => { isPopupShowing = false; }; - } - - void OnOptionsClicked(object sender, EventArgs e) - { - if (isPopupShowing) - { - return; - } popup.Show(sender as View); isPopupShowing = true;