Ejemplo n.º 1
0
 public void OnEmploiChanged(int id_en, string notification)
 {
     if (EmploiChanged != null)
     {
         EmploiChangedEvent notifDelegate   = null;
         Delegate[]         invocationList_ = null;
         try
         {
             invocationList_ = EmploiChanged.GetInvocationList();
         }
         catch (MemberAccessException ex)
         {
             throw ex;
         }
         if (invocationList_ != null)
         {
             lock (this)
             {
                 foreach (Delegate del in invocationList_)
                 {
                     notifDelegate = (EmploiChangedEvent)del;
                     WrapperDelegate wrDel    = new WrapperDelegate(BeginSend);
                     AsyncCallback   callback = new AsyncCallback(EndSend);
                     wrDel.BeginInvoke(id_en, notification, notifDelegate, callback, wrDel);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 private void BeginSend(int id_en, string notification, EmploiChangedEvent notifDelegate)
 {
     try
     {
         notifDelegate(id_en, notification);
     }
     catch (Exception e)
     {
         EmploiChanged -= notifDelegate;
     }
 }
Ejemplo n.º 3
0
        public void NotificationReceivedHandler(int id_en, string message)
        {
            ListView notifborad = emp.getNotifBoard();

            if (notifborad.InvokeRequired == false)
            {
                if (loginForm.user.id_utilisateur == id_en)
                {
                    notifborad.Items.Add(message);
                    MessageBox.Show(message);
                }
            }
            else
            {
                // Show the text asynchronously
                EmploiChangedEvent statusDelegate =
                    new EmploiChangedEvent(crossThreadEventHandler);
                this.BeginInvoke(statusDelegate,
                                 new object[] { id_en, message });
            }
        }
Ejemplo n.º 4
0
 public NotificationClass()
 {
     notifDelegate = new EmploiChangedEvent(OnEmploiChanged);
 }