public void AddAppLogoOverrideTest_WithCustomLogoAndFullOptions_ReturnSelfWithCustomLogoAndOptionsAdded() { // Arrange Uri testAppLogoUriSrc = new Uri("C:/justatesturi.jpg"); ToastGenericAppLogoCrop testCropOption = ToastGenericAppLogoCrop.Circle; string testLogoAltText = "Test Logo Alt Text"; bool testLogoAddImageQuery = true; // Act ToastContentBuilder builder = new ToastContentBuilder(); ToastContentBuilder anotherReference = builder.AddAppLogoOverride(testAppLogoUriSrc, testCropOption, testLogoAltText, testLogoAddImageQuery); // Assert Assert.AreSame(builder, anotherReference); Assert.AreEqual(testAppLogoUriSrc.OriginalString, builder.Content.Visual.BindingGeneric.AppLogoOverride.Source); Assert.AreEqual(testCropOption, builder.Content.Visual.BindingGeneric.AppLogoOverride.HintCrop); Assert.AreEqual(testLogoAltText, builder.Content.Visual.BindingGeneric.AppLogoOverride.AlternateText); Assert.AreEqual(testLogoAddImageQuery, builder.Content.Visual.BindingGeneric.AppLogoOverride.AddImageQuery); }
public static void SendToast(string title = "Pixiv UWP", string content = "", string image = null, string logo = null, ToastGenericAppLogoCrop hintcrop = ToastGenericAppLogoCrop.None) { ToastVisual visual = new ToastVisual(); ToastBindingGeneric generic = new ToastBindingGeneric(); generic.Children.Add(new AdaptiveText() { Text = title }); generic.Children.Add(new AdaptiveText() { Text = content }); if (image != null) { generic.Children.Add(new AdaptiveImage { Source = image }); } if (logo != null) { generic.AppLogoOverride = new ToastGenericAppLogo(); generic.AppLogoOverride.Source = logo; generic.AppLogoOverride.HintCrop = hintcrop; } visual.BindingGeneric = generic; ToastContent tcontent = new ToastContent() { Visual = visual }; var toast = new ToastNotification(tcontent.GetXml()); ToastNotificationManager.CreateToastNotifier().Show(toast); }