private void SetDeviceIDValidity()
        {
            string errorMessage = Checker.CheckDeviceIDValidity(this.macAddressBox.Text);

            if (errorMessage == null)
            {
                this.DeviceIDValid = true;
            }
            else
            {
                this.DeviceIDValid = false;
            }
            if (DeviceIDValid)
            {
                this.deviceIDSign.Image           = new Bitmap(FileResources.Icon("ok.png"), deviceIDSign.Size);
                this.deviceIDErrorMessage.Visible = false;
                this.deviceIDSign.Visible         = true;
            }
            else
            {
                this.deviceIDErrorMessage.Text    = errorMessage;
                this.deviceIDErrorMessage.Size    = this.deviceIDErrorMessage.PreferredSize;
                this.deviceIDErrorMessage.Left    = this.macAddressBox.Right - this.deviceIDErrorMessage.Width + 5;
                this.deviceIDSign.Image           = new Bitmap(FileResources.Icon("redwarning.png"), deviceIDSign.Size);
                this.deviceIDErrorMessage.Visible = true;
                this.deviceIDSign.Visible         = true;
            }
            if (this.signUpButtonMessage.Visible)
            {
                this.AllSignupConstraintsOk();
            }
        }
        private void AddOptionsToBar()
        {
            this.optionLabels = new List <Label>();
            this.optionLabels.Add(new Label());
            this.optionLabels.Add(new Label());
            //this.optionLabels.Add(new Label());

            Label lastLabel = null;

            for (int i = 0; i < this.optionLabels.Count; i++)
            {
                this.optionLabels[i].Name  = i.ToString();
                this.optionLabels[i].Image = new Bitmap(FileResources.Icon(String.Format("option_{0}.png", i)), new Size(this.optionBarPanel.Height * 3 / 4, this.optionBarPanel.Height * 3 / 4));
                this.optionLabels[i].Size  = new Size((this.optionBarPanel.Width / this.optionLabels.Count) - 1, this.optionBarPanel.Height);
                if (lastLabel != null)
                {
                    this.optionLabels[i].Left = lastLabel.Right + 2;
                }
                else
                {
                    this.optionLabels[i].Left = 0;
                }
                this.optionLabels[i].Top = 0;
                lastLabel = this.optionLabels[i];
                this.optionLabels[i].BackColor   = Color.FromArgb(28, 28, 28);
                this.optionLabels[i].MouseEnter += new EventHandler(OnMouseEnterToOptionBar);
                this.optionLabels[i].MouseLeave += new EventHandler(OnMouseLeaveFromOptionBar);
                this.optionBarPanel.Controls.Add(this.optionLabels[i]);
            }

            this.optionLabels[0].Click += delegate(Object sender, EventArgs e) { this.ShowListPanel(0); };
            this.optionLabels[1].Click += delegate(Object sender, EventArgs e) { this.ShowListPanel(1); };
            //this.optionLabels[2].Click += delegate(Object sender, EventArgs e) { this.ShowListPanel(2); };
        }
 private void OnMouseLeave(Object sender, EventArgs me)
 {
     if (sender == sidebarSwitchLabel)
     {
         this.sidebarSwitchLabel.Image = new Bitmap(FileResources.Icon("threeLines.png"), this.sidebarSwitchLabel.Image.Size);
     }
 }
        private void SendButtonsInitialize()
        {
            this.sendButton           = new Button();
            this.sendButton.Image     = new Bitmap(FileResources.Icon("sendButton.png"), new Size(this.nuntiasTextBox.Height, this.nuntiasTextBox.Height));
            this.sendButton.Font      = this.nuntiasTextBox.Font;
            this.sendButton.Size      = this.sendButton.Image.Size;
            this.sendButton.Left      = this.nuntiasTextBox.Width + 15;
            this.sendButton.FlatStyle = FlatStyle.Flat;
            this.sendButton.FlatAppearance.BorderSize = 0;
            this.sendButton.Click += new EventHandler(this.OnClick);
            this.typingSpaceBar.Controls.Add(this.sendButton);

            this.chooseFileButton           = new Button();
            this.chooseFileButton.Image     = GraphicsStudio.ResizeImageByHeight(FileResources.Icon("choosefiles.png"), sendButton.Image.Height);
            this.chooseFileButton.Font      = this.nuntiasTextBox.Font;
            this.chooseFileButton.Size      = this.chooseFileButton.Image.Size;
            this.chooseFileButton.Left      = this.sendButton.Right + 15;
            this.chooseFileButton.FlatStyle = FlatStyle.Flat;
            this.chooseFileButton.FlatAppearance.BorderSize = 0;
            this.chooseFileButton.Click += new EventHandler(this.OnClick);
            this.typingSpaceBar.Controls.Add(this.chooseFileButton);

            this.snapshotButton           = new Button();
            this.snapshotButton.Image     = GraphicsStudio.ResizeImageByHeight(FileResources.Icon("snapshot.png"), sendButton.Image.Height);
            this.snapshotButton.Font      = this.nuntiasTextBox.Font;
            this.snapshotButton.Size      = this.snapshotButton.Image.Size;
            this.snapshotButton.Left      = this.chooseFileButton.Right + 15;
            this.snapshotButton.FlatStyle = FlatStyle.Flat;
            this.snapshotButton.FlatAppearance.BorderSize = 0;
            this.snapshotButton.Click += new EventHandler(this.OnClick);
            this.typingSpaceBar.Controls.Add(this.snapshotButton);
        }
        private void SetUserNameValidity(Object sender, EventArgs e)
        {
            if (this.usernameBox.TextLength > 0 && usernameBoxSign.Visible == false && WaitingUsernameAnimationShowing == false)
            {
                VisualizingTools.ShowWaitingAnimation(usernameBoxSign.Location, usernameBoxSign.Size, this);
                WaitingUsernameAnimationShowing = true;
            }
            this.UserNameValid = false;
            if (Time.TimeDistanceInSecond(this.lastUsernameTextChangeTime, Time.CurrentTime) < 3)
            {
                return;
            }
            this.userNameValidateTimer.Stop();

            if (this.usernameBox.TextLength > 0)
            {
                int    selectionStartPrev = this.usernameBox.SelectionStart;
                string input        = this.usernameBox.Text;
                string errorMessage = Checker.CheckUsernameValidity(ref input);
                this.usernameBox.Text           = input;
                this.usernameBox.SelectionStart = selectionStartPrev;
                if (errorMessage == null)
                {
                    UserNameValid = true;
                }

                if (UserNameValid)
                {
                    this.usernameBoxSign.Image           = new Bitmap(FileResources.Icon("ok.png"), usernameBoxSign.Size);
                    this.usernameBoxErrorMessage.Visible = false;
                }
                else
                {
                    this.usernameBoxErrorMessage.Text    = errorMessage;
                    this.usernameBoxErrorMessage.Size    = this.usernameBoxErrorMessage.PreferredSize;
                    this.usernameBoxErrorMessage.Left    = this.usernameBox.Right - this.usernameBoxErrorMessage.Width + 5;
                    this.usernameBoxSign.Image           = new Bitmap(FileResources.Icon("redwarning.png"), usernameBoxSign.Size);
                    this.usernameBoxErrorMessage.Visible = true;
                }
                VisualizingTools.HideWaitingAnimation();
                this.WaitingUsernameAnimationShowing = false;
                this.usernameBoxSign.Visible         = true;
            }
            else
            {
                usernameBoxSign.Visible         = false;
                usernameBoxErrorMessage.Visible = false;
            }
            if (this.signUpButtonMessage.Visible)
            {
                this.AllSignupConstraintsOk();
            }
        }
        private void WelcomeLabelInitialize()
        {
            logoLabel = new Label();
            Image  logoImg    = FileResources.Icon("logo_with_name.png");
            double logoHeight = this.Height / 3.0;
            double logoWidth  = logoImg.Width * (logoHeight / logoImg.Height);

            logoLabel.Image    = new Bitmap(FileResources.Icon("logo_with_name.png"), new Size((int)logoWidth, (int)logoHeight));
            logoLabel.Size     = logoLabel.Image.Size;
            logoLabel.Location = new Point((this.Width - logoLabel.Width) / 2, this.Height / 10);
            this.Controls.Add(logoLabel);
        }
