private void saveToLib()
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                try
                {
                    using (var stream = new MemoryStream())
                    {
                        var bmp      = new WriteableBitmap(new DownLoadedImage(bytes));
                        var lib      = new MediaLibrary();
                        var filePath = string.Format(Guid.NewGuid() + ".jpg");

                        bmp.SaveJpeg(stream, bmp.PixelWidth, bmp.PixelHeight, 0, 100);
                        stream.Seek(0, SeekOrigin.Begin);
                        lib.SavePicture(filePath, stream);

                        var toast = new ToastPrompt();
                        toast.Show("图片存储成功~");
                    }
                }
                catch
                {
                    MessageBox.Show(
                        "请断开手机与电脑的连接。",
                        "无法保存",
                        MessageBoxButton.OK);
                }
            });
        }
Exemple #2
0
        private void mnuSave_Click(object sender, EventArgs e)
        {
            WriteableBitmap img = new WriteableBitmap(canvas, null);

            img.Invalidate();
            string imgName = "fingerpaint.jpg";

            using (IsolatedStorageFile iso = IsolatedStorageFile.GetUserStoreForApplication())
            {
                IsolatedStorageFileStream isofs = iso.OpenFile(imgName, System.IO.FileMode.OpenOrCreate);
                img.SaveJpeg(isofs, img.PixelWidth, img.PixelHeight, 0, 100);
                isofs.Seek(0, System.IO.SeekOrigin.Begin);
                MediaLibrary lib = new MediaLibrary();
                Picture      pic = lib.SavePicture(imgName, isofs);
                isofs.Close();
                iso.DeleteFile(imgName);
            }
            ToastPrompt tp = new ToastPrompt
            {
                Message  = "Picture saved!",
                FontSize = 30
            };

            tp.Show();
        }
Exemple #3
0
        public override IDisposable Toast(ToastConfig config)
        {
            ToastPrompt toast = null;

            return(this.DispatchAndDispose(
                       () =>
            {
                toast = new ToastPrompt
                {
                    Message = config.Message,
                    //Stretch = Stretch.Fill,
                    TextWrapping = TextWrapping.WrapWholeWords,
                    MillisecondsUntilHidden = Convert.ToInt32(config.Duration.TotalMilliseconds)
                };
                if (config.Icon != null)
                {
                    toast.ImageSource = new BitmapImage(new Uri(config.Icon));
                }

                if (config.MessageTextColor != null)
                {
                    toast.Foreground = new SolidColorBrush(config.MessageTextColor.Value.ToNative());
                }

                if (config.BackgroundColor != null)
                {
                    toast.Background = new SolidColorBrush(config.BackgroundColor.Value.ToNative());
                }

                toast.Show();
            },
                       () => toast.Hide()
                       ));
        }
        /// <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();
        }
 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;
         }
     });
 }
        public async void Show(ToastPrompt toastPrompt)
        {
            RootGrid.Children.Add(toastPrompt);
            await toastPrompt.ShowAsync();

            RootGrid.Children.Remove(toastPrompt);
        }
Exemple #7
0
 public void CreateErrorNotification(Exception exception)
 {
     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);
 }
