private void sendToast(object sender, RoutedEventArgs e)
        {
            IToastImageAndText01 toastContent = ToastContentFactory.CreateToastImageAndText01();

            toastContent.Launch            = "this is launch string test";
            toastContent.TextBodyWrap.Text = "破船,恭喜你,中500W!";
            toastContent.Image.Src         = "/Assets/98_avatar_big.jpg";

            ToastNotificationManager.CreateToastNotifier().Show(toastContent.CreateNotification());
        }
Example #2
0
        public static void DisplaySingleLine(String _text)
        {
            IToastImageAndText01 templateContent = ToastContentFactory.CreateToastImageAndText01();

            templateContent.TextBodyWrap.Text = _text;
            templateContent.Image.Src         = "Icons/toastImageAndText.png";
            IToastNotificationContent toastContent = templateContent;

            ToastNotification toast = toastContent.CreateNotification();

            ToastNotificationManager.CreateToastNotifier().Show(toast);
        }
        void DisplayWebImageToast(ToastTemplateType templateType)
        {
            IToastNotificationContent toastContent = null;
            string toastImageSrc = Scenario3ImageUrl.Text;

            if (templateType == ToastTemplateType.ToastImageAndText01)
            {
                IToastImageAndText01 templateContent = ToastContentFactory.CreateToastImageAndText01();
                templateContent.TextBodyWrap.Text = "Body text that wraps";
                templateContent.Image.Src         = toastImageSrc;
                templateContent.Image.Alt         = ALT_TEXT;
                toastContent = templateContent;
            }
            else if (templateType == ToastTemplateType.ToastImageAndText02)
            {
                IToastImageAndText02 templateContent = ToastContentFactory.CreateToastImageAndText02();
                templateContent.TextHeading.Text  = "Heading text";
                templateContent.TextBodyWrap.Text = "Body text that wraps.";
                templateContent.Image.Src         = toastImageSrc;
                templateContent.Image.Alt         = ALT_TEXT;
                toastContent = templateContent;
            }
            else if (templateType == ToastTemplateType.ToastImageAndText03)
            {
                IToastImageAndText03 templateContent = ToastContentFactory.CreateToastImageAndText03();
                templateContent.TextHeadingWrap.Text = "Heading text that wraps";
                templateContent.TextBody.Text        = "Body text";
                templateContent.Image.Src            = toastImageSrc;
                templateContent.Image.Alt            = ALT_TEXT;
                toastContent = templateContent;
            }
            else if (templateType == ToastTemplateType.ToastImageAndText04)
            {
                IToastImageAndText04 templateContent = ToastContentFactory.CreateToastImageAndText04();
                templateContent.TextHeading.Text = "Heading text";
                templateContent.TextBody1.Text   = "Body text";
                templateContent.TextBody2.Text   = "Another body text";
                templateContent.Image.Src        = toastImageSrc;
                templateContent.Image.Alt        = ALT_TEXT;
                toastContent = templateContent;
            }

            rootPage.NotifyUser(toastContent.GetContent(), NotifyType.StatusMessage);

            // Create a toast from the Xml, then create a ToastNotifier object to show
            // the toast
            ToastNotification toast = toastContent.CreateNotification();

            // If you have other applications in your package, you can specify the AppId of
            // the app to create a ToastNotifier for that application
            ToastNotificationManager.CreateToastNotifier().Show(toast);
        }
Example #4
0
        private void toastMessage(string img, string text)
        {
            IToastNotificationContent itnc = null;
            //Tạo toast message template
            IToastImageAndText01 itoast = ToastContentFactory.CreateToastImageAndText01();

            //Đưa nội dung message lên itoast
            itoast.TextBodyWrap.Text = text;
            //Đưa image lên itoast
            itoast.Image.Src = "ms-appx:///Assets/" + img;

            itnc = itoast;

            //Tạo toast message
            ToastNotification tnc = itnc.CreateNotification();

            //Hiển thị toast message
            ToastNotificationManager.CreateToastNotifier().Show(tnc);
        }
Example #5
0
        public static void DisplayTextToast(ToastTemplateType templateType, string fromId, string content, string imageUri)
        {
            // Creates a toast using the notification object model, which is another project
            // in this solution.  For an example using Xml manipulation, see the function
            // DisplayToastUsingXmlManipulation below.
            IToastNotificationContent toastContent = null;

            if (templateType == ToastTemplateType.ToastText01)
            {
                IToastText01 templateContent = ToastContentFactory.CreateToastText01();
                templateContent.TextBodyWrap.Text = "Body text that wraps over three lines";
                toastContent = templateContent;
            }
            else if (templateType == ToastTemplateType.ToastText02)
            {
                IToastText02 templateContent = ToastContentFactory.CreateToastText02();
                templateContent.TextHeading.Text  = "Heading text";
                templateContent.TextBodyWrap.Text = "Body text that wraps over two lines";
                toastContent = templateContent;
            }
            else if (templateType == ToastTemplateType.ToastText03)
            {
                IToastText03 templateContent = ToastContentFactory.CreateToastText03();
                templateContent.TextHeadingWrap.Text = "Heading text that is very long and wraps over two lines";
                templateContent.TextBody.Text        = "Body text";
                toastContent = templateContent;
            }
            else if (templateType == ToastTemplateType.ToastText04)
            {
                IToastText04 templateContent = ToastContentFactory.CreateToastText04();
                templateContent.TextHeading.Text = "Heading text";
                templateContent.TextBody1.Text   = "First body text";
                templateContent.TextBody2.Text   = "Second body text";
                toastContent = templateContent;
            }
            else if (templateType == ToastTemplateType.ToastImageAndText01)
            {
                IToastImageAndText01 templateContent = ToastContentFactory.CreateToastImageAndText01();
                if (String.IsNullOrWhiteSpace(content) == false)
                {
                    templateContent.TextBodyWrap.Text = content;
                }
                else
                {
                    templateContent.TextBodyWrap.Text = "text here!";
                }

                if (String.IsNullOrWhiteSpace(imageUri) == false)
                {
                    templateContent.Image.Src = imageUri;
                }
                else
                {
                    templateContent.Image.Src = "http://singularlabs.com/wp-content/uploads/2011/11/System-Ninja-2.2.png";
                }

                toastContent = templateContent;
            }

            // Create a toast, then create a ToastNotifier object to show
            // the toast
            ToastNotification           toast = toastContent.CreateNotification();
            Dictionary <String, String> args  = new Dictionary <String, String>();

            args.Add("fromId", fromId);
            args.Add("content", content);
            //toast.Activated += ToastTapped(toast, args);
            toast.Activated += new TypedEventHandler <ToastNotification, object>((sender, e) => ToastTapped(toast, args));
            // If you have other applications in your package, you can specify the AppId of
            // the app to create a ToastNotifier for that application
            ToastNotificationManager.CreateToastNotifier().Show(toast);
        }