Esempio n. 1
0
        public static void InviteToDialog(string login, string nameDialog)
        {
            try
            {
                Content content = new Content("Invite", "*", login, "*", nameDialog, "*");
                string  sms     = content.GetContent(content);

                ListOfDialogs.GetListDialogs().First(d => d.NameDialog == nameDialog).dialog.Add(OnlineUsers.onlineUsers.First(c => c.name == login));
                SendMessage(sms, OnlineUsers.onlineUsers.First(c => c.name == login));
            }
            catch (Exception e)
            {
                CrashReports.Add(e.Message, "ClientComands - InviteToDialog");
            }
            Log.Add(login, "InviteToDialog", "ClientComands - InviteToDialog ");
        }
Esempio n. 2
0
 public static void ShowAllDialogs(Client client)
 {
     try
     {
         Content content = new Content("ShowAllDialogs", "*", "*", "", "*", "");
         foreach (Dialog dialog in ListOfDialogs.GetListDialogs())
         {
             if (dialog.PrivatDialog == false)
             {
                 content.Message += dialog.NameDialog + ";";
             }
         }
         string sms = content.GetContent(content);
         SendMessage(sms, client);
     }
     catch (Exception e)
     {
         CrashReports.Add(e.Message, "ClientComands - ShowAllDialogs");
     }
     Log.Add(client.login, "ShowAllDialogs", "ClientComands - ShowAllDialogs ");
 }
Esempio n. 3
0
        public static void NewMessage(string nameDialog, string message, string login)
        {
            try
            {
                Content content = new Content("SendMessage", "*", login, "*", nameDialog, message);
                string  sms     = content.GetContent(content);

                ListOfDialogs.GetListDialogs().First(d => d.NameDialog == nameDialog).messages.Add(message);
                foreach (Client client in ListOfDialogs.GetListDialogs().First(d => d.NameDialog == nameDialog).dialog)
                {
                    if (client != null && client.name != login)
                    {
                        SendMessage(sms, client);
                    }
                }
            }
            catch (Exception e)
            {
                CrashReports.Add(e.Message, "ClientComands - NewMessage");
            }
            Log.Add(login, "NewMessage", "ClientComands - NewMessage ");
        }
Esempio n. 4
0
 public static void LogOut(string login)
 {
     try
     {
         OnlineUsers.onlineUsers.Remove(OnlineUsers.onlineUsers.First(c => c.name == login));
         foreach (Dialog dialog in ListOfDialogs.GetListDialogs())
         {
             foreach (Client client in dialog.dialog)
             {
                 if (client.name == login)
                 {
                     dialog.dialog.Remove(client);
                     return;
                 }
             }
         }
     }
     catch (Exception e)
     {
         CrashReports.Add(e.Message, "ClientComands - LogOut");
     }
     Log.Add(login, "LogOut", "ClientComands - LogOut ");
 }