Exemple #8
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            WriteableBitmap wb = new WriteableBitmap(msgCanvas, new ScaleTransform());

            wb.Render(msgCanvas, new ScaleTransform());
            wb.Invalidate();


            //save the image
            using (var ms = new MemoryStream())
            {
                wb.SaveJpeg(ms, (int)msgCanvas.Width, (int)msgCanvas.Height, 0, 100);

                ms.Seek(0, SeekOrigin.Begin);
                var lib     = new MediaLibrary();
                var picture = lib.SavePicture(string.Format("img.jpg"), ms);

                var toast = new ToastPrompt
                {
                    Title       = "St!ck!es",
                    Message     = "Image saved to Saved Pictures",
                    ImageSource = new BitmapImage(new Uri("..\\Ok.png", UriKind.RelativeOrAbsolute))
                };
                toast.Completed += toast_Completed;
                toast.Show();

                var task = new ShareMediaTask();

                task.FilePath = picture.GetPath();

                task.Show();
            }
        }
        private async void GetUrl(string linkf, string name)
        {
            try
            {
                StorageFile   destinationFile;
                StorageFolder fd = await ApplicationData.Current.LocalFolder.CreateFolderAsync("shared", CreationCollisionOption.OpenIfExists);

                StorageFolder fd2 = await fd.CreateFolderAsync("transfers", CreationCollisionOption.OpenIfExists);

                destinationFile = await fd2.CreateFileAsync(name.Replace("(", "- ").Replace(")", "").Replace("/", "-").Replace(".", "-") + ".mp4", CreationCollisionOption.GenerateUniqueName);

                //destinationFile = await KnownFolders.MusicLibrary.CreateFileAsync("love.mp3", CreationCollisionOption.GenerateUniqueName);
                BackgroundDownloader backgroundDownloader = new BackgroundDownloader();
                DownloadOperation    download             = backgroundDownloader.CreateDownload(new Uri("http://www.phimmoi.net/player.php?url=" + linkf.Replace("\\/", "/"), UriKind.RelativeOrAbsolute), destinationFile);
                ToastPrompt          tost = new ToastPrompt()
                {
                    Title   = "Success:",
                    Message = "This file starting download."
                };
                tost.Show();
                await download.StartAsync();
            }
            catch
            {
                ToastPrompt tost = new ToastPrompt()
                {
                    Title   = "Error:",
                    Message = "have a problem when start downloading, please try again!"
                };
                tost.Show();
                //Toast2.Message = "have a problem when start downloading, please try again!";
            }
        }
 private void PhotoPostCompleted(RestRequest request, RestResponse response, object userstate)
 {
     // We want to ensure we are running on our thread UI
     Deployment.Current.Dispatcher.BeginInvoke(() =>
     {
         if (response.StatusCode == HttpStatusCode.Created)
         {
             Deployment.Current.Dispatcher.BeginInvoke(
                 () =>
             {
                 ToastPrompt toast = new ToastPrompt
                 {
                     Title   = "ajapaik",
                     Message = "your photo was uploaded",
                 };
                 toast.Show();
             });
         }
         else
         {
             MessageBox.Show("Error while uploading to server. Please try again later. " +
                             "If this error persists please let the program author know.");
         }
     });
 }
        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();
        }
Exemple #12
0
        private void OnMarkIntakeButtonClick(object sender, RoutedEventArgs e)
        {
            if (CurrentItem.LatestIntake.HasValue)
            {
                if (CurrentItem.History.Count == 20 && CurrentItem.HistoryFriendly.Count == 20)
                {
                    CurrentItem.History.RemoveAt(0);
                    CurrentItem.HistoryFriendly.RemoveAt(0);
                }
                CurrentItem.History.Add(CurrentItem.LatestIntake.Value);
                CurrentItem.HistoryFriendly.Add(CurrentItem.FriendlyDate);
            }
            CurrentItem.LatestIntake = DateTime.Now;
            var time = CurrentItem.LatestIntake.Value.ToString(CultureInfo.CurrentUICulture.DateTimeFormat.ShortTimePattern);

            CurrentItem.UiDate       = String.Format("{0} {1}", AppResources.Today, time);
            CurrentItem.FriendlyDate = Common.Instance.GetFriendlyDate(CurrentItem.LatestIntake);
            App.ViewModel.Save(CurrentItem);
            TileUtility.Instance.UpdateTile(CurrentItem);
            var toast = new ToastPrompt
            {
                Title                   = AppResources.IntakeSaved,
                TextWrapping            = TextWrapping.Wrap,
                MillisecondsUntilHidden = 2000,
                Height                  = 150
            };

            toast.Show();
        }
