private void PushChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
        {
            StringBuilder message = new StringBuilder();
            string relativeUri = string.Empty;

            message.AppendFormat("Received Toast {0}:\n", DateTime.Now.ToShortTimeString());

            // Parse out the information that was part of the message.
            foreach (string key in e.Collection.Keys)
            {
                message.AppendFormat("{0}: {1}\n", key, e.Collection[key]);

                if (string.Compare(
                    key,
                    "wp:Param",
                    System.Globalization.CultureInfo.InvariantCulture,
                    System.Globalization.CompareOptions.IgnoreCase) == 0)
                {
                    relativeUri = e.Collection[key];
                }
            }

            // Display a dialog of all the fields in the toast.
            Dispatcher.BeginInvoke(() => MessageBox.Show(message.ToString()));
        }
 /// <summary>
 /// Extract the JSON dictionary used to send this push.
 /// </summary>
 /// <param name="args">The args parameter passed to a push received event.</param>
 /// <returns>The JSON dictionary used to send this push.</returns>
 public static IDictionary<string, object> PushJson(NotificationEventArgs args) {
   string launchString = null;
   if (!args.Collection.TryGetValue("wp:Param", out launchString)) {
     return new Dictionary<string, object>();
   }
   return PushJson(launchString);
 }
Esempio n. 3
0
 public void NotifyObserver(HttpSessionState currentSession, bool isFinised)
 {
     const string message = "finished.";
     if (NotifyLogger != null) NotifyLogger(message); //+ "\n"
     var args = new NotificationEventArgs(currentSession, message, isFinised);
     OnAsyncNotificationEvent(args);//for web
 }
Esempio n. 4
0
        private void PushChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
        {
            string message = String.Empty;
            string relativeUri = string.Empty;

            foreach (string key in e.Collection.Keys)
            {
                if (string.Compare(
                    key,
                    "wp:Param",
                    System.Globalization.CultureInfo.InvariantCulture,
                    System.Globalization.CompareOptions.IgnoreCase) == 0)
                {
                    relativeUri = e.Collection[key];
                }
            }

            message = $"{e.Collection["wp:Text1"]} diz: {e.Collection["wp:Text2"]}";

            Dispatcher.BeginInvoke(() => {
                if (MessageBox.Show(message, "Nova mensagem", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    NavigationService.Navigate(new Uri(relativeUri, UriKind.Relative));
                }
            });
        }
Esempio n. 5
0
	    private async void OnNotificationReceived(object sender, NotificationEventArgs httpNotificationEventArgs)
	    {
		    await Task.Run(() =>
		    {
			    _messageService.FetchMessages();
				_messageService.FetchContacts();
			});
            _messenger.Publish(new ContentReceivedMessage(this));
        }
Esempio n. 6
0
 public void HttpChannelToastNotificationReceived(object sender, NotificationEventArgs e)
 {
     var sb = new StringBuilder();
     foreach (var kvp in e.Collection)
     {
         sb.Append(string.Format("Key:{0} Value:{1}, ", kvp.Key, kvp.Value));
     }
     result = sb.ToString();
 }
Esempio n. 7
0
 void httpChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
 {
     string msg = string.Empty;
     foreach (var key in e.Collection.Keys)
     {
         msg += key + " : " + e.Collection[key] + Environment.NewLine;
     }
     Dispatcher.BeginInvoke(() =>
     msgTextBlock.Text = msg);
 }
 private void PushChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
 {
     string message = e.Collection["wp:Text1"];
     IDictionary<string, string> data = null;
     if (e.Collection.ContainsKey("wp:Param") && e.Collection["wp:Param"] != null)
     {
         data = UrlQueryParser.ParseQueryString(e.Collection["wp:Param"]);
     }
     OnPushNotification(message, data);
 }
Esempio n. 9
0
        private void channel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
        {
            string message = "";
            foreach (var text in e.Collection.Values)
            {
                message += text + "\r\n";
            }

            Dispatcher.BeginInvoke(() => output.Text += message);
        }
        void channel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
        {
            string title, content, parameter;
             e.Collection.TryGetValue("wp:Text1", out title);
             e.Collection.TryGetValue("wp:Text2", out content);
             e.Collection.TryGetValue("wp:Param", out parameter);

             string message = string.Format("Toast notification received.\nTitle: {0}\nContent: {1}\nParameter: {2}\n\n{3}",
             title, content, parameter, DateTime.Now);

             Dispatcher.BeginInvoke(() => notificationMessage.Text = message);
        }
        void PushChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
        {
            StringBuilder message = new StringBuilder();
            string relativeUri = string.Empty;

            Toast toast = new Toast();
            if (e.Collection.ContainsKey("wp:Text1"))
            {
                toast.Title = e.Collection["wp:Text1"];
            }
            if (e.Collection.ContainsKey("wp:Text2"))
            {
                toast.Subtitle = e.Collection["wp:Text2"];
            }
            if (e.Collection.ContainsKey("wp:Param"))
            {
                toast.Param = e.Collection["wp:Param"];
            }

            PluginResult result = new PluginResult(PluginResult.Status.OK, toast);

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;
                if (frame != null)
                {
                    PhoneApplicationPage page = frame.Content as PhoneApplicationPage;
                    if (page != null)
                    {
                        CordovaView cView = page.FindName("CordovaView") as CordovaView; // was: PGView
                        if (cView != null)
                        {
                            cView.Browser.Dispatcher.BeginInvoke((ThreadStart)delegate()
                            {
                                try
                                {
                                    cView.Browser.InvokeScript("execScript", this.toastCallback + "(" + result.Message + ")");
                                }
                                catch (Exception ex)
                                {
                                    Debug.WriteLine("ERROR: Exception in InvokeScriptCallback :: " + ex.Message);
                                }

                            });
                        }
                    }
                }
            });
        }
