コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="title"></param>
        /// <param name="icon"></param>
        /// <param name="button"></param>
        /// <param name="defaultButton"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        private MessageBoxResult OpenMessageBox(string title, MessageBoxImage icon, MessageBoxButton button, MessageBoxResult defaultButton, string message)
        {
            var notification = new MessageBoxNotification()
            {
                Title         = title,
                Message       = message,
                Button        = button,
                Image         = icon,
                DefaultButton = defaultButton
            };

            OpenMessageBoxRequest.Raise(notification);

            return(notification.Result);
        }
コード例 #2
0
        private void MessageBoxNotificationRequestRaise(BaseEventAggregatorMessage messageInput)
        {
            // Show LoginView in 'login' mode
            _messageBoxNotification = new MessageBoxNotification()
            {
                Title   = messageInput.Title ?? "WPFUserSearch",
                Message = messageInput.Caption,
                Input   = messageInput.MessageBoxInput,
            };

            this.MessageBoxNotificationRequest.Raise(_messageBoxNotification, Raised =>
            {
                MessageBoxNotificationRequestProcess(messageInput, _messageBoxNotification);
            });
        }
コード例 #3
0
        static INotificationType InitializeNotification()
        {
            string            notificationType = ConfigurationManager.AppSettings.Get("notificationType");
            INotificationType messageService;

            switch (notificationType)
            {
            case "MessageBox":
                messageService = new MessageBoxNotification();
                break;

            default:
                throw new Exception("Not supported notification type!");
            }
            return(messageService);
        }
コード例 #4
0
 public MainWindowViewModel()
 {
     OverlayService.GetInstance().Show = (str) =>//инициализация оверлея
     {
         OverlayService.GetInstance().Text = str;
     };
     Articles = new ObservableCollection <Article>();
     Parser   = new ParserWorker <Article[]>(new HabrParser());
     //По заврешению работы парсера будет появляться уведомляющее окно.
     Parser.OnComplited += (obj) =>
     {
         MessageBoxNotification.Show("Парсер сделал обработку данных.\nДанные готовы для сохранения в файл.\nДля этого слева боковая панель пукт Сохранение.", 5);
     };
     //Заполняем наш listBox заголовками
     Parser.OnNewData += (object o, Article[] item) =>
     {
         foreach (var i in item)
         {
             Articles.Add(new Article(i.Title, i.Text, i.Image));
         }
     };
 }
コード例 #5
0
        private void MessageBoxNotificationRequestProcess(BaseEventAggregatorMessage messageInput, MessageBoxNotification notification)
        {
            BaseEventAggregatorMessage messageOutput = messageInput.Clone() as BaseEventAggregatorMessage;

            messageOutput.MessageBoxOutput = notification.Output;
            messageOutput.SenderName       = messageInput.RecepientName;
            messageOutput.RecepientName    = messageInput.SenderName;

            AppStorage.Instance.EventAggregator.GetEvent <BaseEventAggregatorToken>().Publish(messageOutput);
        }