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 OnMouseLeave(Object sender, EventArgs me)
 {
     if (sender == sidebarSwitchLabel)
     {
         this.sidebarSwitchLabel.Image = new Bitmap(FileResources.Icon("threeLines.png"), this.sidebarSwitchLabel.Image.Size);
     }
 }
        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 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);
        }
 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);
     }
 }
Exemplo n.º 8
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);
 }
Exemplo 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();
        }
        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();
        }
Exemplo n.º 11
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;
         }
     }
 }
Exemplo n.º 12
0
        /// <summary>
        /// 注册文件资源
        /// </summary>
        /// <param name="fileName"></param>
        public void Register(string fileName)
        {
            var map = Load <TResource>(fileName);

            if (map != null && map.Count > 0)
            {
                FileResources.Add(fileName);
                foreach (var pair in map)
                {
                    if (!Resources.ContainsKey(pair.Key))
                    {
                        Resources[pair.Key] = pair.Value;
                    }
                }
            }
        }
Exemplo n.º 13
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]);
        }
Exemplo n.º 14
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();
            }
        }
Exemplo n.º 15
0
        private void LoadResources()
        {
            var tmpFileResources = new HashSet <string>(FileResources);

            FileResources.Clear();
            foreach (var item in tmpFileResources)
            {
                Register(item);
            }

            var tmpAssemblyResources = new HashSet <AssemblyResource>(AssemblyResources);

            AssemblyResources.Clear();
            foreach (var item in tmpAssemblyResources)
            {
                Register(item.BaseResourceName, item.Assembly);
            }
        }
        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);
        }
Exemplo n.º 19
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);
        }
 public ConversationPanel(Form parent, Conversation theConversation)
 {
     this.parent          = parent;
     this.Size            = parent.ClientSize;
     this.theConversation = theConversation;
     if (ConversationPanel.newMessageSound == null)
     {
         ConversationPanel.newMessageSound = FileResources.Audio("when.wav");
     }
     if (CurrentDisplayedConversationPanel != null && CurrentDisplayedConversationPanel.theConversation != null)
     {
         if (this.theConversation.ConversationID == CurrentDisplayedConversationPanel.theConversation.ConversationID)
         {
             return;
         }
     }
     this.Click += new EventHandler(OnClick);
     if (theConversation == null)
     {
         this.ThreeLinesOnConversationTitleBar();
         this.ShowSmilyWelcome();
         this.LoadNewConversation();
         return;
     }
     if (theConversation.Type == "duet" && ((DuetConversation)theConversation).Member1.Id == User.LoggedIn.Id)
     {
         this.receiver = ((DuetConversation)theConversation).Member2;
     }
     else
     {
         this.receiver = ((DuetConversation)theConversation).Member1;
     }
     this.PrimaryStageInitializer();
     this.LoadNewConversation();
     this.UpdateUserActivity(null);
 }
Exemplo n.º 26
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);
        }
