Exemplo n.º 1
0
        private void LoadTemplates()
        {
            // Blank out our list
            this.cbClassTemplates.Items.Clear();
            this.cbClassTemplates.SelectedItem = null;

            // Scan the known templates
            foreach (ClassificationTemplateInfo tem in ClassificationTemplateLoader.GetTemplates())
            {
                this.cbClassTemplates.Items.Add(tem);

                // Special code to help determine the correct default templates to use
                if (tem.name.ToLower() == "default")
                {
                    // Always set default to be the default because it is the desired default
                    this.stifleTemplateChangeHandler   = true;
                    this.cbClassTemplates.SelectedItem = tem;
                    this.currentTemplate             = tem;
                    this.stifleTemplateChangeHandler = false;
                }
                // Special code to use the library template as a default
                if (tem.name.ToLower() == "library")
                {
                    // Check if we are still missing a default?
                    if (this.currentTemplate == null)
                    {
                        // Only set the library as default if we haven't already found 'default'
                        this.stifleTemplateChangeHandler   = true;
                        this.cbClassTemplates.SelectedItem = tem;
                        this.currentTemplate             = tem;
                        this.stifleTemplateChangeHandler = false;
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void FillAssetTreeWithTemplate(bool warn)
        {
            ClassificationTemplateInfo template = this.cbClassTemplates.SelectedItem as ClassificationTemplateInfo;

            if (template != null)
            {
                if (warn && Utils.ShowMessageBoxConfirmation("Are you sure you want to change the template?\nIf you proceed, all placed assets will need to be re-added.", "Confirm Template Change") != MOGPromptResult.Yes)
                {
                    this.stifleTemplateChangeHandler   = true;
                    this.cbClassTemplates.SelectedItem = this.currentTemplate;
                    this.stifleTemplateChangeHandler   = false;
                    return;
                }

                this.tvAssets.DeleteAllAssets();
                this.tvAssets.LoadDefaultConfigurationsFromFiles(template.path);
                this.currentTemplate = template;
            }
        }