Exemple #13
0
        async void wc_RefreshPodcastRSSCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            PodcastSubscriptionModel subscription = e.UserState as PodcastSubscriptionModel;

            if (e.Error != null)
            {
                Debug.WriteLine("ERROR: Got web error when refreshing subscriptions: " + e.ToString());
                ToastPrompt toast = new ToastPrompt();
                toast.Title   = "Error";
                toast.Message = "Cannot refresh subscription '" + subscription.PodcastName + "'";

                toast.Show();

                refreshNextSubscription();
                return;
            }

            subscription.CachedPodcastRSSFeed = e.Result as string;
            subscription.SubscriptionStatus   = "";

            Debug.WriteLine("Starting refreshing episodes for " + subscription.PodcastName);
            await Task.Run(() => subscription.EpisodesManager.updatePodcastEpisodes());

            Debug.WriteLine("Done.");

            // Ugly.
            if (App.forceReloadOfEpisodeData)
            {
                subscription.reloadUnplayedPlayedEpisodes();
                subscription.reloadPartiallyPlayedEpisodes();
            }

            refreshNextSubscription();
        }
Exemple #14
0
 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
 }
Exemple #15
0
        private async void FetchCollectionDetails()
        {
            OnOperationStarted();

            try
            {
                var connection = await this.connectionService.GetConnectionAsync();

                using (progressService.Show())
                {
                    this.Collection = await connection.GetCollectionDetails(this.CollectionID);
                }
            }
            catch (Exception ex)
            {
                var toast = new ToastPrompt()
                {
                    Title           = "Failed to fetch details",
                    Message         = ex.Message,
                    TextOrientation = Orientation.Vertical,
                    TextWrapping    = TextWrapping.Wrap,
                    Background      = new SolidColorBrush(Colors.Red),
                };

                toast.Show();
            }
            finally
            {
                OnOperationFinished();
            }
        }
Exemple #16
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            HostName targetHost;

            try
            {
                targetHost = new HostName(HostnameBox.Text);
            }
            catch (ArgumentException ex)
            {
                MessageDialog errorDialog = new MessageDialog("You've entered an invalid hostname or IP address.\nNote that the hostname field should not contain port numbers.");
                errorDialog.Title = "Invalid Hostname or IP address";
                await errorDialog.ShowAsync();

                return;
            }
            uint   port       = Convert.ToUInt32(PortNumberBox.Text);
            string macAddress = MacAddressBox.Text;

            MagicPacketSender magicSender = new MagicPacketSender();
            bool success = await magicSender.SendMagicPacket(targetHost, port, macAddress);

            RequestInfo info = new RequestInfo
                               (
                HostnameBox.Text,
                Convert.ToUInt32(PortNumberBox.Text),
                MacAddressBox.Text
                               );

            if (!RecentRequests.Contains(info))
            {
                if (RecentRequests.Count > 20)
                {
                    for (int i = 20; i <= RecentRequests.Count; i++)
                    {
                        RecentRequests.RemoveAt(i);
                    }
                }
                RecentRequests.Insert(0, info);
                await FileUtils.SaveRequestInfo(RecentRequests.ToList());
            }
            if (success)
            {
                ToastPrompt toast = new ToastPrompt();
                toast.Title                   = "Magic Packet";
                toast.Message                 = "Magic packet sent!";
                toast.TextOrientation         = Orientation.Horizontal;
                toast.MillisecondsUntilHidden = 3000;
                toast.Show();
            }
            else
            {
                ToastPrompt toast = new ToastPrompt();
                toast.Title                   = "Magic Packet";
                toast.Message                 = "Sending failed! =(";
                toast.TextOrientation         = Orientation.Horizontal;
                toast.MillisecondsUntilHidden = 3000;
                toast.Show();
            }
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
			var toast = new ToastPrompt { Message = "attempt to get OnNavigatedTo failure" };
            toast.Show();

            base.OnNavigatedTo(e);
        }
        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();
            });
        }
 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); 
 }
 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();
         }
     });
 }
