AdminDeleteUser() private method

private AdminDeleteUser ( string userName ) : int
userName string
return int
Exemplo n.º 1
0
        private void ActionBox()
        {
            bool enabled = GUI.enabled;

            switch (this.currAction)
            {
            case ASServerAdminWindow.Action.Main:
                if (!this.isConnected)
                {
                    GUI.enabled = false;
                }
                if (this.WordWrappedLabelButton("Want to create a new project?", "Create"))
                {
                    this.nProjectName         = string.Empty;
                    this.nTemplateProjectName = string.Empty;
                    this.currAction           = ASServerAdminWindow.Action.CreateProject;
                }
                if (this.WordWrappedLabelButton("Want to create a new user?", "New User"))
                {
                    this.nPassword1 = this.nPassword2 = string.Empty;
                    this.nFullName  = this.nUserName = this.nEmail = string.Empty;
                    this.currAction = ASServerAdminWindow.Action.CreateUser;
                }
                GUI.enabled = this.isConnected && this.userSelected && enabled;
                if (this.WordWrappedLabelButton("Need to change user password?", "Set Password"))
                {
                    this.nPassword1 = this.nPassword2 = string.Empty;
                    this.currAction = ASServerAdminWindow.Action.SetPassword;
                }
                if (this.WordWrappedLabelButton("Need to change user information?", "Edit"))
                {
                    this.nFullName  = this.users[this.lv2.row].fullName;
                    this.nEmail     = this.users[this.lv2.row].email;
                    this.currAction = ASServerAdminWindow.Action.ModifyUser;
                }
                GUI.enabled = this.isConnected && this.projectSelected && enabled;
                if (this.WordWrappedLabelButton("Duplicate selected project", "Copy Project"))
                {
                    this.nProjectName         = string.Empty;
                    this.nTemplateProjectName = this.databases[this.lv.row].name;
                    this.currAction           = ASServerAdminWindow.Action.CreateProject;
                }
                if (this.WordWrappedLabelButton("Delete selected project", "Delete Project") && EditorUtility.DisplayDialog("Delete project", "Are you sure you want to delete project " + this.databases[this.lv.row].name + "? This operation cannot be undone!", "Delete", "Cancel") && AssetServer.AdminDeleteDB(this.databases[this.lv.row].name) != 0)
                {
                    this.DoRefreshDatabases();
                    GUIUtility.ExitGUI();
                }
                GUI.enabled = this.isConnected && this.userSelected && enabled;
                if (this.WordWrappedLabelButton("Delete selected user", "Delete User") && EditorUtility.DisplayDialog("Delete user", "Are you sure you want to delete user " + this.users[this.lv2.row].userName + "? This operation cannot be undone!", "Delete", "Cancel") && AssetServer.AdminDeleteUser(this.users[this.lv2.row].userName) != 0)
                {
                    if (this.lv.row > -1)
                    {
                        this.DoGetUsers();
                    }
                    GUIUtility.ExitGUI();
                }
                GUI.enabled = enabled;
                break;

            case ASServerAdminWindow.Action.CreateUser:
                this.nFullName = EditorGUILayout.TextField("Full Name:", this.nFullName, new GUILayoutOption[0]);
                this.nEmail    = EditorGUILayout.TextField("Email Address:", this.nEmail, new GUILayoutOption[0]);
                GUILayout.Space(5f);
                this.nUserName = EditorGUILayout.TextField("User Name:", this.nUserName, new GUILayoutOption[0]);
                GUILayout.Space(5f);
                this.nPassword1 = EditorGUILayout.PasswordField("Password:"******"Repeat Password:"******"Create User", ASServerAdminWindow.constants.smallButton, new GUILayoutOption[0]))
                {
                    this.PerformCurrentAction();
                }
                GUI.enabled = enabled;
                if (GUILayout.Button("Cancel", ASServerAdminWindow.constants.smallButton, new GUILayoutOption[0]))
                {
                    this.currAction = ASServerAdminWindow.Action.Main;
                }
                GUILayout.EndHorizontal();
                break;

            case ASServerAdminWindow.Action.SetPassword:
                GUILayout.Label("Setting password for user: "******"Password:"******"Repeat Password:"******"Change Password", ASServerAdminWindow.constants.smallButton, new GUILayoutOption[0]))
                {
                    this.PerformCurrentAction();
                }
                GUI.enabled = enabled;
                if (GUILayout.Button("Cancel", ASServerAdminWindow.constants.smallButton, new GUILayoutOption[0]))
                {
                    this.currAction = ASServerAdminWindow.Action.Main;
                }
                GUILayout.EndHorizontal();
                break;

            case ASServerAdminWindow.Action.CreateProject:
                this.nProjectName = EditorGUILayout.TextField("Project Name:", this.nProjectName, new GUILayoutOption[0]);
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                GUI.enabled = this.CanPerformCurrentAction() && enabled;
                if (GUILayout.Button(!(this.nTemplateProjectName == string.Empty) ? "Copy " + this.nTemplateProjectName : "Create Project", ASServerAdminWindow.constants.smallButton, new GUILayoutOption[0]))
                {
                    this.PerformCurrentAction();
                }
                GUI.enabled = enabled;
                if (GUILayout.Button("Cancel", ASServerAdminWindow.constants.smallButton, new GUILayoutOption[0]))
                {
                    this.currAction = ASServerAdminWindow.Action.Main;
                }
                GUILayout.EndHorizontal();
                break;

            case ASServerAdminWindow.Action.ModifyUser:
                this.nFullName = EditorGUILayout.TextField("Full Name:", this.nFullName, new GUILayoutOption[0]);
                this.nEmail    = EditorGUILayout.TextField("Email Address:", this.nEmail, new GUILayoutOption[0]);
                GUILayout.Space(5f);
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                GUI.enabled = this.CanPerformCurrentAction() && enabled;
                if (GUILayout.Button("Change", ASServerAdminWindow.constants.smallButton, new GUILayoutOption[0]))
                {
                    this.PerformCurrentAction();
                }
                GUI.enabled = enabled;
                if (GUILayout.Button("Cancel", ASServerAdminWindow.constants.smallButton, new GUILayoutOption[0]))
                {
                    this.currAction = ASServerAdminWindow.Action.Main;
                }
                GUILayout.EndHorizontal();
                break;
            }
        }