Ejemplo n.º 7
0
 protected void ShowBackButtonLabel()
 {
     this.backButtonLabel             = new Label();
     this.backButtonLabel.Name        = "Back";
     this.backButtonLabel.Size        = new Size(this.Width / 6, this.Height / 8);
     this.backButtonLabel.Location    = new Point(3, 8);
     this.backButtonLabel.Image       = new Bitmap(FileResources.Icon("back.png"), new Size(backButtonLabel.Height - 20, backButtonLabel.Height - 20));
     this.backButtonLabel.ImageAlign  = ContentAlignment.MiddleCenter;
     this.backButtonLabel.MouseEnter += delegate(Object sender, EventArgs e) { ((Label)sender).BackColor = Color.FromArgb(((Label)sender).BackColor.R - 25, ((Label)sender).BackColor.G - 25, ((Label)sender).BackColor.B - 25); };
     this.backButtonLabel.MouseLeave += delegate(Object sender, EventArgs e) { ((Label)sender).BackColor = Color.FromArgb(((Label)sender).BackColor.R + 25, ((Label)sender).BackColor.G + 25, ((Label)sender).BackColor.B + 25); };
     this.backButtonLabel.Click      += delegate(Object sender, EventArgs e) { this.parent.Controls.Remove(this); ((FriendListPanel)parent).RefreshFriendlist(); this.parent.Controls.Add(((FriendListPanel)parent).FriendListMainPanel); };
     this.Controls.Add(this.backButtonLabel);
 }
 public void ReverseOptionLabelColor(Label currentLabel, string changeColor)
 {
     if (changeColor == "black")
     {
         currentLabel.Image     = new Bitmap(FileResources.Icon(String.Format("option_{0}.png", currentLabel.Name)), currentLabel.Image.Size);
         currentLabel.BackColor = Color.FromArgb(28, 28, 28);
     }
     else
     {
         currentLabel.Image     = new Bitmap(FileResources.Icon(String.Format("option_{0}_rev.png", currentLabel.Name)), currentLabel.Image.Size);
         currentLabel.BackColor = Color.FromArgb(176, 176, 176);
     }
 }
Ejemplo n.º 9
0
        static NuntiasOptionsPanel()
        {
            Label dummy = new Label();

            dummy.Font = CustomFonts.Smallest;
            dummy.Text = "codelete";
            labelSize  = dummy.PreferredSize;

            Size iconSize = new Size(dummy.PreferredHeight - 5, dummy.PreferredHeight - 5);

            deleteIcon = new Bitmap(FileResources.Icon("deleteIcon.png"), iconSize);
            copyIcon   = new Bitmap(FileResources.Icon("copyIcon.png"), iconSize);
            dummy.Dispose();
        }
Ejemplo n.º 10
0
 private void OnMouseLeave(Object sender, EventArgs me)
 {
     if (sender == userViewIcons[0])
     {
         this.userViewIcons[0].BackColor = Color.FromArgb(this.userViewIcons[0].BackColor.R - 50, this.userViewIcons[0].BackColor.G - 50, this.userViewIcons[0].BackColor.B - 50);
     }
     for (int i = 0; i < userViewIcons.Count; i++)
     {
         if (sender == userViewIcons[i])
         {
             this.userViewIcons[i].Image = new Bitmap(FileResources.Icon(String.Format("userViewIcon{0}.png", i)), this.userViewIcons[i].Image.Size);
             return;
         }
     }
 }
        static NuntiasInfoPanel()
        {
            Label dummy = new Label();

            dummy.Font = CustomFonts.Smallest;
            dummy.Text = "1234567890";
            labelSize  = dummy.PreferredSize;

            Size iconSize = new Size(dummy.PreferredHeight - 5, dummy.PreferredHeight - 5);

            sentIcon      = new Bitmap(FileResources.Icon("sentIcon.png"), iconSize);
            deliveredIcon = new Bitmap(FileResources.Icon("deliveredIcon.png"), iconSize);
            seenIcon      = new Bitmap(FileResources.Icon("seenIcon.png"), iconSize);
            dummy.Dispose();
        }