Exemple #21
0
        protected void Execute(object parameter, bool immediate)
        {
            MediaItemsListModelItem mediaItem = parameter as MediaItemsListModelItem;
            bool forceCurrent = false;

            if (immediate && App.Engine.DownloadManager.StartedDownloadsCount >= DownloadManager.KMaxSimultaneousDownloads)
            {
                MessageBoxResult result = MessageBox.Show(FileLanguage.MAX_DOWNLOAD_REACHED_QUESTION, FileLanguage.ARE_YOU_SURE, MessageBoxButton.OKCancel);
                forceCurrent = result == MessageBoxResult.OK;
            }


            ToastPrompt toast = new ToastPrompt();

            switch (App.Engine.EnqueueMediaItem(mediaItem, immediate, forceCurrent))
            {
            case Engine.AddingToQueueResult.ItemAlreadyDownloaded:
                toast.Message = String.Format(FileLanguage.DownloadCommand_AlreadyDownloaded, mediaItem.Title == String.Empty ? FileLanguage.DownloadCommand_Item : mediaItem.Title);
                break;

            case Engine.AddingToQueueResult.ItemAddedToQueue:
                toast.Message = String.Format(FileLanguage.DownloadCommand_AddedToDownload, mediaItem.Title == String.Empty ? FileLanguage.DownloadCommand_Item : mediaItem.Title);
                break;

            case Engine.AddingToQueueResult.DownloadItemStarted:
                toast.Message = String.Format(FileLanguage.DownloadCommand_DownloadingStarted, mediaItem.Title == String.Empty ? FileLanguage.DownloadCommand_Item : mediaItem.Title);
                break;
            }
            toast.Show();
        }
        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;
        }
Exemple #23
0
        public static void Show(string message)
        {
            ToastPrompt prompt = new ToastPrompt();

            prompt.Message = message;
            prompt.Show();
        }
Exemple #24
0
        void Save_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            MenuItem    item = sender as MenuItem;
            PictureInfo info = item.DataContext as PictureInfo;

            String file = info.User.Username + info.ID + ".jpg";

            var myStore = IsolatedStorageFile.GetUserStoreForApplication();
            IsolatedStorageFileStream myFileStream = myStore.CreateFile(file);

            BitmapImage b = new BitmapImage(new Uri(info.MediumURL, UriKind.Absolute));

            b.CreateOptions = BitmapCreateOptions.None;

            Image i = new Image();

            i.Source = b;

            WriteableBitmap bitmap = new WriteableBitmap((BitmapSource)i.Source);

            bitmap.SaveJpeg(myFileStream, bitmap.PixelWidth, bitmap.PixelHeight, 0, 100);
            myFileStream.Close();

            myFileStream = myStore.OpenFile(file, System.IO.FileMode.Open, System.IO.FileAccess.Read);

            var lib = new MediaLibrary();

            lib.SavePicture(file, myFileStream);

            toastDisplay = GlobalToastPrompt.CreateToastPrompt(
                "Success!",
                "Picture has been saved to your media library.");

            toastDisplay.Show();
        }
Exemple #25
0
        private void ProcessCallback(String command, String param)
        {
            if (command.Equals("SEND_CHAT"))
            {
                WarpClient.GetInstance().SendChat(param);
            }
            else if (command.Equals("EXIT"))
            {
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    NavigationService.GoBack();
                });
            }
            else if (command.Equals("CONNECTION_ERROR"))
            {
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    MainPage.isConnectionError = true;
                    NavigationService.GoBack();
                });
            }
            else if (command.Equals("DISPLAY_TOAST"))
            {
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    ToastPrompt toast     = new ToastPrompt();
                    toast.FontSize        = 30;
                    toast.Title           = param;
                    toast.TextOrientation = System.Windows.Controls.Orientation.Horizontal;

                    toast.Show();
                });
            }
        }
 //保存商家
 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;
 }
Exemple #27
0
        private async void FetchPersonDetails()
        {
            try
            {
                using (this.progressService.Show())
                {
                    var connection = await this.connectionService.GetConnectionAsync();

                    this.Person = await connection.GetPersonDetails(this.PersonID, false);

                    this.Person = await connection.GetPersonDetails(this.PersonID, true);
                }
            }
            catch (Exception ex)
            {
                Execute.BeginOnUIThread(() =>
                {
                    var toast = new ToastPrompt()
                    {
                        Title           = "Failed to fetch person details",
                        Message         = ex.Message,
                        TextOrientation = Orientation.Vertical,
                        TextWrapping    = TextWrapping.Wrap,
                        Background      = new SolidColorBrush(Colors.Red),
                    };

                    toast.Show();
                });
            }
        }
        public async void PlayShow()
        {
            this.analyticsService.PlayRecording();

            try
            {
                using (this.ShowProgress())
                {
                    var connection = await this.connectionService.GetConnectionAsync();

                    await connection.PlayShow(this.ShowRecordingID);
                }
            }
            catch (Exception ex)
            {
                Execute.BeginOnUIThread(() =>
                {
                    var toast = new ToastPrompt()
                    {
                        Title           = "Play command failed",
                        Message         = ex.Message,
                        TextOrientation = Orientation.Vertical,
                        TextWrapping    = TextWrapping.Wrap,
                        Background      = new SolidColorBrush(Colors.Red),
                    };

                    toast.Show();
                });
            }
        }
        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;
        }
