void btnOK_Click(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;
            FrameworkElement notifBoxParent = null;
            int retVal = 0;
            string callbackId = "";
            if (btn != null)
            {
                retVal = (int)btn.Tag + 1;

                notifBoxParent = btn.Parent as FrameworkElement;
                while ((notifBoxParent = notifBoxParent.Parent as FrameworkElement) != null &&
                       !(notifBoxParent is PinDialogBox)&&
                       !(notifBoxParent is PinDialogBoxNoPassword)) ;
            }
            if (notifBoxParent != null)
            {
                PhoneApplicationPage page = Page;
                if (page != null)
                {
                    Grid grid = page.FindName("LayoutRoot") as Grid;
                    if (grid != null)
                    {
                        grid.Children.Remove(notifBoxParent);
                    }

                    NotifBoxData notifBoxData = notifBoxParent.Tag as NotifBoxData;
                    notifyBox = notifBoxData.previous as PinDialogBox;
                    callbackId = notifBoxData.callbackId as string;

                    if (notifyBox == null)
                    {
                        page.BackKeyPress -= page_BackKeyPress;
                    }
                }

            }
            DispatchCommandResult(new PluginResult(PluginResult.Status.OK, retVal), callbackId);
        }
        void page_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e)
        {
            PhoneApplicationPage page = sender as PhoneApplicationPage;
            string callbackId = "";
            if (page != null && notifyBox != null)
            {
                Grid grid = page.FindName("LayoutRoot") as Grid;
                if (grid != null)
                {
                    grid.Children.Remove(notifyBox);
                    NotifBoxData notifBoxData = notifyBox.Tag as NotifBoxData;
                    notifyBox = notifBoxData.previous as PinDialogBox;
                    callbackId = notifBoxData.callbackId as string;
                }
                if (notifyBox == null)
                {
                    page.BackKeyPress -= page_BackKeyPress;
                }
                e.Cancel = true;
            }

            DispatchCommandResult(new PluginResult(PluginResult.Status.OK, 0), callbackId);
        }
        public void prompt(string options)
        {
            string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
            string message = args[0];
            string title = args[1];
            string buttonLabelsArray = args[2];
            string[] buttonLabels = JSON.JsonHelper.Deserialize<string[]>(buttonLabelsArray);
            string defaultText = args[3];
            string aliasCurrentCommandCallbackId = args[4];

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                PhoneApplicationPage page = Page;
                if (page != null)
                {
                    Grid grid = page.FindName("LayoutRoot") as Grid;
                    if (grid != null)
                    {
                        var previous = notifyBox;
                        if(noPasswordField) { notifyBox = new PinDialogBoxNoPassword(); } else { notifyBox = new PinDialogBox(); }
                        noPasswordField = false;
                        notifyBox.Tag = new NotifBoxData { previous = previous, callbackId = aliasCurrentCommandCallbackId };
                        notifyBox.PageTitle.Text = title;
                        notifyBox.SubTitle.Text = message;

                        //TextBox textBox = new TextBox();
                        //textBox.Text = defaultText;
                        //textBox.AcceptsReturn = true;
                        //notifyBox.ContentScroller.Content = textBox;

                        notifyBox.InputText.Text = defaultText;
                        notifyBox.InputText.Visibility = Visibility.Visible;

                        for (int i = 0; i < buttonLabels.Length; ++i)
                        {
                            Button button = new Button();
                            button.Content = buttonLabels[i];
                            button.Tag = i + 1;
                            button.Click += promptBoxbutton_Click;
                            notifyBox.ButtonPanel.Orientation = Orientation.Vertical;
                            notifyBox.ButtonPanel.Children.Add(button);
                        }

                        grid.Children.Add(notifyBox);
                        if (previous != null)
                        {
                            page.BackKeyPress += page_BackKeyPress;
                        }
                    }
                }
                else
                {
                    DispatchCommandResult(new PluginResult(PluginResult.Status.INSTANTIATION_EXCEPTION));
                }
            });
        }