Exemple #1
0
        public static void OnNotification(Object o, EventArgs evt)
        {
            try
            {
                NB.Transport.MessageArgs message = (NB.Transport.MessageArgs)evt;
                NB.Transport.BrokerConnectionNotifier not = o as NB.Transport.BrokerConnectionNotifier;

                //message ensured not to be null after here
                if (message == null || not==null)
                    return;

                //respond to event
                switch (message.type)
                {
                    case NB.Transport.Enums.RequestType.Broadcast:

                        try
                        {
                            if (not.PlugConfig.ClientId != BrokerConnection.Subscribers[Config.NbDefault].Notification.PlugConfig.ClientId)
                                break;

                            if(FormsManagerProxy.DataViewerControls.ContainsKey("JobLauncher") &&
                                FormsManagerProxy.DataViewerControls["JobLauncher"] != null)
                            {

                                //var n = from nn in BrokerConnection.Subscribers.Values
                                //        where
                                //            nn.Notification!=null &&  
                                //            nn.Notification.PlugConfig.ClientId == not.PlugConfig.ClientId
                                //        select nn;

                                BitsUiWpf.Model.BrokerNotification n2 = new BitsUiWpf.Model.BrokerNotification(Config.NbDefault, message);
                                if (n2 != null && FormsManagerProxy.DataViewerControls["JobLauncher"]!=null)
                                {
                                    dpm = new delNotification(((JobLauncher)FormsManagerProxy.DataViewerControls["JobLauncher"]).BroadcastMsg);
                                    ((JobLauncher)FormsManagerProxy.DataViewerControls["JobLauncher"]).BeginInvoke(dpm, n2);
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            log.DebugFormat("Error: {0}\n{1}", e.Message, e.StackTrace);
                        }
                        break;
                }
            }
            catch (Exception e)
            {
                log.DebugFormat("Error: {0}\n{1}", e.Message, e.StackTrace);
            }
        }
Exemple #2
0
        public void OnNotification(Object o, EventArgs evt)
        {
            try
            {
                MessageArgs message = (MessageArgs)evt;

                //message ensured not to be null after here
                if (message == null)
                    return;


                //respond to event
                switch (message.type)
                {
                    case Enums.RequestType.Broadcast:

                        dpm = new delNotification(BroadcastMsg);
                        try
                        {
                            //JobLauncher jobLauncher = (JobLauncher)FormsManager.DataViewerControls["JobLauncher"] as JobLauncher;
                            //if (jobLauncher!=null)
                            //    jobLauncher.BeginInvoke(dpm, message);
                        }
                        catch (Exception e)
                        {
                            log.DebugFormat("Error: {0}\n{1}", e.Message, e.StackTrace);
                        }
                        break;
                }
            }
            catch (Exception e)
            {
                log.DebugFormat("Error: {0}\n{1}", e.Message, e.StackTrace);
            }
        }