Ejemplo n.º 1
0
 private void btnInvite_Click(object sender, EventArgs e)
 {
     if (lbUsers.SelectedItem != null && tabC_Dialogs.SelectedTab != null && tabC_Dialogs.SelectedTab.Text != "")
     {
         ServerCommands.InviteToDialog(tabC_Dialogs.SelectedTab.Text, lbUsers.SelectedItem.ToString());
     }
 }
Ejemplo n.º 2
0
 private void btnSendMessage_Click(object sender, EventArgs e)
 {
     if (txtMessage.Text != "")
     {
         if (privateDialog == false)
         {
             if (ClientAPI.Ban == false)
             {
                 ServerCommands.SendMessage(Parent.Name, ClientAPI.Login, txtMessage.Text);
                 string str = "[" + ClientAPI.Login + "] : " + txtMessage.Text;
                 messages.Add(str);
                 lbMessages.Items.Add(str);
             }
             else
             {
                 MessageBox.Show("You are banned from this server! Try again latter please!", "Error!");
             }
         }
         else
         {
             ServerCommands.SendPrivateMessage(Parent.Name, txtMessage.Text);
             string str = "[" + ClientAPI.Login + "] : " + txtMessage.Text;
             messages.Add(str);
             lbMessages.Items.Add(str);
         }
         txtMessage.Clear();
         newMessage = 0;
     }
 }
Ejemplo n.º 3
0
        private void MenuHandler(object sender, EventArgs e)
        {
            switch ((string)((ToolStripItem)sender).Text)
            {
            case "CreateDialog": if (ClientAPI.Ban == false)
                {
                    new CreateMyDialog().Show();
                }
                else
                {
                    MessageBox.Show("You are banned from this server! Try again latter please!", "Error!");
                } break;

            case "My dialogs": ShowMyDialogs();                                                                                                        break;

            case "All dialogs": RequestShowAllDialogs();                                                                                                break;

            case "Show online users": RequestShowOnlineUsers();                                                                                               break;

            case "Log Out/Exit": ServerCommands.LogOut(ClientAPI.Login); Close(); LogOut = true;   authorization.Show();                                               break;

            case "Save dialog": collectionOfDialogsView.GetSelectedDialogView(tabC_Dialogs.SelectedTab.Text).SaveDialog(tabC_Dialogs.SelectedTab.Text); break;

            case "Change password": new ChangePassword().Show();                                                                                            break;

            default: break;
            }
        }
Ejemplo n.º 4
0
 private void btnChangePassword_Click(object sender, EventArgs e)
 {
     if (txtOldPass.Text != "" && txtNewPass.Text != "")
     {
         ServerCommands.ChangePassword(txtNewPass.Text);
         Close();
     }
 }
Ejemplo n.º 5
0
 private void btnSend_Click(object sender, EventArgs e)
 {
     if (txtLogin.Text != "" && txtEmail.Text != "")
     {
         ServerCommands.ForgotPassword(txtLogin.Text, txtEmail.Text);
         Close();
     }
 }
Ejemplo n.º 6
0
 private void btnToComeIn_Click(object sender, EventArgs e)
 {
     if (lbDialogs.SelectedItem != null)
     {
         ServerCommands.ToComeIn_TheDialog(lbDialogs.SelectedItem.ToString(), ClientAPI.Login);
         CreateDialogWhereImComeIn(lbDialogs.SelectedItem.ToString());
     }
 }
Ejemplo n.º 7
0
        private void btnFaceBook_Click(object sender, EventArgs e)
        {
            ExternalAuth auth = new ExternalAuth();

            string[] info  = auth.Facebook_Auth();
            string   name  = auth.Tr(info[0]);
            string   login = auth.Tr(info[1]);

            ServerCommands.AuthorizationWithFaceBook(name, login);
        }
