示例#1
0
        private void SetVisibility(ProjectFolderRole role)
        {
            if (role == ProjectFolderRole.PageLayout)
            {
                this.txtTemplateFormat.IsEnabled = true;
                this.txtSchemaNames.IsEnabled    = false;

                this.txtSchemaNames.Text = null;

                this._TridionRole = TridionRole.PageLayoutContainer;
            }

            if (role == ProjectFolderRole.ComponentLayout)
            {
                this.txtTemplateFormat.IsEnabled = true;
                this.txtSchemaNames.IsEnabled    = true;

                this._TridionRole = TridionRole.ComponentLayoutContainer;
            }

            if (role == ProjectFolderRole.Binary)
            {
                this.txtTemplateFormat.IsEnabled = false;
                this.txtSchemaNames.IsEnabled    = false;

                this.txtTemplateFormat.Text = null;
                this.txtSchemaNames.Text    = null;

                this._TridionRole = TridionRole.MultimediaComponentContainer;
            }

            if (role == ProjectFolderRole.Other)
            {
                this.txtTemplateFormat.IsEnabled = false;
                this.txtSchemaNames.IsEnabled    = false;

                this.txtTemplateFormat.Text = null;
                this.txtSchemaNames.Text    = null;

                this._TridionRole = TridionRole.Other;
            }

            List <TridionFolderInfo> items = this.TridionFolders.Where(x => x.TridionRole == this._TridionRole).ToList();

            this.lstTridionFolders.ItemsSource       = items;
            this.lstTridionFolders.DisplayMemberPath = "NamedPathCut2";
            this.lstTridionFolders.SelectedIndex     = 0;
            this.lstTridionFolders.IsEnabled         = items.Count > 1;
        }
        private void SetVisibility(ProjectFolderRole role)
        {
            if (role == ProjectFolderRole.PageLayout)
            {
                this.txtTemplateFormat.IsEnabled = true;
                this.txtSchemaNames.IsEnabled = false;

                this.txtSchemaNames.Text = null;

                this._TridionRole = TridionRole.PageLayoutContainer;
            }

            if (role == ProjectFolderRole.ComponentLayout)
            {
                this.txtTemplateFormat.IsEnabled = true;
                this.txtSchemaNames.IsEnabled = true;

                this._TridionRole = TridionRole.ComponentLayoutContainer;
            }

            if (role == ProjectFolderRole.Binary)
            {
                this.txtTemplateFormat.IsEnabled = false;
                this.txtSchemaNames.IsEnabled = false;

                this.txtTemplateFormat.Text = null;
                this.txtSchemaNames.Text = null;

                this._TridionRole = TridionRole.MultimediaComponentContainer;
            }

            if (role == ProjectFolderRole.Other)
            {
                this.txtTemplateFormat.IsEnabled = false;
                this.txtSchemaNames.IsEnabled = false;

                this.txtTemplateFormat.Text = null;
                this.txtSchemaNames.Text = null;

                this._TridionRole = TridionRole.Other;
            }

            List<TridionFolderInfo> items = this.TridionFolders.Where(x => x.TridionRole == this._TridionRole).ToList();
            this.lstTridionFolders.ItemsSource = items;
            this.lstTridionFolders.DisplayMemberPath = "NamedPathCut2";
            this.lstTridionFolders.SelectedIndex = 0;
            this.lstTridionFolders.IsEnabled = items.Count > 1;
        }
 private static string GetContainerTcmId(MappingInfo mapping, TridionRole tridionRole, ProjectFileInfo file)
 {
     ProjectFolderInfo folder = file.GetTopFolder();
     return GetContainerTcmId(mapping, tridionRole, folder, file.Path);
 }
 private static string GetContainerTcmId(MappingInfo mapping, TridionRole tridionRole, ProjectFolderInfo folder)
 {
     if(folder == null)
         return String.Empty;
     return GetContainerTcmId(mapping, tridionRole, folder, folder.Path);
 }
 private static string GetContainerTcmId(MappingInfo mapping, TridionRole tridionRole, string path)
 {
     return GetContainerTcmId(mapping, tridionRole, null, path);
 }
        private static string GetContainerTcmId(MappingInfo mapping, TridionRole tridionRole, ProjectFolderInfo folder, string path)
        {
            if (folder != null && !String.IsNullOrEmpty(folder.TcmId))
                return folder.TcmId;

            if (mapping.TridionFolders.Any(x => x.TridionRole == tridionRole))
            {
                if (mapping.TridionFolders.Count(x => x.TridionRole == tridionRole) == 1)
                {
                    string tcm = mapping.TridionFolders.First(x => x.TridionRole == tridionRole).TcmId;
                    if (folder != null)
                        folder.TcmId = tcm;
                    return tcm;
                }

                SelectTridionFolderDialogWindow dialog = new SelectTridionFolderDialogWindow();
                dialog.Path = path;
                dialog.TridionFolders = mapping.TridionFolders.Where(x => x.TridionRole == tridionRole).ToList().FillNamedPath(mapping);
                bool res = dialog.ShowDialog() == true;
                if (res)
                {
                    return dialog.SelectedTridionFolder.TcmId;
                }
            }

            return String.Empty;
        }