Ejemplo n.º 12
0
        private void AddIconsToUserView()
        {
            this.userViewIcons = new List <Label>(3);

            this.userViewIcons.Add(new Label());

            Label lastLabel = null;

            for (int i = 1; i < this.userViewIcons.Capacity; i++)
            {
                Label item = new Label();
                item.Name  = String.Format("userViewIcon{0}", i);
                item.Image = new Bitmap(FileResources.Icon(String.Format("userViewIcon{0}.png", i)), new Size(this.userViewPanel.Width / 20, userViewPanel.Width / 20));
                item.Size  = item.Image.Size;
                if (lastLabel != null)
                {
                    item.Left = lastLabel.Left - item.Width - item.Width / 2;
                }
                else
                {
                    item.Left = this.userViewPanel.Width - item.Width * 2;
                }
                item.Top         = item.Width;
                lastLabel        = item;
                item.Click      += new EventHandler(OnClick);
                item.MouseEnter += new EventHandler(OnMouseEnter);
                item.MouseLeave += new EventHandler(OnMouseLeave);
                this.userViewPanel.Controls.Add(item);
                this.userViewIcons.Add(item);
            }

            //for sidebar closing button
            int index = 0;

            this.userViewIcons[index].Name        = String.Format("userViewIcon{0}", index);
            this.userViewIcons[index].Image       = new Bitmap(FileResources.Icon(String.Format("userViewIcon{0}.png", index)), new Size(this.userViewPanel.Width / 20, this.userViewPanel.Height / 3));
            this.userViewIcons[index].Size        = new Size(this.userViewIcons[index].Image.Width * 5 / 2, this.userViewIcons[index].Image.Height + this.userViewIcons[index].Image.Height / 2);
            this.userViewIcons[index].ImageAlign  = ContentAlignment.MiddleCenter;
            this.userViewIcons[index].BackColor   = this.userViewPanel.BackColor;
            this.userViewIcons[index].Left        = this.userViewPanel.Right - this.userViewIcons[1].Right;
            this.userViewIcons[index].Top         = this.userViewIcons[1].Top;
            this.userViewIcons[index].Click      += new EventHandler(OnClick);
            this.userViewIcons[index].MouseEnter += new EventHandler(OnMouseEnter);
            this.userViewIcons[index].MouseLeave += new EventHandler(OnMouseLeave);
            this.userViewPanel.Controls.Add(this.userViewIcons[index]);
            this.userViewIcons.Add(this.userViewIcons[index]);
        }
Ejemplo n.º 13
0
        private void SetConfirmPasswordValidity(Object sender, EventArgs e)
        {
            this.ConfirmPasswordValid = false;
            TextBox confirmKeyBox = (TextBox)sender;

            if (confirmKeyBox.TextLength > 0)
            {
                string input = this.confirmPasswordBox.Text;
                this.ConfirmPasswordValid = (this.newPassword == confirmKeyBox.Text);
                string message = null;
                if (this.newPassword == null)
                {
                    message = "Enter a valid password first"; this.confirmPasswordBoxMessage.ForeColor = Colors.ErrorTextColor;
                }
                else if (ConfirmPasswordValid)
                {
                    this.confirmPasswordBoxMessage.Visible = false;
                }
                else
                {
                    message = "Password doesn't match"; this.confirmPasswordBoxMessage.ForeColor = Colors.ErrorTextColor;
                }
                this.confirmPasswordBoxMessage.Text    = message;
                this.confirmPasswordBoxMessage.Size    = this.confirmPasswordBoxMessage.PreferredSize;
                this.confirmPasswordBoxMessage.Left    = this.confirmPasswordBox.Right - this.confirmPasswordBoxMessage.Width + 5;
                this.confirmPasswordBoxMessage.Visible = true;
                this.confirmPasswordBoxSign.Visible    = true;
                if (ConfirmPasswordValid)
                {
                    this.confirmPasswordBoxSign.Image = new Bitmap(FileResources.Icon("ok.png"), confirmPasswordBoxSign.Size);
                }
                else
                {
                    this.confirmPasswordBoxSign.Image = new Bitmap(FileResources.Icon("redwarning.png"), confirmPasswordBoxSign.Size);
                }
            }
            else
            {
                confirmPasswordBoxSign.Visible    = false;
                confirmPasswordBoxMessage.Visible = false;
            }
            if (this.passwordSetupButtonMessage.Visible)
            {
                this.AllKeySetupConstraintsOk();
            }
        }
        private void ShowNotFriendOptions()
        {
            this.notFriendOptionLabels = new List <Label>();
            this.notFriendOptionLabels.Add(new Label());
            this.notFriendOptionLabels.Add(new Label());
            this.notFriendOptionLabels.Add(new Label());

            Size  originalImgSize = new Size(200, 77);
            float buttonWidth = (this.parent.Width - 20) / 3, buttonHeight = originalImgSize.Height * (buttonWidth / (float)originalImgSize.Width);

            this.notFriendOptionLabels[0].Name        = "AddFriend";
            this.notFriendOptionLabels[0].Image       = new Bitmap(FileResources.Icon("addFriend.png"), new Size((int)buttonWidth, (int)buttonHeight));
            this.notFriendOptionLabels[0].Size        = new Size((int)buttonWidth, this.notFriendOptionLabels[0].Image.Height);
            this.notFriendOptionLabels[0].BackColor   = Color.FromArgb(234, 234, 234);
            this.notFriendOptionLabels[0].ImageAlign  = ContentAlignment.MiddleCenter;
            this.notFriendOptionLabels[0].Location    = new Point(3, 6);
            this.notFriendOptionLabels[0].MouseEnter += delegate(Object sender, EventArgs e) { ((Label)sender).BackColor = Color.FromArgb(((Label)sender).BackColor.R - 25, ((Label)sender).BackColor.G - 25, ((Label)sender).BackColor.B - 25); };
            this.notFriendOptionLabels[0].MouseLeave += delegate(Object sender, EventArgs e) { ((Label)sender).BackColor = Color.FromArgb(((Label)sender).BackColor.R + 25, ((Label)sender).BackColor.G + 25, ((Label)sender).BackColor.B + 25); };
            this.notFriendOptionLabels[0].Click      += delegate(Object sender, EventArgs e) { this.Controls.Remove(this.friendsListMainPanel); this.Controls.Add(new AddFriendPanel(this)); };
            this.friendsListMainPanel.Controls.Add(this.notFriendOptionLabels[0]);

            this.notFriendOptionLabels[1].Name        = "FriendRequests";
            this.notFriendOptionLabels[1].Image       = new Bitmap(FileResources.Icon("friendRequests.png"), new Size((int)buttonWidth, (int)buttonHeight));
            this.notFriendOptionLabels[1].Size        = new Size((int)buttonWidth, this.notFriendOptionLabels[1].Image.Height);
            this.notFriendOptionLabels[1].Location    = new Point(this.notFriendOptionLabels[0].Right + 5, 6);
            this.notFriendOptionLabels[1].BackColor   = Color.FromArgb(234, 234, 234);
            this.notFriendOptionLabels[1].ImageAlign  = ContentAlignment.MiddleCenter;
            this.notFriendOptionLabels[1].MouseEnter += delegate(Object sender, EventArgs e) { ((Label)sender).BackColor = Color.FromArgb(((Label)sender).BackColor.R - 25, ((Label)sender).BackColor.G - 25, ((Label)sender).BackColor.B - 25); };
            this.notFriendOptionLabels[1].MouseLeave += delegate(Object sender, EventArgs e) { ((Label)sender).BackColor = Color.FromArgb(((Label)sender).BackColor.R + 25, ((Label)sender).BackColor.G + 25, ((Label)sender).BackColor.B + 25); };
            this.notFriendOptionLabels[1].Click      += delegate(Object sender, EventArgs e) { this.Controls.Remove(this.friendsListMainPanel); this.Controls.Add(new FriendRequestsPanel(this)); };
            this.friendsListMainPanel.Controls.Add(this.notFriendOptionLabels[1]);

            this.notFriendOptionLabels[2].Name        = "BlockedPersons";
            this.notFriendOptionLabels[2].Image       = new Bitmap(FileResources.Icon("blockedPersons.png"), new Size((int)buttonWidth, (int)buttonHeight));
            this.notFriendOptionLabels[2].Size        = new Size((int)buttonWidth, this.notFriendOptionLabels[2].Image.Height);
            this.notFriendOptionLabels[2].Location    = new Point(this.notFriendOptionLabels[1].Right + 5, 6);
            this.notFriendOptionLabels[2].BackColor   = Color.FromArgb(234, 234, 234);
            this.notFriendOptionLabels[2].ImageAlign  = ContentAlignment.MiddleCenter;
            this.notFriendOptionLabels[2].MouseEnter += delegate(Object sender, EventArgs e) { ((Label)sender).BackColor = Color.FromArgb(((Label)sender).BackColor.R - 25, ((Label)sender).BackColor.G - 25, ((Label)sender).BackColor.B - 25); };
            this.notFriendOptionLabels[2].MouseLeave += delegate(Object sender, EventArgs e) { ((Label)sender).BackColor = Color.FromArgb(((Label)sender).BackColor.R + 25, ((Label)sender).BackColor.G + 25, ((Label)sender).BackColor.B + 25); };
            this.friendsListMainPanel.Controls.Add(this.notFriendOptionLabels[2]);
        }
        private void ThreeLinesOnConversationTitleBar()
        {
            this.conversationTitleBar           = new Panel();
            this.conversationTitleBar.Size      = new Size(this.Width, this.Height / 9);
            this.conversationTitleBar.BackColor = Color.FromArgb(100, 100, 100);
            this.conversationTitleBar.Location  = new Point(0, 0);
            this.conversationTitleBar.Click    += new EventHandler(OnClick);

            Image threeLines = FileResources.Icon("threeLines.png");

            this.sidebarSwitchLabel             = new Label();
            this.sidebarSwitchLabel.Image       = new Bitmap(threeLines, conversationTitleBar.Height / 2 - conversationTitleBar.Height / 8, conversationTitleBar.Height / 2 - conversationTitleBar.Height / 8);
            this.sidebarSwitchLabel.Size        = this.sidebarSwitchLabel.Image.Size;
            this.sidebarSwitchLabel.Location    = new Point((this.conversationTitleBar.Height - this.sidebarSwitchLabel.Height) / 2, (this.conversationTitleBar.Height - this.sidebarSwitchLabel.Height) / 2);
            this.sidebarSwitchLabel.Click      += new EventHandler(OnClick);
            this.sidebarSwitchLabel.MouseEnter += new EventHandler(OnMouseEnter);
            this.sidebarSwitchLabel.MouseLeave += new EventHandler(OnMouseLeave);
            this.conversationTitleBar.Controls.Add(sidebarSwitchLabel);
            this.Controls.Add(conversationTitleBar);
        }
        private void ShowSmilyWelcome()
        {
            Label smilyIconLabel = new Label();

            smilyIconLabel.Image    = new Bitmap(FileResources.Icon("smile.png"), new Size(this.Width / 2, this.Width / 2));
            smilyIconLabel.Size     = smilyIconLabel.Image.Size;
            smilyIconLabel.Location = new Point((this.Width - smilyIconLabel.Image.Width) / 2, (Universal.ParentForm.Height - smilyIconLabel.Height) / 4);
            smilyIconLabel.Click   += new EventHandler(OnClick);
            this.Controls.Add(smilyIconLabel);

            Label welcomeMessageLabel = new Label();

            welcomeMessageLabel.Text      = "Hey, Welcome to dragenger!\r\n\r\nLet's make\r\nConversations with fun.";
            welcomeMessageLabel.TextAlign = ContentAlignment.MiddleCenter;
            welcomeMessageLabel.Font      = CustomFonts.BiggerBold;
            welcomeMessageLabel.Size      = welcomeMessageLabel.PreferredSize;
            welcomeMessageLabel.ForeColor = Color.FromArgb(128, 128, 128);
            welcomeMessageLabel.Location  = new Point((this.Width - welcomeMessageLabel.Width) / 2, smilyIconLabel.Bottom + 15);
            welcomeMessageLabel.Click    += new EventHandler(OnClick);
            this.Controls.Add(welcomeMessageLabel);
        }
