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);
        }
Beispiel #2
0
        /// <summary>
        /// CHeck if a new show is a available and display the toast notification
        /// </summary>
        public override async Task CheckAndDisplayAsync()
        {
            // Resolve model
            IReadableLimitable <Show> model;

            using (ILifetimeScope scope = ViewModelLocator.Container.BeginLifetimeScope())
                model = scope.Resolve <IReadableLimitable <Show> >();

            // Get last show Id from model
            int idLastShow = await model.GetLastInsertedId();

            // Get last show saved Id
            int idLastShowSaved = 0;

            if (ApplicationData.Current.LocalSettings.Values[_storageKey] != null)
            {
                idLastShowSaved = (int)ApplicationData.Current.LocalSettings.Values[_storageKey];
            }

            // If Ids are differents, update the saved Id and show a toast notification
            if (idLastShow != idLastShowSaved)
            {
                Show show = await model.GetAsync(idLastShow);

                IToastImageAndText04 toastContent = ToastContentFactory.CreateToastImageAndText04();

                toastContent.Image.Src = show.ImageUrl;
                toastContent.Image.Alt = show.Name;

                toastContent.TextHeading.Text = ResourcesAccessor.GetString("Shows_New");
                toastContent.TextBody1.Text   = show.Name;
                toastContent.TextBody2.Text   = string.Format(ResourcesAccessor.GetString("Shows_DateFormat"), show.Start_DateTime, show.End_DateTime);

                ToastNotification toast = toastContent.CreateNotification();
                ToastNotificationManager.CreateToastNotifier().Show(toast);

                ApplicationData.Current.LocalSettings.Values[_storageKey] = idLastShow;
            }
        }
Beispiel #3
0
        /// <summary>
        /// CHeck if a new news is a available and display the toast notification
        /// </summary>
        public override async Task CheckAndDisplayAsync()
        {
            // Resolve model
            IReadableLimitable <News> model;

            using (ILifetimeScope scope = ViewModelLocator.Container.BeginLifetimeScope())
                model = scope.Resolve <IReadableLimitable <News> >();

            // Get last news Id from model
            int idLastNews = await model.GetLastInsertedId();

            // Get last news saved Id
            int idLastNewsSaved = 0;

            if (ApplicationData.Current.LocalSettings.Values[_storageKey] != null)
            {
                idLastNewsSaved = (int)ApplicationData.Current.LocalSettings.Values[_storageKey];
            }

            // If Ids are differents, update the saved Id and show a toast notification
            if (idLastNews != idLastNewsSaved)
            {
                News news = await model.GetAsync(idLastNews);

                IToastImageAndText04 toastContent = ToastContentFactory.CreateToastImageAndText04();

                toastContent.Image.Src = news.ImageUrl;
                toastContent.Image.Alt = news.Title;

                toastContent.TextHeading.Text = ResourcesAccessor.GetString("News_New");
                toastContent.TextBody1.Text   = news.Title;
                toastContent.TextBody2.Text   = news.ShortText;

                ToastNotification toast = toastContent.CreateNotification();
                ToastNotificationManager.CreateToastNotifier().Show(toast);

                ApplicationData.Current.LocalSettings.Values[_storageKey] = idLastNews;
            }
        }