Esempio n. 12
0
        private void pushChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
        {
            foreach (var key in e.Collection.Keys)
            {
                Debug.WriteLine("Key: " + key);
            }

            if (e.Collection.ContainsKey("wp:Param"))
            {
                IDictionary<string, string> parameters = ParseQueryString(e.Collection["wp:Param"]);
                string subscriptionId = parameters["subscriptionId"];
                string devicePin = parameters["devicePin"];

                SubscriptionNotificationManager.SendNewSubscriptionReceivedEvents(subscriptionId, devicePin);
            }
        }
        void httpChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
        {
            App.Trace("===============================================");
            App.Trace("Toast/Tile notification arrived:");

            string msg = e.Collection["wp:Text2"];

            App.Trace(msg);
            UpdateStatus("Toast/Tile message: " + msg);

            App.Trace("===============================================");
        }
Esempio n. 14
0
 void channel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
 {
     //MessageBox.Show("Toast Received");
 }
Esempio n. 15
0
            void eventHandler(Object data)
            {
                MyEvent ev = data as MyEvent;

                if (ev != null)
                {
                    NotificationEventArgs e = ev.e_;
                    switch (ev.operation_)
                    {
                    case 0:     //insert
                    {
                        System.Console.WriteLine("Inserted: " + e.EntityName + "(" + e.RecID.ToString() + "):" + (e.ConfObject == null ? "no object" : e.ConfObject.ToString()));
                        ActiveConnection ac = e.ConfObject as ActiveConnection;
                        if (ac != null)
                        {
                            System.Console.WriteLine("AttachedData(" + ac.AttachedData.Count.ToString() + "):");
                            foreach (KeyValuePair <String, String> kvp in ac.AttachedData)
                            {
                                System.Console.WriteLine(kvp.Key + "=" + kvp.Value);
                            }
                        }
                        if (e.EntityName == "REGISTRATION")
                        {
                            DN dn = e.ConfObject as DN;
                            foreach (RegistrarRecord rr in dn.GetRegistrarContactsEx())
                            {
                                System.Console.WriteLine(rr.ToString() + "\nExpites=" + rr.Expires.ToString());
                            }
                        }
                    }
                    break;

                    case 1:
                    {
                        System.Console.WriteLine("Updated: " + e.EntityName + "(" + e.RecID.ToString() + "):" + (e.ConfObject == null ? "no object" : e.ConfObject.ToString()));
                        ActiveConnection ac = e.ConfObject as ActiveConnection;
                        if (ac != null)
                        {
                            System.Console.WriteLine("AttachedData(" + ac.AttachedData.Count.ToString() + "):");
                            foreach (KeyValuePair <String, String> kvp in ac.AttachedData)
                            {
                                System.Console.WriteLine(kvp.Key + "=" + kvp.Value);
                            }
                        }
                        if (e.EntityName == "REGISTRATION")
                        {
                            DN dn = e.ConfObject as DN;
                            foreach (RegistrarRecord rr in dn.GetRegistrarContactsEx())
                            {
                                System.Console.WriteLine(rr.ToString() + "\nExpites=" + rr.Expires.ToString());
                            }
                        }
                    }
                    break;

                    case 2:
                    {
                        System.Console.WriteLine("Deleted: " + e.EntityName + "(" + e.RecID.ToString() + "):" + (e.ConfObject == null ? "no object" : e.ConfObject.ToString()));

                        ActiveConnection ac = e.ConfObject as ActiveConnection;
                        if (ac != null)
                        {
                            System.Console.WriteLine("AttachedData(" + ac.AttachedData.Count.ToString() + "):");
                            foreach (KeyValuePair <String, String> kvp in ac.AttachedData)
                            {
                                System.Console.WriteLine(kvp.Key + "=" + kvp.Value);
                            }
                        }
                        if (e.EntityName == "REGISTRATION")
                        {
                            DN dn = e.ConfObject as DN;
                            foreach (RegistrarRecord rr in dn.GetRegistrarContactsEx())
                            {
                                System.Console.WriteLine(rr.ToString() + "\nExpites=" + rr.Expires.ToString());
                            }
                        }
                    }
                    break;

                    default:
                        break;
                    }
                }
            }
