private static void UpdateProperties(HPatternInstance instance, HPatternSettings settings, Transaction transaction) { WebPanel mTransaction = settings.MasterPages.Transaction; string AMP = SettingsThemeElement.SetObjectThemeValue.True; string ATema = settings.Theme.SetObjectTheme; Theme tTema = null; if (ATema != SettingsThemeElement.SetObjectThemeValue.False) tTema = settings.Theme.Theme; foreach (SettingsThemeMasterPageElement sis in settings.CustomThemeMasterPage) { if (transaction.Name.IndexOf(sis.Name, StringComparison.InvariantCultureIgnoreCase) >= 0) { if (sis.SetMasterPage != SettingsThemeMasterPageElement.SetMasterPageValue.False) { mTransaction = sis.Transaction; AMP = sis.SetMasterPage; } if (sis.SetTheme != SettingsThemeMasterPageElement.SetThemeValue.False) { tTema = sis.Theme; ATema = sis.SetTheme; } break; } } if (transaction.IsPropertyDefault(Properties.TRN.MasterPage) || AMP == SettingsThemeElement.SetObjectThemeValue.Force) { if (mTransaction == null) { transaction.SetPropertyValue(Properties.TRN.MasterPage, new WebPanelReference()); } else { transaction.SetPropertyValue(Properties.TRN.MasterPage, new WebPanelReference(mTransaction)); } } if (tTema != null) { if (transaction.IsPropertyDefault(Properties.TRN.Theme) || ATema == SettingsThemeElement.SetObjectThemeValue.Force) { transaction.SetPropertyValue(Properties.TRN.Theme, new KBObjectReference(tTema)); } } if (instance.Levels.Count > 0 && instance.Levels[0].View != null) { if (instance.Levels[0].View.UseAsSearchViewer) { try { PropertyManager.PropertySpecDescriptor searchViewerProperty = transaction.GetPropertyDescriptor(Properties.TRN.SearchViewer); if (searchViewerProperty.IsApplicable && searchViewerProperty.IsBrowsable && searchViewerProperty.IsDefaultValue) { WebPanel viewObject = WebPanel.Get(transaction.Model, instance.Levels[0].View.ObjectName); if (viewObject != null) transaction.SetPropertyValue(Properties.TRN.SearchViewer, new KBObjectReference(viewObject)); } } catch (Exception e) { LogLicense.LogEmpty(e.Message + e.StackTrace); } } } }