Exemple #30
0
        private void Login_Click(object sender, EventArgs e)
        {
            if (!InputValidator.isNotEmpty(this.usernameInput.Text) ||
                !InputValidator.isNotEmpty(this.passwordInput.Password))
            {
                toastDisplay = GlobalToastPrompt.CreateToastPrompt(
                    "Oops!",
                    "Please check that you have entered all required fields.",
                    3000);
                toastDisplay.Show();
                return;
            }


            App.MetrocamService.AuthenticateCompleted += new MobileClientLibrary.RequestCompletedEventHandler(MetrocamService_AuthenticateCompleted_Login);
            GlobalLoading.Instance.IsLoading           = true;

            // Atach timer event handler for tick
            this.timer.Tick += new EventHandler(timer_Tick);
            // Set one second as each tick
            this.timer.Interval = new TimeSpan(0, 0, 1);
            // Start timer
            this.timer.Start();

            App.MetrocamService.Authenticate(this.usernameInput.Text, this.passwordInput.Password);
        }
        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();
        }
 private async void CheckVersion()
 {
     using (var stream = await new HttpHelp().Get("http://version.liubaicai.net/acfun.html"))
     {
         if (stream != null)
         {
             var sr      = new StreamReader(stream);
             var version = sr.ReadToEnd();
             if (version != "" && Int32.Parse(version) > App.AppVersionCount)
             {
                 Deployment.Current.Dispatcher.BeginInvoke(() =>
                 {
                     var toast    = new ToastPrompt();
                     toast.Click += (sender, args) =>
                     {
                         var task = new MarketplaceDetailTask();
                         task.ContentIdentifier = "393cf4cf-4946-4721-bee5-fb326195dab8";
                         task.ContentType       = MarketplaceContentType.Applications;
                         task.Show();
                     };
                     toast.Show("新版本出没,更新下吧~");
                 });
             }
         }
     }
 }
        public override IDisposable Toast(ToastConfig config)
        {
            ToastPrompt toast = null;

            return(this.DispatchAndDispose(() =>
            {
                toast = new ToastPrompt
                {
                    Message = config.Message,
                    Stretch = Stretch.Fill,
                    MillisecondsUntilHidden = Convert.ToInt32(config.Duration.TotalMilliseconds)
                };
                if (config.MessageTextColor != null)
                {
                    toast.Foreground = new SolidColorBrush(config.MessageTextColor.Value.ToNative());
                }

                if (config.BackgroundColor != null)
                {
                    toast.Background = new SolidColorBrush(config.BackgroundColor.Value.ToNative());
                }

                toast.Show();
            },
                                           () => toast.Hide()));
        }
 protected override void OnBackKeyPress(CancelEventArgs e)
 {
     try
     {
         while (this.NavigationService.CanGoBack)
         {
             this.NavigationService.RemoveBackEntry();
         }
         if (isBackQuit)
         {
             e.Cancel = false;
             Application.Current.Terminate();
         }
         else
         {
             e.Cancel   = true;
             isBackQuit = true;
             var toast = new ToastPrompt();
             toast.Show("再按一次后退键退出程序");
             var t = new Thread(backWait);
             t.Start();
         }
     }
     catch { e.Cancel = true; }
 }