Esempio n. 16
0
        private void OnNotificationReceived(NotificationEventArgs e)
        {
            switch (e.NotificationType)
            {
            case ConsoleNotificationType.GameLoaded:
                CheatCodes.ApplyCheats();

                this.BeginInvoke((Action)(() => {
                    UpdateDebuggerMenu();
                    ctrlRecentGames.Visible = false;
                    SaveStateManager.UpdateStateMenu(mnuLoadState, false);
                    SaveStateManager.UpdateStateMenu(mnuSaveState, true);

                    RomInfo romInfo = EmuApi.GetRomInfo();
                    this.Text = "Mesen-S - " + romInfo.GetRomName();

                    if (DebugWindowManager.HasOpenedWindow)
                    {
                        DebugWorkspaceManager.GetWorkspace();
                    }
                }));
                break;

            case ConsoleNotificationType.BeforeEmulationStop:
                this.Invoke((Action)(() => {
                    DebugWindowManager.CloseAll();
                }));
                break;

            case ConsoleNotificationType.GameResumed:
                this.BeginInvoke((Action)(() => {
                    //Ensure mouse is hidden when game is resumed
                    CursorManager.OnMouseMove(ctrlRenderer);
                }));
                break;

            case ConsoleNotificationType.EmulationStopped:
                this.BeginInvoke((Action)(() => {
                    this.Text = "Mesen-S";
                    UpdateDebuggerMenu();
                    ShowGameScreen(GameScreenMode.RecentGames);
                    ResizeRecentGames();
                    if (_displayManager.ExclusiveFullscreen)
                    {
                        _displayManager.SetFullscreenState(false);
                    }
                }));
                break;

            case ConsoleNotificationType.ResolutionChanged:
                this.BeginInvoke((Action)(() => {
                    _displayManager.UpdateViewerSize();
                }));
                break;

            case ConsoleNotificationType.ExecuteShortcut:
                this.BeginInvoke((Action)(() => {
                    _shortcuts.ExecuteShortcut((EmulatorShortcut)e.Parameter);
                }));
                break;

            case ConsoleNotificationType.MissingFirmware:
                this.Invoke((Action)(() => {
                    MissingFirmwareMessage msg = (MissingFirmwareMessage)Marshal.PtrToStructure(e.Parameter, typeof(MissingFirmwareMessage));
                    FirmwareHelper.RequestFirmwareFile(msg);
                }));
                break;
            }
        }
 private new void OnCurrentAsycudaDocumentChanged(object sender, NotificationEventArgs <AsycudaDocument> e)
 {
     Task.Run(() => { LoadDataFromAdoc(QuerySpace.CoreEntities.ViewModels.BaseViewModel.Instance.CurrentAsycudaDocumentSetEx, e.Data).Wait(); });
 }