Ejemplo n.º 8
0
        private void btnGoogle_Click(object sender, EventArgs e)
        {
            ExternalAuth auth = new ExternalAuth();

            string[] info  = auth.Google_Auth();
            string   name  = info[0];
            string   login = info[1];

            ServerCommands.AuthorizationWithGoogle(name, login);
        }
Ejemplo n.º 9
0
 public void CloseDialog(bool privateDialog)
 {
     if (privateDialog == false)
     {
         ServerCommands.CloseDialog(tabC_Dialogs.SelectedTab.Name, ClientAPI.Login);
     }
     collectionOfDialogsView.DeleteDialog(tabC_Dialogs.SelectedTab.Name);
     collectionOfTabPages.DeletePage(tabC_Dialogs.SelectedTab.Name);
     tabC_Dialogs.TabPages.Remove(tabC_Dialogs.SelectedTab);
 }
Ejemplo n.º 10
0
 private void btnSignUP_Click(object sender, EventArgs e)
 {
     if (txtLogin.Text != "Put your login" && txtName.Text != "Put your name" && txtPass.Text != "Put your password" && txtLogin.Text != "" && txtName.Text != "" && txtPass.Text != "")
     {
         ServerCommands.SingUP(txtName.Text, txtLogin.Text, txtPass.Text);
     }
     else
     {
         MessageBox.Show("Please put correct information in fields", "Error");
     }
 }
Ejemplo n.º 11
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     if (txtLogin.Text == "" || txtLogin.Text == "Put your login")
     {
         MessageBox.Show("Please, put your natural login.", "Error!");
     }
     else
     {
         ServerCommands.Authorization(txtLogin.Text, txtPass.Text);
     }
 }
Ejemplo n.º 12
0
 private void btnShow_Click(object sender, EventArgs e)
 {
     lbBanUsers.Items.Clear();
     if (users == "BannedUsers")
     {
         ServerCommands.ShowBannedUsers();
     }
     else if (users == "AllUsers")
     {
         ServerCommands.ShowAllUsersForAdmin();
     }
     else
     {
         lbBanUsers.Items.Add(users);
     }
 }
Ejemplo n.º 13
0
        private void btnBan_Click(object sender, EventArgs e)
        {
            if (txtTime.Text != "" && cbTimeValue.SelectedItem != null)
            {
                string time = "";
                switch (cbTimeValue.SelectedItem.ToString())
                {
                case "minutes": time = Convert.ToString(DateTime.Now.AddMinutes(Convert.ToDouble(txtTime.Text))); break;

                case "days": time = Convert.ToString(DateTime.Now.AddDays(Convert.ToDouble(txtTime.Text)));       break;

                case "weeks": time = Convert.ToString(DateTime.Now.AddDays(Convert.ToDouble(txtTime.Text) * 7));    break;

                case "months": time = Convert.ToString(DateTime.Now.AddMonths(Convert.ToInt32(txtTime.Text)));    break;

                case "years": time = Convert.ToString(DateTime.Now.AddYears(Convert.ToInt32(txtTime.Text)));      break;

                case "forever": time = "forever";                                                                 break;

                default: break;
                }
                ServerCommands.Ban(lbBanUsers.SelectedItem.ToString(), time);
            }
        }
Ejemplo n.º 14
0
 private void RequestShowOnlineUsers()
 {
     ServerCommands.ShowOnlineUsers(ClientAPI.Login);
 }
Ejemplo n.º 15
0
 private void RequestShowAllDialogs()
 {
     ServerCommands.ShowAllDialogs(ClientAPI.Login);
 }
Ejemplo n.º 16
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     mainWindow.CreateDialog(txtNameDialog.Text, false);
     ServerCommands.CreateDialog(ClientAPI.Login, txtNameDialog.Text);
     Close();
 }
Ejemplo n.º 17
0
 private void btnUnban_Click(object sender, EventArgs e)
 {
     ServerCommands.Unban(lbBanUsers.SelectedItem.ToString());
 }