コード例 #1
0
        private bool EnablePreviewButton()
        {
            // Fix for U4-862, if there's no template, disable the preview button
            // Fixed again for U4-2587, apparently at some point "no template" changed from -1 to 0? -SJ
            // Now also catches when template doesn't exist any more or is not allowed any more
            // Don't think there's a better way to check if the template exists besides trying to instantiate it..
            try
            {
                var template = new businesslogic.template.Template(_document.Template);
                // If template is found check if it's in the list of allowed templates for this document
                return(_document.Content.ContentType.AllowedTemplates.ToList().Any(t => t.Id == template.Id));
            }
            catch (Exception) { }

            return(false);
        }
コード例 #2
0
 private bool EnablePreviewButton()
 {
     // Fix for U4-862, if there's no template, disable the preview button
     // Fixed again for U4-2587, apparently at some point "no template" changed from -1 to 0? -SJ
     // Now also catches when template doesn't exist any more or is not allowed any more
     // Don't think there's a better way to check if the template exists besides trying to instantiate it..
     try
     {
         var template = new businesslogic.template.Template(_document.Template);
         // If template is found check if it's in the list of allowed templates for this document
         return _document.Content.ContentType.AllowedTemplates.ToList().Any(t => t.Id == template.Id);
     }
     catch (Exception) { }
     
     return false;
 }