示例#1
0
        public bool IsValid(bool showMessages)
        {
            if (this.tbProjectName.Text == "")
            {
                if (showMessages)
                {
                    ProjectConfigUtils.ShowMessageBoxExclamation("Please enter a project name", "Missing data");
                    this.tbProjectName.Focus();
                }
                return(false);
            }
            else if (this.tbProjectKey.Text == "")
            {
                if (showMessages)
                {
                    ProjectConfigUtils.ShowMessageBoxExclamation("Please enter a project key", "Missing data");
                    this.tbProjectKey.Focus();
                }
                return(false);
            }
            else if (this.tbProjectPath.Text == "")
            {
                if (showMessages)
                {
                    ProjectConfigUtils.ShowMessageBoxExclamation("Please enter a project path", "Missing data");
                    this.tbProjectPath.Focus();
                }
                return(false);
            }

            return(true);
        }
        // remove a class node
        private void RemoveClassificationNode(classTreeNode node)
        {
            if (node == null || node.TreeView == null)
            {
                return;
            }

            if (ClassTreeContainsAssets(node.FullPath))
            {
                // can't remove it because it's got children
                ProjectConfigUtils.ShowMessageBoxExclamation("This Classification cannot be removed becuase it or its Subclassifications contain Assets.\nThese Assets must be removed before the Classification can be deleted.\nYou can use the 'Generate Report' feature in the MOG Client to remove this Classification's Assets.", "Unable to Remove Classification");
                return;
            }

            // make sure they know what they're doing
            if (ProjectConfigUtils.ShowMessageBoxConfirmation("Are you sure you want to remove this Classification and all its Subclassifications (if any)?", "Confirm Classification Removal") != DialogResult.Yes)
            {
                return;
            }

            if (this.immediateMode)
            {
                // kill it no matter what
                MOG_ControllerProject.GetProject().ClassificationRemove(node.FullPath);
                node.Remove();
                return;
            }


            if (node.IsNewClass)
            {
                // this is a new node, so it hasn't been saved to the DB yet -- so just remove its node and that's that
                node.Remove();
                if (this.newClasses.Contains(node))
                {
                    this.newClasses.Remove(node);
                }
            }
            else
            {
                // add it to the remove list so we'll remove it from the databse/INIs
                node.props.Classification = node.FullPath;
                this.removedClasses.Add(node);
                node.Remove();
            }
        }
        private bool ConfigsValid(bool showDialogs, bool refocus)
        {
            if (!this.platformEditor.ConfigurationValid())
            {
                if (showDialogs)
                {
                    ProjectConfigUtils.ShowMessageBoxExclamation("You must have at least one platform for the project configuration to be valid", "No Platforms");
                }
                if (refocus)
                {
                    this.tabControl.SelectedTab = this.tpPlatforms;
                }

                return(false);
            }

            return(true);
        }
        private void tvClassifications_AfterLabelEdit(object sender, System.Windows.Forms.NodeLabelEditEventArgs e)
        {
            TreeNodeCollection nodes = this.tvClassifications.Nodes;

            if (e.Node.Parent != null)
            {
                nodes = e.Node.Parent.Nodes;
            }

            if (e.Label == "" || ProjectConfigUtils.NodesCollectionContainsSubNode(nodes, e.Label))
            {
                ProjectConfigUtils.ShowMessageBoxExclamation("Invalid Classification Name", "Alert");
                e.CancelEdit = true;
            }

            if (this.immediateMode)
            {
                string className = e.Node.FullPath.Substring(0, e.Node.FullPath.LastIndexOf("~")) + "~" + e.Label;
                if (e.Label == null)
                {
                    className = e.Node.FullPath;
                }

                if (MOG_ControllerProject.GetProject().ClassificationAdd(className))
                {
                    ((classTreeNode)e.Node).props = MOG_ControllerProject.GetClassificationProperties(className);
                    ((classTreeNode)e.Node).props.SetImmeadiateMode(true);
                }
                else
                {
                    e.CancelEdit = true;
                }
            }

            this.tvClassifications.LabelEdit = false;
        }