当前位置: 首页>>代码示例>>C#>>正文


C# UI.NotificationBox类代码示例

本文整理汇总了C#中WPCordovaClassLib.Cordova.UI.NotificationBox的典型用法代码示例。如果您正苦于以下问题:C# NotificationBox类的具体用法?C# NotificationBox怎么用?C# NotificationBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NotificationBox类属于WPCordovaClassLib.Cordova.UI命名空间,在下文中一共展示了NotificationBox类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btnOK_Click

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

                notifBoxParent = btn.Parent as FrameworkElement;
                while ((notifBoxParent = notifBoxParent.Parent as FrameworkElement) != null &&
                       !(notifBoxParent is NotificationBox)) ;
            }
            if (notifBoxParent != null)
            {
                PhoneApplicationPage page = Page;
                if (page != null)
                {
                    Grid grid = page.FindName("LayoutRoot") as Grid;
                    if (grid != null)
                    {
                        grid.Children.Remove(notifBoxParent);
                    }
                    notifyBox = notifBoxParent.Tag as NotificationBox;
                    if (notifyBox == null)
                    {
                        page.BackKeyPress -= page_BackKeyPress;
                    }
                }

            }
            DispatchCommandResult(new PluginResult(PluginResult.Status.OK, retVal));
        }
开发者ID:alexanderbob,项目名称:ssau_handbook,代码行数:33,代码来源:Notification.cs

示例2: page_BackKeyPress

        void page_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e)
        {
            PhoneApplicationPage page = sender as PhoneApplicationPage;

            if (page != null && notifyBox != null)
            {
                Grid grid = page.FindName("LayoutRoot") as Grid;
                if (grid != null)
                {
                    grid.Children.Remove(notifyBox);
                    notifyBox = notifyBox.Tag as NotificationBox;
                }
                if (notifyBox == null)
                {
                    page.BackKeyPress -= page_BackKeyPress;
                }
                e.Cancel = true;
            }

            DispatchCommandResult(new PluginResult(PluginResult.Status.OK, 0));
        }
开发者ID:alexanderbob,项目名称:ssau_handbook,代码行数:21,代码来源:Notification.cs

示例3: confirm

        public void confirm(string options)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
                AlertOptions alertOpts = new AlertOptions();
                alertOpts.message = args[0];
                alertOpts.title = args[1];
                alertOpts.buttonLabel = args[2];

                PhoneApplicationPage page = Page;
                if (page != null)
                {
                    Grid grid = page.FindName("LayoutRoot") as Grid;
                    if (grid != null)
                    {
                        var previous = notifyBox;
                        notifyBox = new NotificationBox();
                        notifyBox.Tag = previous;
                        notifyBox.PageTitle.Text = alertOpts.title;
                        notifyBox.SubTitle.Text = alertOpts.message;

                        string[] labels = alertOpts.buttonLabel.Split(',');
                        for (int n = 0; n < labels.Length; n++)
                        {
                            Button btn = new Button();
                            btn.Content = labels[n];
                            btn.Tag = n;
                            btn.Click += new RoutedEventHandler(btnOK_Click);
                            notifyBox.ButtonPanel.Children.Add(btn);
                        }

                        grid.Children.Add(notifyBox);
                        if (previous == null)
                        {
                            page.BackKeyPress += page_BackKeyPress;
                        }
                    }
                }
                else
                {
                    DispatchCommandResult(new PluginResult(PluginResult.Status.INSTANTIATION_EXCEPTION));
                }
            });
        }
开发者ID:alexanderbob,项目名称:ssau_handbook,代码行数:45,代码来源:Notification.cs

示例4: alert

        public void alert(string options)
        {
            string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
            AlertOptions alertOpts = new AlertOptions();
            alertOpts.message = args[0];
            alertOpts.title = args[1];
            alertOpts.buttonLabel = args[2];
            string aliasCurrentCommandCallbackId = args[3];

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                PhoneApplicationPage page = Page;
                if (page != null)
                {
                    Grid grid = page.FindName("LayoutRoot") as Grid;
                    if (grid != null)
                    {
                        var previous = notifyBox;
                        notifyBox = new NotificationBox();
                        notifyBox.Tag = new { previous = previous, callbackId = aliasCurrentCommandCallbackId };
                        notifyBox.PageTitle.Text = alertOpts.title;
                        notifyBox.SubTitle.Text = alertOpts.message;
                        Button btnOK = new Button();
                        btnOK.Content = alertOpts.buttonLabel;
                        btnOK.Click += new RoutedEventHandler(btnOK_Click);
                        btnOK.Tag = 1;
                        notifyBox.ButtonPanel.Children.Add(btnOK);
                        grid.Children.Add(notifyBox);

                        if (previous == null)
                        {
                            page.BackKeyPress += page_BackKeyPress;
                        }
                    }
                }
                else
                {
                    DispatchCommandResult(new PluginResult(PluginResult.Status.INSTANTIATION_EXCEPTION));
                }
            });
        }
开发者ID:VyaraGGeorgieva,项目名称:TelerikAcademy,代码行数:41,代码来源:Notification.cs

示例5: page_BackKeyPress

        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);
                    dynamic notifBoxData = notifyBox.Tag;
                    notifyBox = notifBoxData.previous as NotificationBox;
                    callbackId = notifBoxData.callbackId as string;
                }
                if (notifyBox == null)
                {
                    page.BackKeyPress -= page_BackKeyPress;
                }
                e.Cancel = true;
            }

            DispatchCommandResult(new PluginResult(PluginResult.Status.OK, 0), callbackId);
        }
开发者ID:VyaraGGeorgieva,项目名称:TelerikAcademy,代码行数:23,代码来源:Notification.cs

示例6: prompt

        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;
                        notifyBox = new NotificationBox();
                        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));
                }
            });
        }
开发者ID:CN-Onboarding,项目名称:Cerner-Onboarding,代码行数:55,代码来源:Notification.cs

示例7: btnOK_Click

 void btnOK_Click(object sender, RoutedEventArgs e)
 {
     Button btn = sender as Button;
     int retVal = 0;
     if (btn != null)
     {
         retVal = (int)btn.Tag + 1;
     }
     if (notifBox != null)
     {
         PhoneApplicationPage page = Page;
         if (page != null)
         {
             Grid grid = page.FindName("LayoutRoot") as Grid;
             if (grid != null)
             {
                 grid.Children.Remove(notifBox);
             }
         }
         notifBox = null;
     }
     DispatchCommandResult(new PluginResult(PluginResult.Status.OK, retVal));
 }
开发者ID:hendyyou,项目名称:phonegap,代码行数:23,代码来源:Notification.cs


注:本文中的WPCordovaClassLib.Cordova.UI.NotificationBox类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。