Esempio n. 18
0
 public void OnUpdate(NotificationEventArgs e)
 {
     UpdateEvent?.Invoke(this, e);
 }
Esempio n. 19
0
 private void OnNotification(object sender, NotificationEventArgs e)
 {
     if (!string.IsNullOrEmpty(e.ID))
         _Subscriptions.Remove(StringUtils.GuidDecode(e.ID));
 }
Esempio n. 20
0
 private void SendNotification(object sender, NotificationEventArgs e)
 {
     Task mailTask = MailSenderService.SendMailAsync(e.mailTo, e.mailTitle, e.mailContent, e.remindLogId);
 }
Esempio n. 21
0
 private void Notification_UpdateEvent(object sender, NotificationEventArgs e)
 {
     Update();
 }
Esempio n. 22
0
 private void SendWcfCommandHelper_WcfNotification(object sender, NotificationEventArgs e)
 {
     OnNotification(new NotificationEventArgs(e.Notification));
 }
Esempio n. 23
0
 protected virtual void OnNotification(NotificationEventArgs e)
 {
     Notification?.Invoke(this, e);
 }
Esempio n. 24
0
        private void emailSubscriptionConnection_OnNotificationEvent(object sender, NotificationEventArgs args)
        {
            try {
                foreach (var notificationEvent in args.Events)
                {
                    if (notificationEvent is ItemEvent) // event was an item event
                    {
                        var itemEvent = (ItemEvent)notificationEvent;

                        var message = EmailMessage.Bind(EmailHelper.InstanceOf.GetEmailService,
                                                        itemEvent.ItemId,
                                                        EmailHelper.EmailProperties
                                                        );

                        var parentFolder = itemEvent.ParentFolderId;

                        switch (itemEvent.EventType)
                        {
                        case EventType.Status:

                            break;

                        case EventType.NewMail:
                            var newMailThread = new System.Threading.Thread(x => ProcessNewMail(message));

                            newMailThread.Start();


                            break;

                        case EventType.Deleted:

                            break;

                        case EventType.Modified:

                            break;

                        case EventType.Moved:

                        // break;
                        case EventType.Copied:


                            //EmailHelper.InstanceOf.RewriteSender(message);

                            break;

                        case EventType.Created:

                            break;

                        case EventType.FreeBusyChanged:

                            break;

                        default:
                            throw new Exception("Invalid value for EventType");
                        }
                    }
                    else // the event was a folder event
                    {
                        var folderEvent = (FolderEvent)notificationEvent;

                        switch (folderEvent.EventType)
                        {
                        case EventType.Status:

                        //break;
                        case EventType.NewMail:

                        //break;
                        case EventType.Deleted:

                        //break;
                        case EventType.Modified:

                        //break;
                        case EventType.Moved:

                        //break;
                        case EventType.Copied:

                        //break;
                        case EventType.Created:

                        //break;
                        case EventType.FreeBusyChanged:

                            break;

                        default:
                            throw new Exception("Invalid value for EventType");
                        }
                    }
                }
            } catch (Exception exception) {
                eventLog.WriteEntry(string.Format("{0}\r\nSource: {1}\r\nStack: {2}", exception.Message, exception.Source, exception.StackTrace),
                                    EventLogEntryType.Error);
            }
        }
 internal void OnEntryPreviousItemsChanged(object sender, NotificationEventArgs e)
 {
     _EntryPreviousItems.Refresh();
     NotifyPropertyChanged(x => this.EntryPreviousItems);
 }
