Create your own custom actions, using controls like ToastButton, ToastTextBox, and ToastSelectionBox.
Наследование: IToastActions
        public ToastActionsCustom GetToastCustomActions(IEnumerable<IToastInput> textBoxes, IEnumerable<IToastButton> buttons, string audioUri = null)
        {
            ToastActionsCustom actions = new ToastActionsCustom();

            if (textBoxes != null && textBoxes.Count() <= 5)
            {
                textBoxes.ForEach(tb => actions.Inputs.Add(tb));
            }

            if (buttons != null && buttons.Count() <= 5)
            {
                buttons.ForEach(tb => actions.Buttons.Add(tb));
            }

            return actions;
        }
        public ToastContent GetToastContent(ToastVisual visual, ToastActionsCustom actions)
        {
            var content = new ToastContent();

            if (visual != null)
            {
                content.Visual = visual;
            }

            if (actions != null)
            {
                content.Actions = actions;
            }

            //content.Audio = new ToastAudio()
            //{
            //    Src = new Uri("ms-winsoundevent:Notification.IM")
            //};

            return content;
        }
        private void ButtonSendToast_Click(object sender, RoutedEventArgs e)
        {
            // In a real app, these would be initialized with actual data
            string title = "Andrew sent you a picture";
            string content = "Check this out, Happy Canyon in Utah!";
            string image = "http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-81-permanent/2727.happycanyon1_5B00_1_5D00_.jpg";
            string logo = "ms-appdata:///local/Andrew.jpg";
            int conversationId = "384928";

            // Construct the visuals of the toast
            ToastVisual visual = new ToastVisual()
            {
                TitleText = new ToastText()
                {
                    Text = title
                },

                BodyTextLine1 = new ToastText()
                {
                    Text = content
                },

                InlineImages =
                {
                    new ToastImage()
                    {
                        Source = new ToastImageSource(image)
                    }
                },

                AppLogoOverride = new ToastAppLogo()
                {
                    Source = new ToastImageSource(logo),
                    Crop = ToastImageCrop.Circle
                }
            };

            // Construct the actions for the toast (inputs and buttons)
            ToastActionsCustom actions = new ToastActionsCustom()
            {
                Inputs =
                {
                    new ToastTextBox("tbReply")
                    {
                        PlaceholderContent = "Type a response"
                    }
                },

                Buttons =
                {
                    new ToastButton("Reply", new QueryString()
                    {
                        { "action", "reply" },
                        { "conversationId", conversationId.ToString() }

                    }.ToString())
                    {
                        ActivationType = ToastActivationType.Background,
                        ImageUri = "Assets/Reply.png",

                        // Reference the text box's ID in order to
                        // place this button next to the text box
                        TextBoxId = "tbReply"
                    },

                    new ToastButton("Like", new QueryString()
                    {
                        { "action", "like" },
                        { "conversationId", conversationId.ToString() }

                    }.ToString())
                    {
                        ActivationType = ToastActivationType.Background
                    },

                    new ToastButton("View", new QueryString()
                    {
                        { "action", "viewImage" },
                        { "imageUrl", image }

                    }.ToString())
                }
            };


            // Now we can construct the final toast content
            ToastContent toastContent = new ToastContent()
            {
                Visual = visual,
                Actions = actions,

                // Arguments when the user taps body of toast
                Launch = new QueryString()
                {
                    { "action", "viewConversation" },
                    { "conversationId", conversationId.ToString() }

                }.ToString()
            };


            // And create the toast notification
            ToastNotification notification = new ToastNotification(toastContent.GetXml());


            // And then send the toast
            ToastNotificationManager.CreateToastNotifier().Show(notification);
        }
