本文整理汇总了C#中ToastPrompt.Show方法的典型用法代码示例。如果您正苦于以下问题:C# ToastPrompt.Show方法的具体用法?C# ToastPrompt.Show怎么用?C# ToastPrompt.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ToastPrompt
的用法示例。
在下文中一共展示了ToastPrompt.Show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveAndCloseClick
private void SaveAndCloseClick(object sender, RoutedEventArgs e)
{
var title = channelName.Text;
ToastPrompt toast = new ToastPrompt();
toast.Foreground = App.WhiteColor;
toast.MillisecondsUntilHidden = 1500;
if (String.IsNullOrWhiteSpace(title)&&title.Length < 3)
{
toast.Message = AppResources.channel_title_error;
toast.Show();
return;
}
string address = channelLink.Text;
if (String.IsNullOrWhiteSpace(address) || address.Equals("about:blank") ||
!(address.Length > 7 && address.StartsWith("http://") ||
address.Length > 8 && address.StartsWith("https://")))
{
toast.Message = AppResources.add_message_error;
toast.Show();
return;
}
App.ViewModel.Channel.Title=title;
App.ViewModel.Channel.URL=address;
App.ViewModel.MoveChannel(App.ViewModel.Channel, channelListPicker.SelectedIndex);
toast.Message = AppResources.channel_edit_done;
toast.Show();
NavigationService.GoBack();
}
示例2: webClient_DownloadStringCompleted
void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
RootObject root = new RootObject();
MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(e.Result));
DataContractJsonSerializer ser = new DataContractJsonSerializer(root.GetType());
ms.Position = 0;
root = ser.ReadObject(ms) as RootObject;
ms.Close();
#region Saving to storage
if (settings.Contains("root"))
{
settings.Remove("root");
settings.Add("root", root);
settings.Save();
Global.Root = root;
}
else
{
settings.Add("root", root);
settings.Save();
Global.Root = root;
}
#endregion
#region Toastprompt
Grid grid = this.LayoutRoot.Children[1] as Grid;
ToastPrompt tp = new ToastPrompt();
tp.Title = "Synch success";
tp.Message = "Downloaded " + root.words.Count + " words" ;
tp.VerticalAlignment = System.Windows.VerticalAlignment.Center;
tp.FontFamily = new FontFamily("Verdana");
tp.FontSize = 22;
tp.MillisecondsUntilHidden = 3000;
tp.Show();
#endregion
}
示例3: ShowMessage
public static void ShowMessage(string message, string title = "", Action action = null)
{
if (_popupOpen)
{
return;
}
var prompt = new ToastPrompt
{
Title = title,
Message = message,
Foreground = new SolidColorBrush(Colors.White),
TextWrapping = TextWrapping.Wrap
};
if (action != null)
{
prompt.Tap += (s, e) => action();
}
prompt.Completed += (sender, eventArgs) =>
{
_popupOpen = false;
};
_popupOpen = true;
prompt.Show();
}
示例4: Show
public static void Show(string message)
{
ToastPrompt prompt = new ToastPrompt();
prompt.Message = message;
prompt.Show();
}
示例5: MainPage_Loaded
private void MainPage_Loaded(object sender, RoutedEventArgs e)
{
ServiceLocator.Dispatcher = new DispatchAdapter();
loginViewModel = new LoginViewModel();
progressBar = new PerformanceProgressBar();
progressBar.IsIndeterminate = true;
ServiceLocator.Messenger.Subscribe<BaseViewMessage>(m =>
{
switch (m.Content.message)
{
case BaseViewMessage.MessageTypes.CONNECTION_ERROR:
ServiceLocator.Dispatcher.invoke(() =>
{
ToastPrompt toast = new ToastPrompt();
toast.Message = "Erro de conexão";
toast.Show();
if (ContentPanel.Children.Contains(progressBar))
this.ContentPanel.Children.Remove(progressBar);
});
break;
case BaseViewMessage.MessageTypes.LOGIN_CONNECTION_OK:
getCourses();
break;
case BaseViewMessage.MessageTypes.COURSE_CONNECTION_OK:
ServiceLocator.Dispatcher.invoke(() =>
{
NavigationService.Navigate(new Uri("/Views/CoursePage.xaml", UriKind.Relative));
});
break;
default:
break;
}
});
}
示例6: OnNavigatedTo
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
var toast = new ToastPrompt { Message = "attempt to get OnNavigatedTo failure" };
toast.Show();
base.OnNavigatedTo(e);
}
示例7: Toast
protected void Toast(string title, string message = null)
{
ToastPrompt toast = new ToastPrompt();
toast.Title = title;
if (!string.IsNullOrEmpty(message)) toast.Message = message;
toast.Show();
}
示例8: NotificationChannel_HttpNotificationReceived
void NotificationChannel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
{
var title = string.Empty;
var message = string.Empty;
using (var reader = new StreamReader(e.Notification.Body, Encoding.UTF8))
{
var temp = reader.ReadToEnd();
var data = temp.Split(';');
title = data[1];
message = data[0];
}
Dispatcher.BeginInvoke(async () =>
{
var toast = new ToastPrompt()
{
Background = new SolidColorBrush(Colors.White),
Foreground = new SolidColorBrush(Colors.Black),
Title = title,
FontSize = 30,
Message = message,
TextOrientation = System.Windows.Controls.Orientation.Vertical,
ImageSource = new BitmapImage(new Uri("/Assets/ApplicationIcon.png", UriKind.RelativeOrAbsolute))
};
toast.Show();
_timer = new DispatcherTimer() { Interval = new TimeSpan(0, 0, 5) };
_timer.Tick += timer_Tick;
_timer.Start();
});
}
示例9: CreateErrorNotification
public void CreateErrorNotification(Exception exception)
{
if (_scheduler == null)
return;
Task.Factory.StartNew(() =>
{
if (exception is System.Net.WebException)
{
ToastPrompt toast = new ToastPrompt();
toast.Title = "Baconography";
toast.Message = "We're having a hard time connecting to reddit";
toast.ImageSource = new BitmapImage(new Uri("Assets\\ApplicationIconSmall.png", UriKind.RelativeOrAbsolute));
toast.TextWrapping = System.Windows.TextWrapping.Wrap;
toast.Show();
Messenger.Default.Send<ConnectionStatusMessage>(new ConnectionStatusMessage { IsOnline = false, UserInitiated = false });
}
else if (exception.Message == "NotFound")
{
CreateNotification("There doesnt seem to be anything here");
}
else
{
ToastPrompt toast = new ToastPrompt();
toast.Title = "Baconography";
toast.Message = "We're having a hard time connecting to reddit, you might want to try again later";
toast.ImageSource = new BitmapImage(new Uri("Assets\\ApplicationIconSmall.png", UriKind.RelativeOrAbsolute));
toast.TextWrapping = System.Windows.TextWrapping.Wrap;
toast.Show();
}
}, System.Threading.CancellationToken.None, TaskCreationOptions.None, _scheduler);
}
示例10: SaveClick
private void SaveClick(object sender, EventArgs e)
{
string address = RssLink.Text;
if (String.IsNullOrWhiteSpace(address) || address.Equals("about:blank") ||
!(address.Length > 7 && address.StartsWith("http://") ||
address.Length > 8 && address.StartsWith("https://")))
{
ToastPrompt toast = new ToastPrompt();
toast.Foreground = App.WhiteColor;
toast.MillisecondsUntilHidden = 1500;
toast.Message = AppResources.add_message_error;
toast.Show();
return;
}
try
{
App.ViewModel.AddChannelCommand.DoExecute(address);
ToastPrompt toast = new ToastPrompt();
toast.Foreground = App.WhiteColor;
toast.MillisecondsUntilHidden = 1500;
toast.Message = AppResources.add_message;
toast.Show();
}
catch (Exception)
{
ToastPrompt toast = new ToastPrompt();
toast.MillisecondsUntilHidden = 1500;
toast.Message = AppResources.add_message_error;
toast.Foreground = App.WhiteColor;
toast.Show();
}
}
示例11: GetReviewCompleted
void GetReviewCompleted(object s, ViewModels.DoubanSearchCompletedEventArgs args)
{
App.SubjectReviewViewModel.GetReviewCompleted -= GetReviewCompleted;
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
if (args.IsSuccess)
{
contentContainer.Visibility = Visibility.Visible;
contentContainer.IsEnabled = false;
DataContext = args.Result;
this.SetProgressIndicator(false);
contentContainer.IsEnabled = true;
foreach (var content in App.SubjectReviewViewModel.ReveiwContentList)
{
TextBlock tb = new TextBlock();
//tb.Width = 445;
tb.TextWrapping = TextWrapping.Wrap;
tb.Foreground = new SolidColorBrush(Colors.Black);
tb.FontSize = (double)App.Current.Resources["PhoneFontSizeMedium"];
tb.Text = content;
spContent.Children.Add(tb);
}
contentContainer.ScrollToVerticalOffset(0);
}
else
{
ToastPrompt toast = new ToastPrompt();
toast.Message = args.Message;
toast.Show();
}
});
}
示例12: ShowCoding4FunToastNotify
/// <summary>
/// User Coding4Fun Component build user define toast nofity
/// </summary>
/// <param name="message">Message</param>
/// <param name="title">Title</param>
/// <param name="timeout">Time Out</param>
/// <param name="foregroundColor">Forground Color</param>
/// <param name="backgroundColor">Background Color</param>
public void ShowCoding4FunToastNotify(string message, string title, int timeout = 2000, double fontSize = 20, SolidColorBrush forgroundColor = null, SolidColorBrush backgroundColor = null)
{
ToastPrompt toastPrompt = new ToastPrompt()
{
Message = message,
Title = title,
IsTimerEnabled = true,
MillisecondsUntilHidden = timeout,
IsAppBarVisible = true,
FontSize = fontSize
};
if (forgroundColor == null)
toastPrompt.Foreground = new SolidColorBrush(Colors.White);
else
toastPrompt.Foreground = forgroundColor;
if (backgroundColor == null)
toastPrompt.Background = new SolidColorBrush(new RgbConvertToColorHelper().GetColorFromHexString("1BA1E2")); //new SolidColorBrush(Colors.Green);
else
toastPrompt.Background = backgroundColor;
toastPrompt.TextOrientation = System.Windows.Controls.Orientation.Horizontal;
toastPrompt.Show();
}
示例13: Execute
public void Execute(object parameter)
{
MediaItemsListModelItem mediaItem = parameter as MediaItemsListModelItem;
switch (mediaItem.ItemState)
{
case MediaItemState.Local:
// TEMPORARY: log media item playback
App.Engine.StatisticsManager.LogMediaPlayback(mediaItem);
if (mediaItem.IsChanged)
{
mediaItem.IsChanged = false;
Library.markItemWatched(mediaItem.Id);
}
NedEngine.Utils.NavigateTo("/MediaItemsViewerPage.xaml?id=" + mediaItem.Id);
break;
case MediaItemState.Downloading:
ToastPrompt toast = new ToastPrompt();
toast.Message = String.Format("{0} is already queued for download", mediaItem.Title == String.Empty ? "Item" : mediaItem.Title);
toast.Show();
break;
case MediaItemState.Remote:
AddItemToQueueCommand.GetCommand().Execute(mediaItem);
break;
default:
System.Diagnostics.Debug.Assert(false, "Unknown media item state when media item requested - unable to make decision what to do");
break;
}
}
开发者ID:nokiaeducationdelivery,项目名称:ned-mobile-client-for-WP,代码行数:29,代码来源:MediaItemRequestedCommand.cs
示例14: btn_selectRoadMaps_Click
/// <summary>
/// Selectionne les roadmaps en fonction d'un intervalle de temps
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btn_selectRoadMaps_Click(object sender, RoutedEventArgs e)
{
if (!App.IsConnected())
{
MessageBox.Show("Vous n'êtes pas connecté à internet");
return;
}
collection.Items.Clear();
IRoadMapManager manager = new RoadMapManager();
manager.AllRoadMapsReceived += (o, eRoadMapReceived) =>
{
if (eRoadMapReceived.Error)
{
MessageBox.Show(eRoadMapReceived.MessageError);
this.enableInterface();
return;
}
for (int i=0; i < eRoadMapReceived.RoadMaps.Count; i++)
{
var roadmap = eRoadMapReceived.RoadMaps[i];
collection.Items.Add(new DateAndPositions(i, roadmap));
}
manager.AllRoadMapsReceived = null;
this.enableInterface();
ToastPrompt toast = new ToastPrompt();
toast.Title = "Résultats";
toast.Message = eRoadMapReceived.RoadMaps.Count + " feuille(s) de route récupérée(s)";
toast.Show();
};
if (!IsolatedStorageSettings.ApplicationSettings.Contains("latiAdrDepart") ||
!IsolatedStorageSettings.ApplicationSettings.Contains("longiAdrDepart")||
!IsolatedStorageSettings.ApplicationSettings.Contains("VilleDepart") ||
!IsolatedStorageSettings.ApplicationSettings.Contains("latiAdrArriver")||
!IsolatedStorageSettings.ApplicationSettings.Contains("longiAdrArriver")||
!IsolatedStorageSettings.ApplicationSettings.Contains("VilleArriver") ||
!IsolatedStorageSettings.ApplicationSettings.Contains("ConsoCarburant")||
!IsolatedStorageSettings.ApplicationSettings.Contains("PrixCarburant"))
{
MessageBox.Show("Veillez à paramètrer correctement l'application avant d'utiliser l'export Excel. Les villes de départ et d'arrivée sont manquantes");
NavigationService.Navigate(new Uri("/Page/PivotParam.xaml", UriKind.Relative));
return;
}
ReferenceMeeting start = new ReferenceMeeting(this.dateFrom.Value.Value, new Location()
{
Latitude = (double)settings["latiAdrDepart"],
Longitude = (double)settings["longiAdrDepart"]
}) { City = (string)settings["VilleDepart"], Subject = "Start" };
ReferenceMeeting end = new ReferenceMeeting(this.dateFrom.Value.Value, new Location()
{
Latitude = (double)settings["latiAdrArriver"],
Longitude = (double)settings["longiAdrArriver"]
}) { City = (string)settings["VilleArriver"], Subject = "End" };
this.disableInterface();
manager.GetAllRoadMapsAsync(this.dateFrom.Value.Value, this.dateTo.Value.Value, start, end);
}
示例15: Show
public void Show()
{
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
var toast = new ToastPrompt { Message = "Saved!" };
toast.Show();
});
}