Exemple #35
0
        void Instance_PlayStateChanged(object sender, EventArgs e)
        {
            bool t = false;

            t = BackgroundAudioPlayer.Instance.Track.Title.Equals("error");
            if (!t)
            {
                var state = e as PlayStateChangedEventArgs;
                if (state.CurrentPlayState == PlayState.Playing)
                {
                    playAndPause.Source = new BitmapImage(new Uri("/assets/icons/pause.png", UriKind.Relative));
                }
                else
                {
                    playAndPause.Source = new BitmapImage(new Uri("/assets/icons/play.png", UriKind.Relative));
                }
                UpdateUI();
                EnableAllButton();
                progressBar.Visibility = Visibility.Collapsed;
                isAlbumChanged         = false;
            }
            else
            {
                progressBar.Visibility = Visibility.Collapsed;
                BackgroundAudioPlayer.Instance.Close();
                ToastPrompt toast = new ToastPrompt();
                toast.Message = "网络不可用,请检查网络连接";
                toast.Show();
            }
        }
        private void NotificationChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
        {
            var text1 = e.Collection["wp:Text1"];
            var text2 = e.Collection["wp:Text2"];
            var param = e.Collection["wp:Param"];

            toastNavigationUri = new Uri(param, UriKind.RelativeOrAbsolute);

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                ToastPrompt toast = new ToastPrompt()
                {
                    Title   = text2,
                    Message = text1,
                    MillisecondsUntilHidden = 5000,
                    ImageSource             = new BitmapImage(new Uri("/Assets/ApplicationIcon.png", UriKind.RelativeOrAbsolute))
                    {
                        DecodePixelHeight = 25, DecodePixelWidth = 25
                    }
                };

                toast.Tap += toast_Tap;
                toast.Show();
            });
        }
 protected void Toast(string title, string message = null)
 {
     ToastPrompt toast = new ToastPrompt();
     toast.Title = title;
     if (!string.IsNullOrEmpty(message)) toast.Message = message;
     toast.Show();
 }
        private void startTimer_Click(object sender, RoutedEventArgs e)
        {
            #region Math coutdown

            _time.Seconds = int.Parse(timeselector.ValueString.Substring(6, 2));
            _time.Minutes = int.Parse(timeselector.ValueString.Substring(3, 2));
            _time.Hours   = int.Parse(timeselector.ValueString.Substring(0, 2));

            #endregion

            _timerCounter.Start();
            _timewheel.Start();

            StartTimer.Visibility = Visibility.Collapsed;
            StopTimer.Visibility  = Visibility.Visible;

            var toast = new ToastPrompt
            {
                Title           = "Warning !",
                Message         = "PLEASE KEEP APP RUNNING IN FOREGROUND\nYOU CAN TURN OFF SCREEN IF YOU WANT 🙅",
                TextOrientation = System.Windows.Controls.Orientation.Vertical,
            };

            toast.Show();
        }
        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;
            }
        }
        public void deleteDownloadedEpisode()
        {
            using (var episodeStore = IsolatedStorageFile.GetUserStoreForApplication())
            {
                // Episode not deleted, or file is missing. Reset episode info in DB anyway.
                if (String.IsNullOrEmpty(EpisodeFile) ||
                    episodeStore.FileExists(EpisodeFile) == false)
                {
                    resetEpisodeInDB();
                    return;
                }
            }

            bool success = doDeleteFile();

            if (success)
            {
                resetEpisodeInDB();
            }
            else
            {
                ToastPrompt toast = new ToastPrompt();
                toast.Title   = "Error";
                toast.Message = "Could not delete episode.";

                toast.Show();
            }
        }
Exemple #41
0
        /// <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();
        }
Exemple #42
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            model.Title = NavigationContext.QueryString["title"];

            var       gameType  = NavigationContext.QueryString["gametype"];
            Exception exception = null;

            try
            {
                await model.Init(gameType);
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            if (exception != null)
            {
                ToastPrompt toast = new ToastPrompt()
                {
                    Title                   = "Error",
                    Message                 = exception.Message,
                    TextOrientation         = System.Windows.Controls.Orientation.Vertical,
                    MillisecondsUntilHidden = 4000
                };
                //toast.ImageSource = new BitmapImage(new Uri("ApplicationIcon.png", UriKind.RelativeOrAbsolute));
                //toast.Completed += toast_Completed;
                toast.Show();
                BugSenseLogResult result = await BugSenseHandler.Instance.LogExceptionAsync(exception);

                Debug.WriteLine("Client Request: {0}", result.ClientRequest);
            }
        }