Esempio n. 26
0
 private void Current_OnNotificationReceived(object sender, NotificationEventArgs e)
 {
     RefreshEventsAsync();
 }
        /// <summary>
        /// Event signaled when a toast notification arrives
        /// </summary>
        /// <param name="sender">The sending object</param>
        /// <param name="e">The event arguments</param>
        private void httpChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
        {
            Trace("===============================================");
            Trace("Toast notification arrived:");

            if ((NotificationFlag & NotificationFlagType.Toast) != NotificationFlagType.Toast)
            {
                Trace("Toast notifications not active");
                Trace("===============================================");
                return;
            }

            foreach (var key in e.Collection.Keys)
            {
                string msg = e.Collection[key];

                Trace(key + ": " + msg);
                UpdateStatus("Toast/Tile message: " + msg);
            }

            Trace("===============================================");

            //
            // Display the toast text notifications
            //

            if (e.Collection.ContainsKey("wp:Text1"))
                this.NotifyData.Text1 = e.Collection["wp:Text1"];
            if (e.Collection.ContainsKey("wp:Text2"))
                this.NotifyData.Text2 = e.Collection["wp:Text2"];
        }
 private void OnCloseNotice(Object sender, NotificationEventArgs e)
 {
     Window.GetWindow(this).Close();
 }
Esempio n. 29
0
 internal void OnPackageTypesChanged(object sender, NotificationEventArgs e)
 {
     _PackageTypes.Refresh();
     NotifyPropertyChanged(x => this.PackageTypes);
 }
 internal void OnAsycudaDocumentSetEntryDataChanged(object sender, NotificationEventArgs e)
 {
     _AsycudaDocumentSetEntryData.Refresh();
     NotifyPropertyChanged(x => this.AsycudaDocumentSetEntryData);
 }
Esempio n. 31
0
        private void OnSearchNotice(Object sender, NotificationEventArgs e)
        {
            MainSearchWindow searchWindow = new MainSearchWindow();

            searchWindow.Show();
        }
Esempio n. 32
0
        private void UpdateFeedThread()
        {
            try {
                NotificationEventArgs fargs = new NotificationEventArgs();
                fargs.Message = "Updating feed: "+updating_feed.Name;
                Gtk.Application.Invoke(this, fargs, OnNotify);

                bool update = updating_feed.Update();

                if ( update ) {
                    NotificationEventArgs args = new NotificationEventArgs();
                    args.Message = updating_feed.Name+" has new items.";
                    Gtk.Application.Invoke(this, args, OnNotify);
                } else {
                    NotificationEventArgs args = new NotificationEventArgs();
                    args.Message = updating_feed.Name+" has no new items.";
                    Gtk.Application.Invoke(this, args, new EventHandler(OnNotify));
                }
            } catch ( NullReferenceException ) {}
        }
Esempio n. 33
0
 private void _updaterClient_Notification(object sender, NotificationEventArgs e)
 {
     this.listBox1.Items.Add(string.Format("[{0}]\t{1}", e.NotificationDate, e.Message));
 }
 void channel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
 {
  
     if (e.Collection != null && e.Collection.Count > 0)
     {
         var entry = e.Collection.FirstOrDefault().Value;
         var message = e.Collection.ElementAt(1).Value;
         Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             message = entry + "~~" + message;
             Uri notificationUrl = new Uri("/View/Notification.xaml?contentVal=" + message, UriKind.RelativeOrAbsolute);
             PhoneApplicationFrame fram = (Application.Current.RootVisual as PhoneApplicationFrame);
             if (fram != null)
                 fram.Navigate(notificationUrl);
         });                
     }
 }
Esempio n. 35
0
 internal void OnSalesDataAllocationsChanged(object sender, NotificationEventArgs e)
 {
     _SalesDataAllocations.Refresh();
     NotifyPropertyChanged(x => this.SalesDataAllocations);
 }
Esempio n. 36
0
 public MyEvent(int operation, NotificationEventArgs e)
 {
     operation_ = operation;
     e_         = e;
 }
 private void OnAsycudaDocumentSetEntryDataFilterExpressionChanged(object sender, NotificationEventArgs e)
 {
     AsycudaDocumentSetEntryData.Refresh();
     SelectedAsycudaDocumentSetEntryData.Clear();
     NotifyPropertyChanged(x => SelectedAsycudaDocumentSetEntryData);
     BeginSendMessage(MessageToken.SelectedAsycudaDocumentSetEntryDataChanged, new NotificationEventArgs(MessageToken.SelectedAsycudaDocumentSetEntryDataChanged));
 }