Пример #4
0
        private async void downloadbutton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Tracker myTracker = EasyTracker.GetTracker();
              myTracker.SendEvent("Downloads", "Download Button Clicked", "Download Attempted",1);
                Uri source = new Uri("http://convertmyurl.net/?url=" + urltext.Text.Trim());
                ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
                StorageFolder folder;
                string pathname;
                object v = localSettings.Values["pathkey"];
                if (v != null)
                {
                    pathname = v.ToString();
                    try {
                        folder = await StorageFolder.GetFolderFromPathAsync(pathname);
                    }
                    catch(FileNotFoundException ex)
                    {
                        folder = await KnownFolders.PicturesLibrary.CreateFolderAsync("PDF Me", CreationCollisionOption.OpenIfExists);
                    }
                }
                else {
                     folder = await KnownFolders.PicturesLibrary.CreateFolderAsync("PDF Me", CreationCollisionOption.OpenIfExists);
                    
                }
                string filename;

                object value = localSettings.Values["filekey"];
                if (value != null)
                {
                   filename  = localSettings.Values["filekey"].ToString();
                    Debug.WriteLine("New filename");
                }
                else
                {
                    filename = "PDF Me.pdf";
                    Debug.WriteLine("Default filename");
                }
                char[] a = new char[25];
                StorageFile destinationFile;
                if (browserweb.DocumentTitle.Length > 60)
                {
                    destinationFile = await folder.CreateFileAsync(
                 "PDF Me.pdf", CreationCollisionOption.GenerateUniqueName);
                }
                else
                {
                    destinationFile = await folder.CreateFileAsync(
                browserweb.DocumentTitle+".pdf", CreationCollisionOption.GenerateUniqueName);
                }
                BackgroundDownloader downloader = new BackgroundDownloader();
                DownloadOperation download = downloader.CreateDownload(source, destinationFile);
                downloading.Visibility = Visibility.Visible;
                downloadprogress.Visibility = Visibility.Visible;
                downloadprogress.IsActive = true;
                await download.StartAsync();


                int progress = (int)(100 * (download.Progress.BytesReceived / (double)download.Progress.TotalBytesToReceive));
                if (progress >= 100)
                {
                    myTracker.SendEvent("Downloads", "Download Finished", "Download Successfull", 2);
                    downloading.Visibility = Visibility.Collapsed;
                    downloading.Text = "Downloading: ";
                    downloadprogress.Visibility = Visibility.Collapsed;
                    BasicProperties basic = await download.ResultFile.GetBasicPropertiesAsync();
                    string size;
                        double siz = basic.Size;
               //     ulong mb = ulong.Parse(1000000);
                    if (siz > 1000000)
                    {
                        double s = siz / 1000000;
                        size = s.ToString() + "MB";
                    }
                    else
                    {
                        double s = siz / 1000;
                        
                        size = s.ToString() + "KB";
                    }

                    DatabaseController.AddDownload(destinationFile.Name, download.ResultFile.Path,download.ResultFile.DateCreated.DateTime.ToString(),size);
                    AdDuplex.InterstitialAd interstitialAd = new AdDuplex.InterstitialAd("180815");
                    await interstitialAd.LoadAdAsync();
                    /* MessageDialog m = new MessageDialog(destinationFile.Name + " is saved in PDF Me folder.", "Download Completed");
                     m.Commands.Add(new UICommand("Open File", (command) =>
                     {
                          Launcher.LaunchFileAsync(download.ResultFile);
                     }
                     ));

                     m.Commands.Add(new UICommand("Close", (command) =>
                     {

                     }, 0));

                     m.CancelCommandIndex = 0;
                   await  m.ShowAsync();
                   */
                    string title = "Download Successful";
                    string content = destinationFile.Name + " is saved in PDF Me folder.";
                    ToastVisual visual = new ToastVisual()
                    {
                        TitleText = new ToastText()
                        {
                            Text = title
                        },

                        BodyTextLine1 = new ToastText()
                        {
                            Text = content
                        }
                    };
                    // In a real app, these would be initialized with actual data
                    int conversationId = 384928;

                    // Construct the actions for the toast (inputs and buttons)
                    ToastActionsCustom actions = new ToastActionsCustom()
                    {


                        Buttons =
    {
        new ToastButton("Open", new QueryString()
        {
            { "action", "open" },
            {"file",destinationFile.Path }

        }.ToString())
        {
            ActivationType = ToastActivationType.Foreground,
           
 
            // Reference the text box's ID in order to
            // place this button next to the text box
            
        },

        new ToastButton("Share", new QueryString()
        {
            { "action", "share" },
              {"file",destinationFile.Path }
        }.ToString())
        {
            ActivationType = ToastActivationType.Foreground
        }

       
    }
                    };
                    // Now we can construct the final toast content
                    ToastContent toastContent = new ToastContent()
                    {
                        Visual = visual,
                        Actions = actions,

                        // Arguments when the user taps body of toast
                        Launch = new QueryString()
{

{ "conversationId", conversationId.ToString() }

}.ToString()
                    };

                    // And create the toast notification
                    var toast = new ToastNotification(toastContent.GetXml());
                    toast.ExpirationTime = DateTime.Now.AddSeconds(10);
                    ToastNotificationManager.CreateToastNotifier().Show(toast);

                    await interstitialAd.LoadAdAsync();
                    await interstitialAd.ShowAdAsync();



                }
                else

                {
                    downloading.Visibility = Visibility.Collapsed;
                    downloadprogress.Visibility = Visibility.Collapsed;
                    BasicProperties basic = await download.ResultFile.GetBasicPropertiesAsync();

                    double siz = basic.Size;
                    if(siz == 0)
                    {
                      await  destinationFile.DeleteAsync();
                        myTracker.SendEvent("Downloads", "Download Failed due to Server Error", null, 3);
                        MessageDialog m = new MessageDialog("Server is down. Try again later","Fatal Error");
                        await   m.ShowAsync();
                    }
                }
                /*
                var authClient = new LiveAuthClient();
                var authResult = await authClient.LoginAsync(new string[] { "wl.skydrive", "wl.skydrive_update" });
                if (authResult.Session == null)
                {
                    throw new InvalidOperationException("You need to sign in and give consent to the app.");
                }

                var liveConnectClient = new LiveConnectClient(authResult.Session);

                string skyDriveFolder = await CreateDirectoryAsync(liveConnectClient, "PDF Me - Saved PDFs", "me/skydrive");
            */
            }
            catch (Exception ex)
            {
               
                Tracker myTracker = EasyTracker.GetTracker();      // Get a reference to tracker.
                myTracker.SendException(ex.Message, false);
                MessageDialog m = new MessageDialog(ex.ToString());
                m.ShowAsync();
            }
        }
        private async void ReminderRegister()
        {

            const string title = "Are you there?";
            const string content = "Click the button below if you are alright!";

            var visual = new ToastVisual
            {
                TitleText = new ToastText
                {
                    Text = title
                },

                BodyTextLine1 = new ToastText
                {
                    Text = content
                }

            };

            var actions = new ToastActionsCustom
            {
                Buttons =
                {
                    new ToastButton("Dismiss", new QueryString
                    {
                        {"action", "dismiss"}
                    }.ToString())
                    {
                        ActivationType = ToastActivationType.Background
                    }
                }

            };

            const int conversationId = 177777;

            var toastContent = new ToastContent
            {
                Visual = visual,
                Actions = actions,
                Scenario = ToastScenario.Reminder,
                Launch = new QueryString
                {
                    {"action","viewConversation" },
                    {"conversationId", conversationId.ToString()}
                }.ToString()
            };

            if (Time > DateTime.Now.TimeOfDay)
            {
                try
                {
                    var scheduled = new ScheduledToastNotification(toastContent.GetXml(),
                        new DateTimeOffset(DateTime.Today + Time)) {Id = "scheduledtoast"};

                    var timeDifference = Time - DateTime.Now.TimeOfDay;
                    timeDifference = timeDifference.Add(new TimeSpan(0, 0, 15, 0));
                    const string taskName = "Reminder";
                    var taskBuilder = new BackgroundTaskBuilder();
                    taskBuilder.Name = taskName;
                    taskBuilder.TaskEntryPoint = typeof (Reminder).FullName;
                    taskBuilder.SetTrigger(new TimeTrigger(Convert.ToUInt32(timeDifference.Minutes.ToString()), true));

                    var backgroundAccessStatus = await BackgroundExecutionManager.RequestAccessAsync();

                    foreach (var task in BackgroundTaskRegistration.AllTasks.Where(task => task.Value.Name == taskName))
                    {
                        task.Value.Unregister(true);
                    }
                    taskBuilder.Register();
                    ToastNotificationManager.CreateToastNotifier().AddToSchedule(scheduled);
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e);
                }
            }
            else
            {
                try
                {
                    var scheduled = new ScheduledToastNotification(toastContent.GetXml(),
                        new DateTimeOffset(DateTime.Today.AddDays(1) + Time))
                    {Id = "scheduledtoast"};
                    
                    var timeDifference = Time.Add(new TimeSpan(1,0,0,0)) ;
                    timeDifference = timeDifference.Add(new TimeSpan(0, 0, 15, 0));
                    const string taskName = "Reminder";
                    var taskBuilder = new BackgroundTaskBuilder();
                    taskBuilder.Name = taskName;
                    taskBuilder.TaskEntryPoint = typeof (Reminder).FullName;
                    taskBuilder.SetTrigger(new TimeTrigger(Convert.ToUInt32(timeDifference.Minutes.ToString()), true));

                    var backgroundAccessStatus = await BackgroundExecutionManager.RequestAccessAsync();

                    foreach (var task in BackgroundTaskRegistration.AllTasks.Where(task => task.Value.Name == taskName))
                    {
                        task.Value.Unregister(true);
                    }

                    ToastNotificationManager.CreateToastNotifier().AddToSchedule(scheduled);
                    taskBuilder.Register();
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e);
                }
            }
            
        }
