Exemple #1
0
        private void TryToSetupLoginKey()
        {
            string errorMessage = ServerRequest.SetPassword(Universal.SystemMACAddress, this.newPassword);

            if (errorMessage != null)
            {
                VisualizingTools.HideWaitingAnimation();
                MessageBox.Show(errorMessage);
            }
            else
            {
                if (this.InvokeRequired)
                {
                    this.Invoke(new MethodInvoker(delegate
                    {
                        this.parent.Controls.Remove(this);
                        VisualizingTools.HideWaitingAnimation();
                    }));
                }
                else
                {
                    this.parent.Controls.Remove(this);
                    VisualizingTools.HideWaitingAnimation();
                }
                if (!this.passwordIsSet)
                {
                    BackendManager.LoginProcessRun();
                }
                else
                {
                    BackendManager.SetChangedPassword(this.newPassword);
                    if (Universal.ParentForm.InvokeRequired)
                    {
                        Universal.ParentForm.Invoke(new Action(() =>
                        {
                            Universal.ParentForm.Controls.Remove(this);
                            ConversationPanel.CurrentDisplayedConversationPanel.Visible = true;
                            SlidebarPanel.MySidebarPanel.Visible = true;
                            MessageBox.Show(Universal.ParentForm, "Password has been sucessfully changed!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }));
                    }
                    else
                    {
                        Universal.ParentForm.Controls.Remove(this);
                        ConversationPanel.CurrentDisplayedConversationPanel.Visible = true;
                        SlidebarPanel.MySidebarPanel.Visible = true;
                        MessageBox.Show(Universal.ParentForm, "Password has been sucessfully changed!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
        }