Esempio n. 38
0
        private void OnNotificationReceived(NotificationEventArgs e)
        {
            switch (e.NotificationType)
            {
            case ConsoleNotificationType.GameLoaded: {
                if (_cpuType == CpuType.Sa1)
                {
                    CoprocessorType coprocessor = EmuApi.GetRomInfo().CoprocessorType;
                    if (coprocessor != CoprocessorType.SA1)
                    {
                        this.Invoke((MethodInvoker)(() => {
                                this.Close();
                            }));
                        return;
                    }
                }

                if (ConfigManager.Config.Debug.Debugger.BreakOnPowerCycleReset)
                {
                    DebugApi.Step(_cpuType, 1, StepType.PpuStep);
                }

                BreakpointManager.SetBreakpoints();

                DebugState state = DebugApi.GetState();
                this.BeginInvoke((MethodInvoker)(() => {
                        //Refresh workspace here as well as frmMain to ensure workspace
                        //is up-to-date no matter which form is notified first.
                        DebugWorkspaceManager.GetWorkspace();

                        bool isPowerCycle = e.Parameter.ToInt32() != 0;
                        if (!isPowerCycle)
                        {
                            DebugWorkspaceManager.AutoImportSymbols();
                        }
                        LabelManager.RefreshLabels();
                        DebugApi.RefreshDisassembly(_cpuType);
                        UpdateDebugger(state, null);
                    }));
                break;
            }

            case ConsoleNotificationType.GameReset:
                if (ConfigManager.Config.Debug.Debugger.BreakOnPowerCycleReset)
                {
                    DebugApi.Step(_cpuType, 1, StepType.PpuStep);
                }
                break;

            case ConsoleNotificationType.PpuFrameDone:
                this.BeginInvoke((MethodInvoker)(() => {
                    UpdateContinueAction();
                }));
                break;

            case ConsoleNotificationType.CodeBreak: {
                BreakEvent evt = (BreakEvent)Marshal.PtrToStructure(e.Parameter, typeof(BreakEvent));
                RefreshDebugger(evt);
                break;
            }
            }
        }
Esempio n. 39
0
 static void pushChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
 {
     ZumoWP8PushTests.toastPushesReceived.Enqueue(e);
 }
Esempio n. 40
0
 internal void NotifyReceived(NotificationEventArgs e)
 {
     OnNotificationReceived?.Invoke(this, e);
 }
Esempio n. 41
0
        private void UpdateThread()
        {
            foreach ( Feed feed in updating_queue ) {
                Updating = true;
                bool update = false;

                //try {
                    NotificationEventArgs fargs = new NotificationEventArgs();
                    fargs.Message = String.Format(StringCatalog.UpdatingFeed, feed.Name);
                    Gtk.Application.Invoke(this, fargs, OnNotify);

                    update = feed.Update();

                    if ( update ) {
                        NotificationEventArgs args = new NotificationEventArgs();
                        args.Message = feed.Name+" has new items.";
                        args.Title = feed.Name;
                        Gtk.Application.Invoke(this, args, OnNotify);
                    } else {
                        NotificationEventArgs args = new NotificationEventArgs();
                        args.Message = feed.Name+" has no new items.";
                        Gtk.Application.Invoke(this, args, new EventHandler(OnNotify));
                    }
                //} catch ( NullReferenceException ) {}
            }
        }
Esempio n. 42
0
 void dictionary_Notification(object sender, NotificationEventArgs e)
 {
     Dispatcher.Invoke(new Action(delegate() {
         listBox1.Items.Add(e.Sender + " " + e.Value.ToString());
     }));
 }