Exemple #43
0
 private void VisitEachPage(List <string> urlList)
 {
     Dispatcher.BeginInvoke(() =>
     {
         ToastPrompt tp = new ToastPrompt();
         tp.Message     = "正在签到";
         tp.Show();
     });
     foreach (string url in urlList)
     {
         VisitSinglePage(url);
         //Dispatcher.BeginInvoke(() =>
         //{
         //    BindListBox();
         //});
         Thread.Sleep(1000);
     }
     Dispatcher.BeginInvoke(() =>
     {
         ToastPrompt tp = new ToastPrompt();
         tp.Message     = "签到已完成";
         tp.Show();
         Guide.IsScreenSaverEnabled = true;
     });
 }
Exemple #44
0
        public async void UploadToSkydrive()
        {
            IsBusy = IsUsingLive = true;
            await skyDriveUpload.InitializeAsync();

            await skyDriveUpload.UploadAsync(selectedItems.Select(x => new SkyDriveFile(x.FileName, x.Description)).ToList(), this);

            IsBusy = IsUsingLive = false;
            var toast = new ToastPrompt
            {
                Title           = "Upload completed",
                TextOrientation = Orientation.Horizontal,
                Message         = "Tap here for basic summary",
                TextWrapping    = TextWrapping.Wrap
            };

            toast.Completed += (sender, args) =>
            {
                if (args.PopUpResult == PopUpResult.Ok)
                {
                    var uploadSummary = skyDriveUpload.UploadSummary;
                    var message       = string.Format("Data files transferred: {0} ({1:0.00} kB)", uploadSummary.DataFilesTransferred, uploadSummary.DataKilobytesTransferred);
                    if (skyDriveUpload.UploadSummary.ChartFilesTransferred > 0)
                    {
                        message += string.Format(", chart files transferred: {0} ({1:0.00} kB)",
                                                 uploadSummary.ChartFilesTransferred,
                                                 uploadSummary.ChartKilobytesTransferred);
                    }
                    MessageBox.Show(message, "Summary", MessageBoxButton.OK);
                }
            };
            toast.Show();
        }
        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();
            }
        }
        /// <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);
        }
Exemple #47
0
 public void ShowError(string message, string title = null)
 {
     ToastPrompt toast = new ToastPrompt();
     toast.Title = !string.IsNullOrEmpty(title) ? title : AppResources.ApplicationTitle;
     toast.Message = message;
     toast.Background = new SolidColorBrush(Colors.Red);
     toast.Show();
 }
 public void Show()
 {
     Deployment.Current.Dispatcher.BeginInvoke(() =>
     {
         var toast = new ToastPrompt { Message = "Saved!" };
         toast.Show();
     });
 }
Exemple #49
0
 public void ShowWarning(string message, string title = null)
 {
     ToastPrompt toast = new ToastPrompt();
     toast.Title = !string.IsNullOrEmpty(title) ? title : AppResources.ApplicationTitle;
     toast.Message = message;
     toast.Background = new SolidColorBrush(Colors.Orange);
     toast.TextOrientation = System.Windows.Controls.Orientation.Vertical;
     toast.Show();
 }
Exemple #50
0
 public static void ShowToastPrompt(string msg, int duration)
 {
     ToastPrompt toastPrompt = new ToastPrompt();
     toastPrompt.IsTimerEnabled = true;
     toastPrompt.MillisecondsUntilHidden = duration;
     //toastPrompt.Title = "";
     toastPrompt.Message = msg;
     toastPrompt.Show();
 }
 public void SendToast(string message)
 {
     Deployment.Current.Dispatcher.BeginInvoke(() =>
     {
         var toast = new ToastPrompt();
         toast.Message = message;
         toast.Show();
     });
 }
