当前位置: 首页>>代码示例>>C#>>正文


C# ToastPrompt类代码示例

本文整理汇总了C#中ToastPrompt的典型用法代码示例。如果您正苦于以下问题:C# ToastPrompt类的具体用法?C# ToastPrompt怎么用?C# ToastPrompt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ToastPrompt类属于命名空间,在下文中一共展示了ToastPrompt类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitializePrompt

        private void InitializePrompt()
        {
            //var reuseObject = ReuseObject.IsChecked.GetValueOrDefault(false);

            if (_prompt != null)
            {
                _prompt.Completed -= PromptCompleted;
            }

            //if (!reuseObject || _prompt == null)
            {
                _prompt = new ToastPrompt();
            }

            // this is me manually resetting stuff due to the reusability test
            // you don't need to do this.
            // fontsize, foreground, background won't manually be reset

            //_prompt.TextWrapping = TextWrapping.NoWrap;
            //_prompt.ImageSource = null;
            //_prompt.ImageHeight = double.NaN;
            //_prompt.ImageWidth = double.NaN;
            //_prompt.Stretch = Stretch.None;
            //_prompt.IsAppBarVisible = false;
            //_prompt.TextOrientation = System.Windows.Controls.Orientation.Horizontal;

            //_prompt.Message = string.Empty;
            //_prompt.Title = string.Empty;

            _prompt.Completed += PromptCompleted;
        }
开发者ID:selaromdotnet,项目名称:Coding4FunToolkit,代码行数:31,代码来源:ToastPrompts.xaml.cs

示例2: 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();
        }
开发者ID:EchoDemon,项目名称:MediaBrowser.WindowsPhone,代码行数:28,代码来源:App.xaml.cs

示例3: 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

示例4: 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();
        }
开发者ID:rodmanwu,项目名称:dribbble-for-windows-phone-8,代码行数:33,代码来源:ToastNotifyHelper.cs

示例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;
         }
     });
 }
开发者ID:paulombcosta,项目名称:mono-mobilis,代码行数:34,代码来源:MainPage.xaml.cs

示例6: 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();
            });
        }
开发者ID:quicksilver65,项目名称:Skadoosh,代码行数:32,代码来源:ParticipateLive.xaml.cs

示例7: SaveStore

 //保存商家
 private bool SaveStore(string name)
 {
     try
     {
         if (name == "")
         {
             MessageBox.Show("商家名称不能为空!");
             return false;
         }
         else
         {
             Store store = new Store()
             {
                 Name = name
             };
             App.storeHelper.AddNew(store);
         }
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
         return false;
     }
     ToastPrompt tp = new ToastPrompt();
     SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
     tp.Foreground = brush;
     tp.Background = PageTitle.Foreground;
     tp.Message = "保存成功";
     tp.Show();
     return true;
 }
开发者ID:TomHGTang,项目名称:AccountBook,代码行数:32,代码来源:StoreSetting.xaml.cs

示例8: Show

        public static void Show(string message)
        {
            ToastPrompt prompt = new ToastPrompt();

            prompt.Message = message;
            prompt.Show();
        }
开发者ID:anytao,项目名称:ModernReader,代码行数:7,代码来源:OkrToast.cs

示例9: 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
 }
开发者ID:jnowicki,项目名称:WP-EduWords,代码行数:35,代码来源:MainPage.xaml.cs

示例10: 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();
 }
开发者ID:dozer47528,项目名称:WP7-GPS-Tracker,代码行数:7,代码来源:MainPage.xaml.cs

示例11: 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();
        }
开发者ID:wegorich,项目名称:RSS-Reader-WindowsPhone,代码行数:33,代码来源:EditChannel.xaml.cs

示例12: 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);
        }
开发者ID:selaromdotnet,项目名称:Coding4FunToolkit,代码行数:7,代码来源:PromptStressTest.xaml.cs

示例13: 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); 
 }
开发者ID:Synergex,项目名称:Baconography,代码行数:31,代码来源:NotificationService.cs

示例14: 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();
         }
     });
 }
开发者ID:Hcs66,项目名称:WinDou,代码行数:32,代码来源:SubjectReviewView.xaml.cs

示例15: 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();
            }
        }
开发者ID:wegorich,项目名称:RSS-Reader-WindowsPhone,代码行数:33,代码来源:AddChannel.xaml.cs


注:本文中的ToastPrompt类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。