Ejemplo n.º 17
0
        private void SetOldPasswordValidity()
        {
            this.OldPasswordValid = false;
            if (this.oldPasswordString == null || this.oldPasswordString.Length == 0 || User.LoggedIn == null)
            {
                OldPasswordValid = true;
                return;
            }
            string errorMessage = Checker.CheckOldPasswordMatch(this.oldPasswordString);

            if (errorMessage == null)
            {
                OldPasswordValid = true;
            }

            if (!OldPasswordValid)
            {
                if (Universal.ParentForm.InvokeRequired)
                {
                    Universal.ParentForm.Invoke(new Action(() =>
                    {
                        this.oldPasswordBoxErrorMessage.Text    = errorMessage;
                        this.oldPasswordBoxErrorMessage.Size    = this.oldPasswordBoxErrorMessage.PreferredSize;
                        this.oldPasswordBoxErrorMessage.Left    = this.oldPasswordBox.Right - this.oldPasswordBoxErrorMessage.Width + 5;
                        this.oldPasswordBoxSign.Image           = new Bitmap(FileResources.Icon("redwarning.png"), oldPasswordBoxSign.Size);
                        this.oldPasswordBoxErrorMessage.Visible = true;
                        this.oldPasswordBoxSign.Visible         = true;
                    }));
                }
                else
                {
                    this.oldPasswordBoxErrorMessage.Text    = errorMessage;
                    this.oldPasswordBoxErrorMessage.Size    = this.oldPasswordBoxErrorMessage.PreferredSize;
                    this.oldPasswordBoxErrorMessage.Left    = this.oldPasswordBox.Right - this.oldPasswordBoxErrorMessage.Width + 5;
                    this.oldPasswordBoxSign.Image           = new Bitmap(FileResources.Icon("redwarning.png"), oldPasswordBoxSign.Size);
                    this.oldPasswordBoxErrorMessage.Visible = true;
                    this.oldPasswordBoxSign.Visible         = true;
                }
            }
        }
        private void LogoAndLoginKeyBoxInitialize()
        {
            this.logoLabel = new Label();
            Image  logoImg    = FileResources.Icon("logo_with_name.png");
            double logoHeight = this.Height / 4.0;
            double logoWidth  = logoImg.Width * (logoHeight / logoImg.Height);

            this.logoLabel.Image    = new Bitmap(logoImg, new Size((int)logoWidth, (int)logoHeight));
            this.logoLabel.Size     = this.logoLabel.Image.Size;
            this.logoLabel.Location = new Point((this.Width - this.logoLabel.Width) / 2, 30);
            this.Controls.Add(this.logoLabel);

            this.passwordBox              = new TextBox();
            this.passwordBox.Font         = CustomFonts.BigBold;
            this.passwordBox.PasswordChar = '•';
            this.passwordBox.Size         = new Size(this.Size.Width - (this.Size.Width / 3), passwordBox.PreferredHeight);
            this.passwordBox.Location     = new Point((this.Size.Width - this.passwordBox.Width) / 2, this.Height / 2);
            this.passwordBox.BackColor    = Color.FromArgb(190, 190, 190);
            this.passwordBox.ForeColor    = Color.FromArgb(77, 77, 77);
            this.passwordBox.BorderStyle  = BorderStyle.None;
            this.Controls.Add(passwordBox);
        }
        private void ShowEmptyConversationWarning()
        {
            emptyConversationWarnPanel      = new Panel();
            emptyConversationWarnPanel.Size = this.parent.Size;
            this.Controls.Add(emptyConversationWarnPanel);

            Label emptyIconLabel = new Label();

            emptyIconLabel.Image    = new Bitmap(FileResources.Icon("empty.png"), new Size(this.Width / 2, this.Width / 2));
            emptyIconLabel.Size     = emptyIconLabel.Image.Size;
            emptyIconLabel.Location = new Point((this.parent.Width - emptyIconLabel.Image.Width) / 2, 100);
            emptyConversationWarnPanel.Controls.Add(emptyIconLabel);

            Label emptyTextLabel = new Label();

            emptyTextLabel.Text      = "You have no \r\nconversations yet!";
            emptyTextLabel.Font      = CustomFonts.RegularBold;
            emptyTextLabel.ForeColor = Color.FromArgb(77, 77, 77);
            emptyTextLabel.Size      = emptyTextLabel.PreferredSize;
            emptyTextLabel.TextAlign = ContentAlignment.MiddleCenter;
            emptyTextLabel.Location  = new Point((this.parent.Width - emptyTextLabel.Width) / 2, emptyIconLabel.Bottom + 10);
            emptyConversationWarnPanel.Controls.Add(emptyTextLabel);
        }
        private void SetNameValidity(Object sender, EventArgs e)
        {
            this.NameValid = false;
            if (((TextBox)sender).TextLength > 0)
            {
                string errorMessage = StandardAssuranceLibrary.Checker.CheckNameValidity(((TextBox)sender).Text);
                if (errorMessage == null)
                {
                    NameValid = true;
                }

                if (NameValid)
                {
                    this.nameBoxSign.Image           = new Bitmap(FileResources.Icon("ok.png"), nameBoxSign.Size);
                    this.nameBoxErrorMessage.Visible = false;
                    this.nameBoxSign.Visible         = true;
                }
                else
                {
                    this.nameBoxErrorMessage.Text    = errorMessage;
                    this.nameBoxErrorMessage.Size    = this.nameBoxErrorMessage.PreferredSize;
                    this.nameBoxErrorMessage.Left    = this.nameBox.Right - this.nameBoxErrorMessage.Width + 5;
                    this.nameBoxSign.Image           = new Bitmap(FileResources.Icon("redwarning.png"), nameBoxSign.Size);
                    this.nameBoxErrorMessage.Visible = true;
                    this.nameBoxSign.Visible         = true;
                }
            }
            else
            {
                nameBoxSign.Visible         = false;
                nameBoxErrorMessage.Visible = false;
            }
            if (this.signUpButtonMessage.Visible)
            {
                this.AllSignupConstraintsOk();
            }
        }
        private Button FileButtonsDefine(string buttonName, Size buttonImgSize)
        {
            Button newFileButton = new Button();

            newFileButton.Image     = new Bitmap(FileResources.Icon(buttonName + ".png"), buttonImgSize);
            newFileButton.FlatStyle = FlatStyle.Flat;
            newFileButton.FlatAppearance.MouseOverBackColor = newFileButton.BackColor;
            newFileButton.BackColorChanged         += (s, e) => { newFileButton.FlatAppearance.MouseOverBackColor = newFileButton.BackColor; };
            newFileButton.FlatAppearance.BorderSize = 0;
            newFileButton.TabStop    = false;
            newFileButton.Height     = newFileButton.PreferredSize.Height;
            newFileButton.Width      = newFileButton.Height + newFileButton.Height / 2;
            newFileButton.ImageAlign = ContentAlignment.MiddleCenter;
            filePreviewPanel.Controls.Add(newFileButton);
            newFileButton.MouseEnter += delegate(Object sender, EventArgs e)
            {
                newFileButton.Image = new Bitmap(FileResources.Icon(buttonName + "_rev.png"), newFileButton.Image.Size);
            };
            newFileButton.MouseLeave += delegate(Object sender, EventArgs e)
            {
                newFileButton.Image = new Bitmap(FileResources.Icon(buttonName + ".png"), newFileButton.Image.Size);
            };
            return(newFileButton);
        }
        private void ConversationTitleBarInitialize()
        {
            this.ThreeLinesOnConversationTitleBar();

            Label conversationIcon = new Label();

            conversationIcon.Image    = FetchConversationIcon();
            conversationIcon.Size     = conversationIcon.Image.Size;
            conversationIcon.Location = new Point(this.conversationTitleBar.Width - (this.conversationTitleBar.Height - conversationIcon.Height) / 2 - conversationIcon.Image.Width, (this.conversationTitleBar.Height - conversationIcon.Height) / 2);
            this.conversationTitleBar.Controls.Add(conversationIcon);

            conversationNameLabel           = new Label();
            conversationNameLabel.Text      = FetchConversationName();
            conversationNameLabel.Font      = CustomFonts.RegularBold;
            conversationNameLabel.ForeColor = Color.FromArgb(240, 240, 240);
            conversationNameLabel.Size      = conversationNameLabel.PreferredSize;
            conversationNameLabel.Location  = new Point(conversationIcon.Left - conversationNameLabel.Width - 5, this.conversationTitleBar.Height / 6);
            this.conversationTitleBar.Controls.Add(conversationNameLabel);

            currentStatusLabel           = new Label();
            currentStatusLabel.Visible   = false;
            currentStatusLabel.Font      = CustomFonts.SmallerBold;
            currentStatusLabel.ForeColor = Color.FromArgb(240, 240, 240);
            currentStatusLabel.Size      = currentStatusLabel.PreferredSize;
            currentStatusLabel.Location  = new Point(conversationNameLabel.Right - currentStatusLabel.PreferredWidth - 5, this.conversationTitleBar.Height - currentStatusLabel.PreferredHeight - this.conversationTitleBar.Height / 6);
            this.conversationTitleBar.Controls.Add(currentStatusLabel);

            currentStatusIcon          = new Label();
            currentStatusIcon.Visible  = false;
            currentStatusIcon.Image    = new Bitmap(FileResources.Icon("greenDot.png"), new Size(10, 10));
            currentStatusIcon.Size     = new Size(10, 10);
            currentStatusIcon.Location = new Point(currentStatusLabel.Left - 13, currentStatusLabel.Bottom - this.conversationTitleBar.Height / 6 - 1);
            this.conversationTitleBar.Controls.Add(currentStatusIcon);

            this.Controls.Add(conversationTitleBar);
        }