Exemple #52
0
 public static void ShowToast(string title, string message)
 {
     var toast = new ToastPrompt
     {
         Title = title,
         Message = message
     };
     toast.Show();
 }
 public void ShowToastMessage(string message)
 {
     Deployment.Current.Dispatcher.BeginInvoke(() =>
     {
         ToastPrompt toast = new ToastPrompt();
         toast.Title = message;
         toast.Show();
     });
 }
        private void ap_favsadd_click(object sender, EventArgs e)
        {
            using (MyDatafavcolors.favcolorsContext bc = new MyDatafavcolors.favcolorsContext())
            {
                MyDatafavcolors.Favcolors ct = bc.Favcolors.FirstOrDefault(c => c.Name == name);
                if (ct != null)
                {
                    if(mylogo.Text=="Nippon Colors")
                    {
                        var toast1 = new ToastPrompt
                        {
                            Message = "The color had been added."
                        };
                        toast1.Show();
                    }
                    else
                    {
                        var toast1 = new ToastPrompt
                        {
                            Message = "该颜色已添加。"
                        };
                        toast1.Show();
                    }
                    return;
                }
                ct = new MyDatafavcolors.Favcolors()
                {
                    ID = id,
                    Name = name,
                    Romaji = romaji,
                    Rcode = myR.Text,
                    Gcode = myG.Text,
                    Bcode = myB.Text,
                    Code = code,
                    Eromaji=eromaji
                };
                if (mylogo.Text == "Nippon Colors")
                {
                    var toast1 = new ToastPrompt
                    {
                        Message = "Successfully added."
                    };
                    toast1.Show();
                }
                else
                {
                    var toast1 = new ToastPrompt
                    {
                        Message = "添加成功。"
                    };
                    toast1.Show();
                }
                bc.Favcolors.InsertOnSubmit(ct);
                bc.SubmitChanges();

            }
        }
Exemple #55
0
 public void ShowToast(string m)
 {
     ToastPrompt toast = new ToastPrompt();
     toast.FontSize = 20;
     toast.Title = "";
     toast.Message = m;
     // toast.ImageSource = new BitmapImage(new Uri("/ApplicationIcon.png", UriKind.RelativeOrAbsolute));
     toast.TextOrientation = System.Windows.Controls.Orientation.Horizontal;
     toast.Show();
 }
Exemple #56
0
 public void ShowToast(string content)
 {
     Deployment.Current.Dispatcher.BeginInvoke(() =>
        {
            ToastPrompt toast = new ToastPrompt();
            toast.Title = "";
            toast.Message = content;
            toast.Show();
        });
 }
        private void btnHorizontalText_Click(object sender, RoutedEventArgs e)
        {
            ToastPrompt toast = new ToastPrompt();
            toast.FontSize = 30;
            toast.Title = "Horizontal";
            toast.Message = "Horizontal text";
            toast.TextOrientation = System.Windows.Controls.Orientation.Horizontal;
            toast.ImageSource = new BitmapImage(new Uri("ApplicationIcon.png", UriKind.RelativeOrAbsolute));

            toast.Show();
        }
Exemple #58
0
 public void ShowErrorMessage()
 {
     var toast = new ToastPrompt
         {
             Title = AppResources.ErrorMessage,
             TextWrapping = TextWrapping.Wrap,
             MillisecondsUntilHidden = 2000,
             Height = 150
         };
     toast.Show();
 }
Exemple #59
0
 public static void CreateBasicToast(string Content, string title = "提示")
 {
     var toast = new ToastPrompt
     {
         Title = title,
         Message = Content,
         TextWrapping = System.Windows.TextWrapping.Wrap,
         Margin = new System.Windows.Thickness(0, 0, 0, 70)
     };
     
     toast.Show();
 }
Exemple #60
0
 public void Toast(string content, string title = "", int timeout = 3000)
 {
     Deployment.Current.Dispatcher.BeginInvoke(() =>
     {
         ToastPrompt toast = new ToastPrompt();
         toast.Title = title;
         toast.Message = content;
         toast.MillisecondsUntilHidden = timeout;
         toast.TextWrapping = TextWrapping.Wrap;
         toast.Show();
     });
 }