Exemplo n.º 27
0
        private void UserViewPanelInitialize()
        {
            this.userViewPanel           = new Panel();
            this.userViewPanel.BackColor = Color.FromArgb(0, 0, 80);
            this.userViewPanel.Width     = this.Width - 4;
            this.userViewPanel.Location  = new Point(2, 2);

            this.AddIconsToUserView();

            userProfilePictureLabel                   = new Label();
            userProfilePictureLabel.Image             = this.ResizedProfileImage;
            userProfilePictureLabel.Location          = new Point((this.userViewPanel.Width - userProfilePictureLabel.Image.Width) / 2, userViewIcons[0].Bottom + 20);
            userProfilePictureLabel.Size              = userProfilePictureLabel.Image.Size;
            userProfilePictureLabel.MouseHover       += delegate(Object sender, EventArgs e) { userProfilePictureLabel.Image = GraphicsStudio.Overlap(userProfilePictureLabel.Image, new Bitmap(FileResources.Picture("pictureChangeHint.png"), userProfilePictureLabel.Image.Size)); };
            userProfilePictureLabel.MouseLeave       += delegate(Object sender, EventArgs e) { userProfilePictureLabel.Image = this.ResizedProfileImage; };
            userProfilePictureLabel.MouseDoubleClick += delegate(Object sender, MouseEventArgs e) { ((SlidebarPanel)this.parent).ChangeProfilePicture(); };
            this.userViewPanel.Controls.Add(userProfilePictureLabel);

            fullnameTextBox           = new TextBox();
            fullnameTextBox.Text      = this.UserProfileName;
            fullnameTextBox.Font      = CustomFonts.SmallBold;
            fullnameTextBox.Height    = fullnameTextBox.PreferredHeight;
            fullnameTextBox.TextAlign = HorizontalAlignment.Center;
            fullnameTextBox.Width     = this.Width * 3 / 4;
            fullnameTextBox.BackColor = Color.FromArgb(userViewPanel.BackColor.R + 50, userViewPanel.BackColor.G + 50, userViewPanel.BackColor.B + 50);
            fullnameTextBox.Location  = new Point((this.userViewPanel.Width - fullnameTextBox.Width) / 2, userProfilePictureLabel.Bottom + 20);
            fullnameTextBox.ForeColor = Color.FromArgb(240, 240, 240);
            this.userViewPanel.Controls.Add(fullnameTextBox);

            dragengerUsernameTextBox             = new TextBox();
            dragengerUsernameTextBox.Text        = "@" + User.LoggedIn.Username;
            dragengerUsernameTextBox.ReadOnly    = true;
            dragengerUsernameTextBox.Font        = CustomFonts.New(13.0f, 'i');
            dragengerUsernameTextBox.Width       = fullnameTextBox.Width;
            dragengerUsernameTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
            dragengerUsernameTextBox.TextAlign   = HorizontalAlignment.Center;
            dragengerUsernameTextBox.BackColor   = Color.FromArgb(userViewPanel.BackColor.R + 20, userViewPanel.BackColor.G + 20, userViewPanel.BackColor.B + 20);
            dragengerUsernameTextBox.Location    = new Point((this.userViewPanel.Width - dragengerUsernameTextBox.Width) / 2, fullnameTextBox.Bottom + 5);
            dragengerUsernameTextBox.ForeColor   = Color.FromArgb(240, 240, 240);
            this.userViewPanel.Controls.Add(dragengerUsernameTextBox);

            this.userViewPanel.Height = this.userViewPanel.PreferredSize.Height + 20;
            this.Controls.Add(this.userViewPanel);
        }
Exemplo 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);
            }
        }
        private void UserViewPanelInitialize()
        {
            this.userViewPanel           = new Panel();
            this.userViewPanel.BackColor = Color.FromArgb(0, 0, 80);
            this.userViewPanel.Width     = this.Width - 4;
            this.userViewPanel.Location  = new Point(2, 2);

            this.AddIconsToUserView();

            userProfilePictureLabel                   = new Label();
            userProfilePictureLabel.Image             = this.ResizedProfileImage;
            userProfilePictureLabel.Location          = new Point((this.userViewPanel.Width - userProfilePictureLabel.Image.Width) / 2, userViewIcons[0].Bottom + 20);
            userProfilePictureLabel.Size              = userProfilePictureLabel.Image.Size;
            userProfilePictureLabel.MouseHover       += delegate(Object sender, EventArgs e) { userProfilePictureLabel.Image = GraphicsStudio.Overlap(userProfilePictureLabel.Image, new Bitmap(FileResources.Picture("pictureChangeHint.png"), userProfilePictureLabel.Image.Size)); };
            userProfilePictureLabel.MouseLeave       += delegate(Object sender, EventArgs e) { userProfilePictureLabel.Image = this.ResizedProfileImage; };
            userProfilePictureLabel.MouseDoubleClick += delegate(Object sender, MouseEventArgs e) { this.ChangeProfilePicture(); };
            this.userViewPanel.Controls.Add(userProfilePictureLabel);

            userFUllNameLabel           = new Label();
            userFUllNameLabel.Text      = this.UserProfileName;
            userFUllNameLabel.Font      = CustomFonts.SmallBold;
            userFUllNameLabel.Size      = userFUllNameLabel.PreferredSize;
            userFUllNameLabel.Location  = new Point((this.userViewPanel.Width - userFUllNameLabel.Width) / 2, userProfilePictureLabel.Bottom + 20);
            userFUllNameLabel.ForeColor = Color.FromArgb(240, 240, 240);
            this.userViewPanel.Controls.Add(userFUllNameLabel);

            Label dragengerEmailLabel = new Label();

            dragengerEmailLabel.Text      = this.FetchDragengerEmail;
            dragengerEmailLabel.Font      = CustomFonts.New(12.0f, 'i');
            dragengerEmailLabel.Size      = dragengerEmailLabel.PreferredSize;
            dragengerEmailLabel.Location  = new Point((this.userViewPanel.Width - dragengerEmailLabel.Width) / 2, userFUllNameLabel.Bottom + 5);
            dragengerEmailLabel.ForeColor = Color.FromArgb(240, 240, 240);
            this.userViewPanel.Controls.Add(dragengerEmailLabel);

            this.userViewPanel.Height = this.userViewPanel.PreferredSize.Height + 20;
            this.mainPanelInSidebar.Controls.Add(this.userViewPanel);
        }
Exemplo n.º 30
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();
            }
        }