Ejemplo n.º 23
0
        private void ShowSearchBar()
        {
            this.searchBox              = new TextBox();
            this.searchBox.Font         = CustomFonts.Small;
            this.searchBox.BorderStyle  = System.Windows.Forms.BorderStyle.None;
            this.searchBox.Height       = this.searchBox.PreferredHeight;
            this.searchBox.Text         = "Search Users";
            this.searchBox.ForeColor    = Color.FromArgb(150, 150, 150);
            this.searchBox.Font         = CustomFonts.New(CustomFonts.SmallSize, 'I');
            this.searchBox.Top          = this.backButtonLabel.Bottom + 5;
            this.searchBox.GotFocus    += new EventHandler(OnGotFocus);
            this.searchBox.LostFocus   += new EventHandler(OnLostFocus);
            this.searchBox.TextChanged += new EventHandler(OnTextChanged);
            this.Controls.Add(this.searchBox);

            this.searchIcon           = new Label();
            this.searchIcon.Image     = new Bitmap(FileResources.Icon("searchIcon.png"), new Size(this.searchBox.Height * 3 / 4, this.searchBox.Height * 3 / 4));
            this.searchIcon.Size      = new Size(this.searchBox.Height, this.searchBox.Height);
            this.searchIcon.BackColor = Color.White;
            this.searchIcon.Location  = new Point(3, this.searchBox.Top + (this.searchBox.Height - this.searchIcon.Height) / 2);
            this.searchBox.Left       = searchIcon.Right;
            this.searchBox.Width      = this.parent.Width - this.searchIcon.Width - this.searchIcon.Left - 8;
            this.Controls.Add(searchIcon);
        }