Пример #6
0
 public static ToastContent CreateAlarmToast(string[] str, CitySettingsModel currentCityModel)
 {
     var lo = new ResourceLoader();
     var action = new ToastActionsCustom();
     var button = new ToastButton(lo.GetString("Known"), "Today_Alarm_Dismiss");
     button.ActivationType = ToastActivationType.Background;
     action.Buttons.Add(button);
     action.Buttons.Add(new ToastButtonDismiss(lo.GetString("Okay")));
     ToastContent t = new ToastContent()
     {
         Scenario = ToastScenario.Reminder,
         Launch = currentCityModel.Id,
         Actions = action,
         Visual = new ToastVisual()
         {
             TitleText = new ToastText()
             {
                 Text = str[0]
             },
             BodyTextLine1 = new ToastText()
             {
                 Text = str[1]
             }
         }
     };
     return t;
 }
Пример #7
0
 public static ToastContent CreateAlertToast(HeWeatherModel fetchresult, CitySettingsModel currentCityModel)
 {
     var lo = new ResourceLoader();
     var action = new ToastActionsCustom();
     var button = new ToastButton(lo.GetString("Known"), "Today_Alert_Dismiss");
     button.ActivationType = ToastActivationType.Background;
     action.Buttons.Add(button);
     action.Buttons.Add(new ToastButtonDismiss(lo.GetString("Dismiss")));
     var alarm = fetchresult.Alarms[0];
     ToastContent t = new ToastContent()
     {
         Scenario = ToastScenario.Reminder,
         Launch = currentCityModel.Id,
         Actions = action,
         Visual = new ToastVisual()
         {
             TitleText = new ToastText()
             {
                 Text = alarm.Title
             },
             BodyTextLine1 = new ToastText()
             {
                 Text = alarm.Text
             }
         }
     };
     return t;
 }
        //Een (eenmalige) pop up tonen om toestemming aan de gebruiker te vragen voor zijn locatie
        private async void LocatieToestemmingVragen()
        {
            try
            {
                //De pop up tonen en toestemming vragen
                var accessStatus = await Geolocator.RequestAccessAsync();

                //De mogelijke antwoorden overlopen
                switch (accessStatus)
                {
                    case GeolocationAccessStatus.Allowed: //De gebruiker heeft ons toegang gegeven

                        //Mag verdergaan en inloggen
                        this.EnableLogin = true;

                        //aanmaken Geolocator
                        Geolocator geolocator = new Geolocator();

                        //Inschrijven op de StatusChanged voor updates van de permissies voor locaties.
                        geolocator.StatusChanged += OnStatusChanged;
                        geolocator.PositionChanged += OnPositionChanged();

                        //Locatie opvragen
                        Geoposition pos = await geolocator.GetGeopositionAsync();
                        Debug.WriteLine("Positie opgevraagd, lat: " + pos.Coordinate.Point.Position.Latitude + " lon: " + pos.Coordinate.Point.Position.Longitude);

                        //Locatie opslaan als gebruikerslocatie
                        (App.Current as App).UserLocation = pos;

                        break;

                    case GeolocationAccessStatus.Denied: //De gebruiker heeft ons geen toegang gegeven.
                        Debug.WriteLine("Geen locatie: Toestemming geweigerd");

                        //We gaan een Toast tonen om te zeggen dat we de locatie nodig hebben.
                        //Aanmaken tekst voor in Toast
                        string title = "Locatie Nodig";
                        string content = "We krijgen geen toegang tot uw locatie, deze staat softwarematig uitgeschakeld of u geeft ons geen toegang.";

                        //De visuals van de Toast aanmaken
                        ToastVisual visual = new ToastVisual()
                        {
                            TitleText = new ToastText()
                            {
                                Text = title
                            },
                            BodyTextLine1 = new ToastText()
                            {
                                Text = content
                            },
                            AppLogoOverride = new ToastAppLogo()
                            {
                                Source = new ToastImageSource("../Assets/StoreLogo.png"),
                                Crop = ToastImageCrop.Circle
                            }
                        };

                        //De interacties met de toast aanmaken
                        ToastActionsCustom actions = new ToastActionsCustom()
                        {
                            Buttons =
                        {
                            new ToastButton("Geef Toestemming", new QueryString()
                            {
                                {"action", "openLocationServices" }
                            }.ToString())
                        }
                        };

                        //De final toast content aanmaken
                        ToastContent toastContent = new ToastContent()
                        {
                            Visual = visual,
                            Actions = actions,

                            //Argumenten wanneer de user de body van de toast aanklikt
                            Launch = new QueryString()
                        {
                            { "action", "openBobApp"}
                        }.ToString()
                        };

                        //De toast notification maken
                        var toast = new ToastNotification(toastContent.GetXml());
                        toast.ExpirationTime = DateTime.Now.AddDays(2);//Tijd totdat de notification vanzelf verdwijnt

                        //En uiteindelijk de toast tonen
                        ToastNotificationManager.CreateToastNotifier().Show(toast);

                        break;

                    case GeolocationAccessStatus.Unspecified: //Er is iets vreemds misgelopen
                        Debug.WriteLine("Geen locatie: Unspecified");
                        break;

                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error in LoginVM, LocatieToestemmingVragen: " + ex.Message);
            }
        }
Пример #9
0
        private void DowloadFinish(StorageFile destinationFile)
        {
            string title = "Download Successful";
            string content = destinationFile.Name + " is saved in PDF Me folder.";
            ToastVisual visual = new ToastVisual()
            {
                TitleText = new ToastText()
                {
                    Text = title
                },

                BodyTextLine1 = new ToastText()
                {
                    Text = content
                }
            };
            // In a real app, these would be initialized with actual data
            int conversationId = 384928;

            // Construct the actions for the toast (inputs and buttons)
            ToastActionsCustom actions = new ToastActionsCustom()
            {


                Buttons =
    {
        new ToastButton("Open", new QueryString()
        {
            { "action", "open" },
            {"file",destinationFile.Path }

        }.ToString())
        {
            ActivationType = ToastActivationType.Foreground,
           
 
            // Reference the text box's ID in order to
            // place this button next to the text box
            
        },

        new ToastButton("Share", new QueryString()
        {
            { "action", "share" },
              {"file",destinationFile.Path }
        }.ToString())
        {
            ActivationType = ToastActivationType.Foreground
        }


    }
            };
            // Now we can construct the final toast content
            ToastContent toastContent = new ToastContent()
            {
                Visual = visual,
                Actions = actions,

                // Arguments when the user taps body of toast
                Launch = new QueryString()
{

{ "conversationId", conversationId.ToString() }

}.ToString()
            };

            // And create the toast notification
            var toast = new ToastNotification(toastContent.GetXml());
            toast.ExpirationTime = DateTime.Now.AddSeconds(10);
            ToastNotificationManager.CreateToastNotifier().Show(toast);
        }
        private static ToastActionsCustom GetAction(string ok, string nok, Type viewOk, Type viewNok, object paramView, string cb, object data)
        {
           
            // In a real app, these would be initialized with actual data
            ToastActionsCustom actions;
            if (nok != null)
            {
               actions = new ToastActionsCustom()
                {
                    Buttons =
                {

                    new ToastButton(ok, new QueryString()
                    {
                        { "action", "ok" },
                        { "value", ok.ToString() },
                        { "viewOk", JsonConvert.SerializeObject(viewOk) },
                        { "viewNok",JsonConvert.SerializeObject(viewNok) },
                        { "paramView", JsonConvert.SerializeObject(paramView) },
                        { "cb", cb },
                        { "data", JsonConvert.SerializeObject(data) }

                    }.ToString())
                    {
                        //ActivationType = ToastActivationType.Background
                    },

                    new ToastButton(nok, new QueryString()
                    {
                        { "action", "nok" },
                        { "value", nok.ToString() },
                        { "viewOk", JsonConvert.SerializeObject(viewOk) },
                        { "viewNok",JsonConvert.SerializeObject(viewNok) },
                        { "paramView", JsonConvert.SerializeObject(paramView) },
                        { "cb", cb },
                        { "data", JsonConvert.SerializeObject(data) }

                    }.ToString())
                    {
                        //ActivationType = ToastActivationType.Background
                    }


                }
                };
            }
            else
            {
                actions = new ToastActionsCustom()
                {
                    Buttons =
                {

                    new ToastButton(ok, new QueryString()
                    {
                        { "action", "ok" },
                        { "conversationId", conversationId.ToString() },
                        { "value", ok.ToString() },
                        { "viewOk", JsonConvert.SerializeObject(viewOk) },
                        { "viewNok",JsonConvert.SerializeObject(viewNok) },
                        { "paramView", JsonConvert.SerializeObject(paramView) },
                        { "cb", cb },
                        { "data", JsonConvert.SerializeObject(data) }

                    }.ToString())
                    {
                        //ActivationType = ToastActivationType.Background
                    }

                   

                }
                };
            }

            
            
            return actions;
        }
Пример #11
0
        public void NotifyWithUrl(string title, string message, string url)
        {
            ToastVisual visual = new ToastVisual()
            {
                TitleText = new ToastText()
                {
                    Text = title
                },
                BodyTextLine1 = new ToastText()
                {
                    Text = message
                },
                AppLogoOverride = new ToastAppLogo()
                {
                    Crop = ToastImageCrop.Circle,
                    Source = new ToastImageSource("http://i.imgur.com/qeFYZoL.png?1")
                }
            };

            ToastActionsCustom actions = new ToastActionsCustom()
            {
                Buttons = {
                    new ToastButton("Browse unwatched", new QueryString()
                    {
                        { "action", "openurl" },
                        { "url", url }

                    }.ToString())
                    {
                        ActivationType = ToastActivationType.Foreground
                    },
                    new ToastButtonDismiss("Not now...")
                }
            };

            _toastContent = new ToastContent()
            {
                Visual = visual,
                Actions = actions,

                // Arguments when the user taps body of toast
                Launch = new QueryString()
                {
                    { "action", "openurl" },
                    { "url", url }

                }.ToString()
            };
            SendNotification();
        }
//#warning PUSH_NOTIFICATIONS_VIEW_MODEL_SHOW_TOAST_NOT_IMPLEMENTED
        public void ShowToast(IDictionary<string,string> parametrs)
        {
            var visual = new ToastVisual();
            var actions = new ToastActionsCustom();

            switch (parametrs["type"])
            {
                case "a":
                {
                    visual.TitleText = new ToastText { Text = "Обновления автора" };
                    visual.BodyTextLine1 = new ToastText() {Text = parametrs["text"]};

                    //var openButton = new ToastButton("Открыть", new QueryString
                    //{
                    //    {"action", "openAuthor"},
                    //    {"internalId", parametrs["internal_id"]}
                    //}.ToString()) {ActivationType = ToastActivationType.Foreground};
                    //actions.Buttons.Add(openButton);
                    

                    break;
                }
                case "b":
                {
                    visual.TitleText = new ToastText { Text = "Обновления книги" };
                    visual.BodyTextLine1 = new ToastText() {Text = parametrs["text"]};

                    //var openButton = new ToastButton("Открыть", new QueryString
                    //{
                    //    {"action", "openBook"},
                    //    {"internalId", parametrs["internal_id"]}
                    //}.ToString()) {ActivationType = ToastActivationType.Foreground};
                    //var holdButton = new ToastButton("Отложить", new QueryString()
                    //{
                    //    {"action", "holdBook"},
                    //    {"internalId", parametrs["internal_id"]}
                    //}.ToString()) {ActivationType = ToastActivationType.Background};
                    //actions.Buttons.Add(openButton);
                    //actions.Buttons.Add(holdButton);
                    
                    break;
                }
                case "c":
                {
                    visual.TitleText = new ToastText { Text = "Обновления коллекции" };
                    visual.BodyTextLine1 = new ToastText() {Text = parametrs["text"]};

                    //var openButton = new ToastButton("Открыть", new QueryString
                    //{
                    //    {"action", "openCollection"},
                    //    {"internalId", parametrs["internal_id"]}
                    //}.ToString()) {ActivationType = ToastActivationType.Foreground};
                    //actions.Buttons.Add(openButton);

                    break;
                }
                //case "test":
                //    {
                //        visual.TitleText = new ToastText { Text = "Обновления вашей библиотеки" };
                //        visual.BodyTextLine1 = new ToastText() { Text = parametrs["text"] };

                //        var openButton = new ToastButton("Открыть", new QueryString
                //    {
                //        {"action", "openCollection"},                       
                //    }.ToString())
                //        { ActivationType = ToastActivationType.Foreground };
                //        actions.Buttons.Add(openButton);

                //        break;
                //    }
            }

            var content = new ToastContent()
            {
                Visual = visual,
                Actions = actions
            };

            var toast = new ToastNotification(content.GetXml())
            {
                ExpirationTime = DateTime.Now.AddMinutes(1),
                Tag = parametrs["spam_pack_id"],
            };

            ToastNotificationManager.CreateToastNotifier().Show(toast);

            //ToastActionsCustom actions = new ToastActionsCustom()
            //{
            //    Buttons =
            //    {
            //        new ToastButton("Открыть", new QueryString()
            //        {
            //            {"action", "reply"},
            //            {"conversationId", conversationId.ToString()}

            //        }.ToString())
            //        {
            //            ActivationType = ToastActivationType.Background,
            //            ImageUri = "Assets/Reply.png",

            //            // Reference the text box's ID in order to
            //            // place this button next to the text box
            //            TextBoxId = "tbReply"
            //        },

            //        new ToastButton("Отмена", new QueryString()
            //        {
            //            {"action", "like"},
            //            {"conversationId", conversationId.ToString()}

            //        }.ToString())
            //        {
            //            ActivationType = ToastActivationType.Background
            //        },
            //    }
            //};

            //ToastContent toastContent = new ToastContent()
            //{
            //    Visual = visual,
            //    Actions = actions,

            //    // Arguments when the user taps body of toast
            //    Launch = new QueryString()
            //    {
            //        {"action", "viewConversation"},
            //        {"conversationId", conversationId.ToString()}

            //    }.ToString()
            //};

            //// And create the toast notification
            //var toast = new ToastNotification(toastContent.GetXml());

            //toast.ExpirationTime = DateTime.Now.AddMinutes(1);

            //toast.Tag = "1";

            //toast.Group = "Author push";

            //ToastNotificationManager.CreateToastNotifier().Show(toast);
            //Frame rootFrame = Window.Current.Content as Frame;

            //var screen = (Application.Current.RootVisual as Microsoft.Phone.Controls.PhoneApplicationFrame).CurrentSource;
            //if(screen.OriginalString.Contains("Reader")) return;

            //if (parametrs.ContainsKey(PARAM_TAG))
            //{
            //    var spamPackId = getSpamPackId(parametrs[PARAM_TAG]);
            //    if (spamPackId != string.Empty) SendToastSpampack(spamPackId, (int)NotificationEventTags.NotificationEventComing);
            //}

            //var toast = new ToastPrompt();
            //toast.MillisecondsUntilHidden = 15000;
            //if (parametrs.ContainsKey(TEXT1_TAG)) toast.Title = parametrs[TEXT1_TAG];
            //if (parametrs.ContainsKey(TEXT2_TAG)) toast.Message = parametrs[TEXT2_TAG];
            //if (parametrs.ContainsKey(PARAM_TAG)) toast.Tag = parametrs[PARAM_TAG];
            //toast.TextWrapping = TextWrapping.Wrap;
            //toast.TextOrientation = System.Windows.Controls.Orientation.Horizontal;
            //var bmp = new BitmapImage(new Uri("../Assets/ApplicationIcon.png", UriKind.RelativeOrAbsolute));
            //bmp.DecodePixelHeight = 32;
            //bmp.DecodePixelWidth = 32;
            //toast.ImageSource = bmp;
            //toast.Tap += onToastTap;
            //toast.Show();
        }