Esempio n. 43
0
 private void httpChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
 {
     Deployment.Current.Dispatcher.BeginInvoke((ThreadStart)( () => {OnNotificationReceived(e);}) );
 }
        /// <summary>
        /// Processes a new notification.
        /// </summary>
        public void NotificationReceived(NotificationEventArgs e)
        {
            // get the changes.
            List <MonitoredItemNotification> changes = new List <MonitoredItemNotification>();

            foreach (MonitoredItemNotification change in e.NotificationMessage.GetDataChanges(false))
            {
                if (m_monitoredItem != null)
                {
                    if (m_monitoredItem.ClientHandle != change.ClientHandle)
                    {
                        continue;
                    }
                }
                else
                {
                    if (m_subscription.FindItemByClientHandle(change.ClientHandle) == null)
                    {
                        continue;
                    }
                }

                changes.Add(change);
            }

            // check if nothing more to do.
            if (changes.Count == 0)
            {
                return;
            }

            int offset = changes.Count;

            if (m_showHistory)
            {
                // fill in earlier changes.
                foreach (ListViewItem listItem in ItemsLV.Items)
                {
                    MonitoredItemNotification change = listItem.Tag as MonitoredItemNotification;

                    if (change == null)
                    {
                        continue;
                    }

                    if (m_monitoredItem != null)
                    {
                        if (m_monitoredItem.ClientHandle != change.ClientHandle)
                        {
                            continue;
                        }
                    }

                    changes.Add(change);

                    if (changes.Count >= MaxChangeCount)
                    {
                        break;
                    }
                }

                // ensure the newest changes appear first.
                changes.Reverse();
            }

            UpdateChanges(changes, offset);
            AdjustColumns();
        }
Esempio n. 45
0
        // Parse out the information that was part of the message.
        void PushChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
        {
            Debug.WriteLine("Nhận được thông báo"); //DELETE AFTER FINISH


            StringBuilder message = new StringBuilder();
            //string relativeUri = string.Empty;

            //message.AppendFormat("Received Toast {0}:\n", DateTime.Now.ToShortTimeString());

            // Parse out the information that was part of the message.
            foreach (string key in e.Collection.Keys)
            {
                //message.AppendFormat("{0}: {1}\n", key, e.Collection[key]);

                if (string.Compare(
                    key,
                    "wp:Param",
                    System.Globalization.CultureInfo.InvariantCulture,
                    System.Globalization.CompareOptions.IgnoreCase) == 0)
                {
                    //Lấy chuỗi thông báo từ Notification
                    notificationReceivedString = e.Collection[key];
                }
            }

            // Display a dialog of all the fields in the toast.
            //Dispatcher.BeginInvoke(() => MessageBox.Show(message.ToString()));          
            Dispatcher.BeginInvoke(() =>
            {
                //notificationReceivedString = e.Collection.Keys.;
                //MessageBox.Show(notificationReceivedString);
                if (notificationReceivedString != string.Empty)
                {

                    //Hàm này để lấy ra chuỗi Json trong một String gửi qua notification
                    int a = notificationReceivedString.IndexOf("json=");
                    int b = notificationReceivedString.IndexOf("}");
                    int c = notificationReceivedString.IndexOf("notiType=");
                    string tmpStirng = notificationReceivedString.Substring(a + 5, b - a - 4);
                    //Cái này để lấy kiểu 
                    notificationType = notificationReceivedString.Substring(c + 9, notificationReceivedString.Length - c - 9);
                    notificationReceivedString = tmpStirng;

                    //Sau đó chạy thông báo
                    ShowNotification();
                }
            });

        }
 private void OnDeleteVerifiedNotice(object sender, NotificationEventArgs eventArgs)
 {
     MessageBox.Show("Order has been deleted", "Order Deleted",
         MessageBoxButton.OK, MessageBoxImage.Information);
 }
		private void pushChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
		{
			if (SubscriptionReceived != null)
			{
				SubscriptionReceived(this, null);
			}
		}
 private void OnErrorNotice(object sender, NotificationEventArgs<Exception> eventArgs)
 {
     MessageBox.Show(eventArgs.Data.Message, "Error");
 }
 static void pushChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
 {
     ZumoWP8PushTests.toastPushesReceived.Enqueue(e);
 }