Ejemplo n.º 24
0
        private void SetNewPasswordValidity(Object sender, EventArgs e)
        {
            this.NewPasswordValid = false;
            TextBox newKeyBox = (TextBox)sender;

            if (newKeyBox.TextLength > 0)
            {
                string input    = ((TextBox)sender).Text;
                int    strength = Checker.DeterminePasswordStrength(input);
                string message;
                if (strength == -1)
                {
                    message = "contains invalid characters"; this.newPasswordBoxMessage.ForeColor = Colors.ErrorTextColor;
                }
                if (strength == -2)
                {
                    message = "maximum 25 characters allowed"; this.newPasswordBoxMessage.ForeColor = Colors.ErrorTextColor;
                }
                else if (strength <= 2)
                {
                    message = "Too weak!\r\ntry combination of\r\nlower, upper-case, numeric, special characters"; this.newPasswordBoxMessage.ForeColor = Colors.ErrorTextColor;
                }
                else if (strength == 3)
                {
                    message = "Medium"; this.newPasswordBoxMessage.ForeColor = Color.FromArgb(255, 153, 51);
                }
                else if (strength == 4)
                {
                    message = "Strong"; this.newPasswordBoxMessage.ForeColor = Color.FromArgb(0, 132, 0);
                }
                else
                {
                    message = "Very Strong"; this.newPasswordBoxMessage.ForeColor = Color.FromArgb(0, 102, 0);
                }
                if (strength >= 3)
                {
                    this.NewPasswordValid = true;
                }
                this.newPasswordBoxSign.Visible      = true;
                this.newPasswordBoxMessage.Visible   = true;
                this.newPasswordBoxMessage.Text      = message;
                this.newPasswordBoxMessage.TextAlign = ContentAlignment.MiddleRight;
                this.newPasswordBoxMessage.Size      = this.newPasswordBoxMessage.PreferredSize;
                this.newPasswordBoxMessage.Left      = this.newPasswordBox.Right - this.newPasswordBoxMessage.Width + 5;
                if (NewPasswordValid)
                {
                    this.newPassword = newKeyBox.Text;
                    this.newPasswordBoxSign.Image = new Bitmap(FileResources.Icon("ok.png"), newPasswordBoxSign.Size);
                }
                else
                {
                    this.newPassword = null;
                    this.newPasswordBoxSign.Image = new Bitmap(FileResources.Icon("redwarning.png"), newPasswordBoxSign.Size);
                }
            }
            else
            {
                this.newPasswordBoxSign.Visible    = false;
                this.newPasswordBoxMessage.Visible = false;
            }
            if (this.passwordSetupButtonMessage.Visible)
            {
                this.AllKeySetupConstraintsOk();
            }
        }
        public static void ShowWaitingAnimation(Point location, Size size, Panel parent)
        {
            waitBarParent     = parent;
            waitBar           = new Panel();
            waitBar.Size      = size;
            waitBar.Location  = location;
            waitBar.BackColor = Color.FromArgb(72, 68, 65);

            Label runningStick = new Label();

            runningStick.Width  = waitBar.Width / 5;
            runningStick.Height = waitBar.Height;
            runningStick.Image  = new Bitmap(FileResources.Icon("loading.png"), runningStick.Size);
            runningStick.Top    = (waitBar.Height - runningStick.Height) / 2;
            runningStick.Left   = 0;
            if (!Universal.ParentForm.InvokeRequired)
            {
                waitBar.Controls.Add(runningStick);
                waitBarParent.Controls.Add(waitBar);
            }
            else
            {
                Universal.ParentForm.Invoke(new Action(() =>
                {
                    waitBar.Controls.Add(runningStick);
                    waitBarParent.Controls.Add(waitBar);
                }));
            }

            timer          = new Timer();
            timer.Interval = 30;
            bool forward = true;

            timer.Tick += delegate(Object sender, EventArgs e)
            {
                if (forward)
                {
                    if (waitBar.Width - runningStick.Right >= 5)
                    {
                        runningStick.Left += 5;
                    }
                    else
                    {
                        runningStick.Left = waitBar.Width - runningStick.Width;
                        forward           = false;
                    }
                }
                else
                {
                    if (runningStick.Left >= 5)
                    {
                        runningStick.Left -= 5;
                    }
                    else
                    {
                        runningStick.Left = 0;
                        forward           = true;
                    }
                }
            };
            showing = true;
            timer.Start();
        }
        private void NuntiasSpaceParentPanelInitialize()
        {
            this.nuntiasSpaceParentPanel          = new Panel();
            this.nuntiasSpaceParentPanel.Width    = this.Width - 8;
            this.nuntiasSpaceParentPanel.Height   = this.Height - (this.conversationTitleBar.Height + this.typingSpaceBar.Height + 8);
            this.nuntiasSpaceParentPanel.Location = new Point(4, this.conversationTitleBar.Bottom + 4);
            this.Controls.Add(this.nuntiasSpaceParentPanel);

            this.nuntiasBossPanel            = new Panel();
            this.nuntiasBossPanel.Size       = this.nuntiasSpaceParentPanel.Size;
            this.nuntiasBossPanel.BackColor  = Color.FromArgb(221, 221, 221);
            this.nuntiasBossPanel.AutoScroll = false;
            this.nuntiasBossPanel.HorizontalScroll.Enabled = false;
            this.nuntiasBossPanel.HorizontalScroll.Visible = false;
            this.nuntiasBossPanel.HorizontalScroll.Maximum = 0;
            this.nuntiasBossPanel.AutoScroll = true;
            this.nuntiasBossPanel.AllowDrop  = true;
            this.SetSizeLocation();
            this.nuntiasBossPanel.Click += new EventHandler(OnClick);

            this.dropPromptLabel            = new Label();
            this.dropPromptLabel.Font       = CustomFonts.New(CustomFonts.SmallerSize, 'i');
            this.dropPromptLabel.BackColor  = Color.FromArgb(255, 253, 221);
            this.dropPromptLabel.ForeColor  = Color.FromArgb(dropPromptLabel.BackColor.R - 100, dropPromptLabel.BackColor.G - 100, dropPromptLabel.BackColor.B - 100);
            this.dropPromptLabel.Text       = "Drop the file to send it to\r\n" + this.receiver.Name + "\r\n\r\n[You will see a preview\r\nof the file before sending.]";
            this.dropPromptLabel.Image      = new Bitmap(FileResources.Icon("dragdrop.png"), new Size(100, 150));
            this.dropPromptLabel.ImageAlign = ContentAlignment.TopCenter;
            this.dropPromptLabel.Size       = this.nuntiasBossPanel.Size;
            this.dropPromptLabel.TextAlign  = ContentAlignment.MiddleCenter;
            this.dropPromptLabel.Visible    = false;
            this.dropPromptLabel.AllowDrop  = true;

            this.somethingBeingTypedLabel.BackColor = this.nuntiasBossPanel.BackColor;

            this.nuntiasSpaceParentPanel.Controls.Add(this.nuntiasBossPanel);
            this.nuntiasSpaceParentPanel.Controls.Add(this.dropPromptLabel);

            this.nuntiasBossPanel.DragEnter += (s, e) =>
            {
                Console.WriteLine("OnDragEnter nuntiasBossPanel");
                this.nuntiasBossPanel.Visible = false;
                this.dropPromptLabel.Visible  = true;
                e.Effect = DragDropEffects.All;
            };

            this.dropPromptLabel.DragEnter += (s, e) =>
            {
                Console.WriteLine("OnDragEnter dropPromptLabel");
                e.Effect = DragDropEffects.All;
            };

            this.dropPromptLabel.DragLeave += (s, e) =>
            {
                Console.WriteLine("OnDragLeave dropPromptLabel");
                this.dropPromptLabel.Visible  = false;
                this.nuntiasBossPanel.Visible = true;
            };

            this.dropPromptLabel.DragDrop += (s, e) =>
            {
                Console.WriteLine("OnDragDrop dropPromptLabel");
                this.dropPromptLabel.Visible  = false;
                this.nuntiasBossPanel.Visible = true;

                try
                {
                    string filePath = ((string[])e.Data.GetData(DataFormats.FileDrop, false))[0];
                    this.ShowNuntiasContentPreview(Path.GetFileName(filePath), filePath);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error on dropping the file: " + ex.Message);
                }
            };
        }
        private void ShowNuntiasContentPreview(string choosenSafeFileName, string localPath)
        {
            this.nuntiasTextBox.Multiline = false;
            this.nuntiasTextBox.Multiline = true;
            this.nuntiasTextBox.Visible   = false;
            this.sendButton.Visible       = false;

            int    availableTop = 0;
            string extension    = Path.GetExtension(localPath).ToLower();

            if (extension == ".jpg" || extension == ".jpeg" || extension == ".png" || extension == ".gif" || extension == ".bmp")
            {
                int targetHeight = sendButton.Height * 5;
                imgPreview       = new Label();
                imgPreview.Image = GraphicsStudio.ResizeImageByHeight(Image.FromFile(localPath), targetHeight);
                imgPreview.Size  = imgPreview.Image.Size;
                FilePreviewPanelHeight(imgPreview.Height + 40);
                imgPreview.Location = new Point(10, 5);
                availableTop        = 5 + imgPreview.Height;
                this.filePreviewPanel.Controls.Add(imgPreview);
            }
            else
            {
                FilePreviewPanelHeight(40);
            }
            fileNameLabel           = new Label();
            fileNameLabel.Text      = this.ReformatFileNameString(choosenSafeFileName);
            fileNameLabel.Font      = CustomFonts.New(CustomFonts.SmallerSize, 'i');
            fileNameLabel.ForeColor = Color.FromArgb(102, 51, 0);
            fileNameLabel.Size      = fileNameLabel.PreferredSize;
            this.filePreviewPanel.Controls.Add(fileNameLabel);

            Label  attachmentLabel = new Label();
            Image  attachImg = FileResources.Icon("attachment.png");
            double attachHght = attachImg.Size.Height, targetHght = fileNameLabel.Height;

            attachmentLabel.Image    = new Bitmap(attachImg, new Size((int)((targetHght / attachHght) * attachImg.Size.Width), (int)targetHght));
            attachmentLabel.Size     = attachmentLabel.Image.Size;
            attachmentLabel.Location = new Point(10, availableTop + 5);
            fileNameLabel.Location   = new Point(attachmentLabel.Right + 5, availableTop + 5);
            this.filePreviewPanel.Controls.Add(attachmentLabel);

            Size fileButtonSize = new Size(filePreviewPanel.Height * 7 / 10, filePreviewPanel.Height * 7 / 10);

            if (imgPreview != null && imgPreview.Visible)
            {
                fileButtonSize = new Size(filePreviewPanel.Height * 2 / 5, filePreviewPanel.Height * 2 / 5);
            }

            sendFileButton           = FileButtonsDefine("sendfile", fileButtonSize);
            this.parent.AcceptButton = sendFileButton;
            sendFileButton.Location  = new Point(filePreviewPanel.Right - sendFileButton.Width - 30, (filePreviewPanel.Height - sendFileButton.Height) / 2);
            sendFileButton.Click    += (s, e) => { this.SendChoosenFile(choosenSafeFileName, localPath, extension); };

            cancelFileButton          = this.FileButtonsDefine("cancelfile", fileButtonSize);
            this.parent.CancelButton  = cancelFileButton;
            cancelFileButton.Location = new Point(sendFileButton.Left - cancelFileButton.Width, (filePreviewPanel.Height - cancelFileButton.Height) / 2);
            cancelFileButton.Click   += delegate(Object sender, EventArgs e)
            {
                this.FilePreviewPanelHeight(0);
            };
        }
