コード例 #1
0
 void btn_Click(object sender, EventArgs e)
 {
     try
     {
         GigMessage msg = (GigMessage)(((ButtonItem)sender).Tag);
         MessageBoxEx.Show("Source : " + msg.Sender + " \r\n Message : " + msg.Message + " \r\n Date de réception : " + msg.RD.ToString(), "Messages", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch
     {
     }
 }
コード例 #2
0
        internal static void Run()
        {
            try
            {
                string[] f  = File.ReadAllLines(Application.StartupPath + @"\Data\" + Client.Username + ".dat");
                string   lm = f[0];
                string   ln = f[1];
                int      mc = 0;
                int      nc = 0;
                int      i  = 0;
                while (Exec)
                {
                    try
                    {
                        mc        = 0;
                        nc        = 0;
                        Connected = Client.GetCommunityInfo().NumberPlayers;
                        SetCON(Connected);
                        List <GigMessage> msg = GigSpace.Client.GetMessages();
                        string            ma  = "";
                        for (i = msg.Count - 1; i >= 0; i--)
                        {
                            GigMessage m = msg[i];
                            if (lm == m.Message)
                            {
                                break;
                            }
                            mc++;
                            ma = m.Message;
                        }
                        if (ma.Length > 0)
                        {
                            lm = msg[msg.Count - 1].Message;
                            mc = msg.Count - i - 1;
                        }


                        List <string> noti = GigSpace.Client.GetNotifications();
                        ma = "";
                        for (i = noti.Count - 1; i >= 0; i--)
                        {
                            string m = noti[i];
                            if (ln == m)
                            {
                                break;
                            }
                            nc++;
                            ma = m;
                        }
                        if (ma.Length > 0)
                        {
                            ln = noti[noti.Count - 1];
                            nc = noti.Count - i - 1;
                        }

                        if (mc > 0 || nc > 0)
                        {
                            File.WriteAllLines(Application.StartupPath + @"\Data\" + Client.Username + ".dat", new string[2] {
                                lm, ln
                            });
                            if (nc > 0 && NotificationArrived != null)
                            {
                                NotificationArrived(nc);
                                GPlayer.NEWNOTIF();
                            }
                            if (mc > 0 && MessageArrived != null)
                            {
                                MessageArrived(mc);
                                GPlayer.NEWMSG();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        GigSpace.LogError(ex);
                    }

                    Thread.Sleep(SettingsManager.GetInt("DELAY") * 1000);
                }
            }
            catch (Exception ex)
            {
                GigSpace.LogError(ex);
            }
        }