Esempio n. 50
0
        private void CurrentChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
        {
            var nodeValues = e.Collection;

            var title = nodeValues.ContainsKey("wp:Text1") ? nodeValues["wp:Text1"] : string.Empty;
            var message = nodeValues.ContainsKey("wp:Text2") ? nodeValues["wp:Text2"] : string.Empty;

            var notification = new NotificationResult { Title = title, Message = message };
            if (nodeValues.ContainsKey("wp:Param"))
            {
                var queryDict = ParseQueryString(nodeValues["wp:Param"]);
                foreach (var entry in queryDict)
                {
                    if (entry.Key == TITLE_PARAMETER_KEY)
                    {
                        notification.Title = entry.Value; // prefer the title found in parameters
                    }
                    else if (entry.Key == MESSAGE_PARAMETER_KEY)
                    {
                        notification.Message = entry.Value; // prefer the message found in parameters
                    }
                    else
                    {
                        notification.AdditionalData.Add(entry.Key, entry.Value);
                    }
                }
                notification.AdditionalData.Add(FOREGROUND_ADDITIONAL_DATA, true);
            }

            NotifyNotification(notification);
        }
Esempio n. 51
0
 void ShellToastNotificationReceived(object sender, NotificationEventArgs e)
 {
     mVoice.Dispatcher.BeginInvoke(() =>
         {
             mVoice.RefreshInbox();
         });
 }
 void httpChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
 {
     Dispatcher.BeginInvoke(() =>
     {
         Debug.WriteLine("Toast Notification Message Received: ");
         if (e.Collection != null)
         {
             Dictionary<string, string> collection = (Dictionary<string, string>)e.Collection;
             
             foreach (string elementName in collection.Keys)
             {
                 Debug.WriteLine(string.Format("Key: {0}, Value:{1}\r\n", elementName, collection[elementName]));
             }
         }
     });
 }
        public void ShellToastNotificationReceived(object sender, NotificationEventArgs e)
        {
            StringBuilder message = new StringBuilder();
            string relativeUri = string.Empty;

            message.AppendFormat("Received Toast {0}:\n", DateTime.Now.ToShortTimeString());

            // Parse out the information that was part of the message.
            foreach (string key in e.Collection.Keys)
            {
                message.AppendFormat("{0}: {1}\n", key, e.Collection[key]);

                if (string.Compare(
                    key,
                    "wp:Param",
                    System.Globalization.CultureInfo.InvariantCulture,
                    System.Globalization.CompareOptions.IgnoreCase) == 0)
                {
                    relativeUri = e.Collection[key];
                }
            }

            BmobDebug.Log(message.ToString());

        }
 private void OnCurrentAsycudaSalesAllocationsExChanged(object sender, NotificationEventArgs <AsycudaSalesAllocationsEx> e)
 {
     vloader.FilterExpression = string.Format("Item_Id = {0}", e.Data.PreviousItem_Id.ToString());
     PreviousDocumentItems.Refresh();
 }
        // In-app toast
        private async void ToastNotificationReceived(
            object sender, NotificationEventArgs args)
        {
            if(Configuration == null) return;

            if(Configuration.ToastNotification != null)
                await Configuration.ToastNotification(args);
            else {
                Mvx.TaggedTrace(MvxTraceLevel.Warning, "WindowsPhone Notifications",
                    "No ToastNotification method was provided, using default MessageBox");
                await Configuration.DefaultToastNotification(args);
            }
        }
Esempio n. 56
0
        private void OnCodeSearchNotice(Object sender, NotificationEventArgs e)
        {
            CodeSearchWindow searchWindow = new CodeSearchWindow();

            searchWindow.ShowDialog();
        }
 private void OnNotification(object sender, NotificationEventArgs e)
 {
     _CachedLookups = null;
 }
Esempio n. 58
0
 private void OnAuthenticatedNotice(Object sender, NotificationEventArgs e)
 {
     _logInWindow.Close();
 }
Esempio n. 59
0
 void OnToastNotification(object sender, NotificationEventArgs e)
 {
     if (e.Collection != null)
     {
         Dictionary<string, string> collection = (Dictionary<string, string>)e.Collection;
         foreach (string elementName in collection.Keys)
         {
             Debug.WriteLine(elementName + " : " + collection[elementName]);
         }
     }
 }
Esempio n. 60
0
 private void OnMessageNotice(object sender, NotificationEventArgs e)
 {
     MessageBox.Show(e.Message, "Error", MessageBoxButton.OK);
 }