Ejemplo n.º 28
0
        public void SetAddFriendButton(Consumer consumer, Panel singleUserPanel, string friendRequestStatus)
        {
            if (singleUserPanel.Controls.ContainsKey("addFriendLabel"))
            {
                if (singleUserPanel.InvokeRequired)
                {
                    singleUserPanel.Invoke(new Action(() => { singleUserPanel.Controls.RemoveByKey("addFriendLabel"); }));
                }
                else
                {
                    singleUserPanel.Controls.RemoveByKey("addFriendLabel");
                }
            }
            if (singleUserPanel.Controls.ContainsKey("removeFriendlabel"))
            {
                if (singleUserPanel.InvokeRequired)
                {
                    singleUserPanel.Invoke(new Action(() => { singleUserPanel.Controls.RemoveByKey("removeFriendlabel"); }));
                }
                else
                {
                    singleUserPanel.Controls.RemoveByKey("removeFriendlabel");
                }
            }
            Label addButtonLabel = new Label();

            addButtonLabel.Name       = "addFriendLabel";
            addButtonLabel.Image      = new Bitmap(FileResources.Icon("add_friend.png"), new Size(singleUserPanel.Height / 2, singleUserPanel.Height / 2));
            addButtonLabel.Size       = new Size(addButtonLabel.Image.Width + 5, addButtonLabel.Image.Width + 5);
            addButtonLabel.ImageAlign = ContentAlignment.MiddleCenter;
            addButtonLabel.Location   = new Point(singleUserPanel.Right - addButtonLabel.Width - 20, (singleUserPanel.Height - addButtonLabel.Height) / 2);

            if (friendRequestStatus == null || friendRequestStatus.Length == 0)
            {
                addButtonLabel.Image       = new Bitmap(FileResources.Icon("add_friend.png"), addButtonLabel.Image.Size);
                addButtonLabel.MouseEnter += delegate(Object sender, EventArgs me) { addButtonLabel.BackColor = Color.FromArgb(addButtonLabel.BackColor.R - 25, addButtonLabel.BackColor.G - 25, addButtonLabel.BackColor.B - 25); };
                addButtonLabel.MouseLeave += delegate(Object sender, EventArgs me) { addButtonLabel.BackColor = singleUserPanel.BackColor; };
                addButtonLabel.Click      += delegate(Object sender, EventArgs me) { addButtonLabel.Visible = false; this.SendFriendRequestTo(consumer, addButtonLabel, singleUserPanel); };
            }
            else if (friendRequestStatus.Length > 0)
            {
                if (friendRequestStatus == "r_receiver")
                {
                    addButtonLabel.Image       = new Bitmap(FileResources.Icon("add_friend_cancel.png"), addButtonLabel.Image.Size);
                    addButtonLabel.MouseEnter += delegate(Object sender, EventArgs me)
                    {
                        addButtonLabel.Image = new Bitmap(FileResources.Icon("add_friend_cancel.png"), addButtonLabel.Image.Size);
                    };
                    addButtonLabel.MouseLeave += delegate(Object sender, EventArgs me)
                    {
                        addButtonLabel.Image = new Bitmap(FileResources.Icon("add_friend_cancel_rev.png"), addButtonLabel.Image.Size);
                    };
                    addButtonLabel.Click += delegate(Object sender, EventArgs me) { addButtonLabel.Visible = false; this.CancelFriendRequestOf(consumer, addButtonLabel, singleUserPanel); };
                }
                else if (friendRequestStatus == "r_sender")
                {
                    addButtonLabel.Image = new Bitmap(FileResources.Icon("add_friend_accept.png"), addButtonLabel.Image.Size);
                    Label removeFriendLabel = new Label();
                    removeFriendLabel.Name       = "removeFriendlabel";
                    removeFriendLabel.Image      = new Bitmap(FileResources.Icon("add_friend_cancel.png"), addButtonLabel.Image.Size);
                    removeFriendLabel.Size       = new Size(addButtonLabel.Image.Width + 5, addButtonLabel.Image.Width + 5);
                    removeFriendLabel.ImageAlign = ContentAlignment.MiddleCenter;
                    removeFriendLabel.Location   = new Point(addButtonLabel.Left - removeFriendLabel.Width - 5, addButtonLabel.Top);
                    singleUserPanel.Controls.Add(removeFriendLabel);

                    addButtonLabel.Click    += delegate(Object sender, EventArgs me) { addButtonLabel.Visible = false; this.AcceptFriendRequestOf(consumer, addButtonLabel, singleUserPanel); };
                    removeFriendLabel.Click += delegate(Object sender, EventArgs me) { addButtonLabel.Visible = false; removeFriendLabel.Visible = false; this.CancelFriendRequestOf(consumer, addButtonLabel, singleUserPanel); };

                    addButtonLabel.MouseEnter += delegate(Object sender, EventArgs me)
                    {
                        addButtonLabel.Image = new Bitmap(FileResources.Icon("add_friend_accept_rev.png"), addButtonLabel.Image.Size);
                    };
                    addButtonLabel.MouseLeave += delegate(Object sender, EventArgs me)
                    {
                        addButtonLabel.Image = new Bitmap(FileResources.Icon("add_friend_accept.png"), addButtonLabel.Image.Size);
                    };

                    removeFriendLabel.MouseEnter += delegate(Object sender, EventArgs me)
                    {
                        removeFriendLabel.Image = new Bitmap(FileResources.Icon("add_friend_cancel_rev.png"), removeFriendLabel.Image.Size);
                    };
                    removeFriendLabel.MouseLeave += delegate(Object sender, EventArgs me)
                    {
                        removeFriendLabel.Image = new Bitmap(FileResources.Icon("add_friend_cancel.png"), removeFriendLabel.Image.Size);
                    };
                }
                else if (friendRequestStatus == "friend")
                {
                    addButtonLabel.Image = new Bitmap(FileResources.Icon("add_friend_green.png"), addButtonLabel.Image.Size);
                }
            }

            if (singleUserPanel.InvokeRequired)
            {
                singleUserPanel.Invoke(new Action(() => { singleUserPanel.Controls.Add(addButtonLabel); }));
            }
            else
            {
                singleUserPanel.Controls.Add(addButtonLabel);
            }
        }