private void initialize() { filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "BananaSplits", "persistence.xml"); if (!File.Exists(filePath)) { var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal); var templatesConfigSection = config.GetSection("displayTemplates") as DisplayTemplatesConfigurationSection; if (templatesConfigSection != null && templatesConfigSection.DisplayTemplates != null) { DisplayTemplates = new ObservableCollection<DisplayTemplate>(templatesConfigSection.DisplayTemplates.OfType<DisplayTemplate>()); } Save(); } else LoadFromStorage(); if (DisplayTemplates == null) DisplayTemplates = new ObservableCollection<DisplayTemplate>(); if (DisplayTemplates.Count == 0) { var defaultTemplate = new DisplayTemplate(); defaultTemplate.TemplateName = "<Default>"; DisplayTemplates.Add(defaultTemplate); Save(); } }
public DisplayTemplate Clone() { var newDisplayTemplate = new DisplayTemplate(); newDisplayTemplate.TemplateName = TemplateName; newDisplayTemplate.WindowHeight = WindowHeight; newDisplayTemplate.WindowWidth = WindowWidth; newDisplayTemplate.MainFont = new FontDefinition() { Family = MainFont.Family, Size = MainFont.Size }; newDisplayTemplate.HeaderFont = new FontDefinition() { Family = HeaderFont.Family, Size = HeaderFont.Size }; newDisplayTemplate.TimerFont = new FontDefinition() { Family = TimerFont.Family, Size = TimerFont.Size }; newDisplayTemplate.DefaultPanel = new DisplayPanelTemplate() { BorderCornerRadius = DefaultPanel.BorderCornerRadius, BorderThickness = DefaultPanel.BorderThickness, BackgroundColor = DefaultPanel.BackgroundColor, BorderColor = DefaultPanel.BorderColor, TextColor = DefaultPanel.TextColor }; newDisplayTemplate.CurrentSplitPanel = new DisplayPanelTemplate() { BorderCornerRadius = CurrentSplitPanel.BorderCornerRadius, BorderThickness = CurrentSplitPanel.BorderThickness, BackgroundColor = CurrentSplitPanel.BackgroundColor, BorderColor = CurrentSplitPanel.BorderColor, TextColor = CurrentSplitPanel.TextColor }; newDisplayTemplate.HeaderPanel = new DisplayPanelTemplate() { BorderCornerRadius = HeaderPanel.BorderCornerRadius, BorderThickness = HeaderPanel.BorderThickness, BackgroundColor = HeaderPanel.BackgroundColor, BorderColor = HeaderPanel.BorderColor, TextColor = HeaderPanel.TextColor }; newDisplayTemplate.GoldPanel = new DisplayPanelTemplate() { BorderCornerRadius = GoldPanel.BorderCornerRadius, BorderThickness = GoldPanel.BorderThickness, BackgroundColor = GoldPanel.BackgroundColor, BorderColor = GoldPanel.BorderColor, TextColor = GoldPanel.TextColor }; newDisplayTemplate.AheadPanel = new DisplayPanelTemplate() { BorderCornerRadius = AheadPanel.BorderCornerRadius, BorderThickness = AheadPanel.BorderThickness, BackgroundColor = AheadPanel.BackgroundColor, BorderColor = AheadPanel.BorderColor, TextColor = AheadPanel.TextColor }; newDisplayTemplate.BehindPanel = new DisplayPanelTemplate() { BorderCornerRadius = BehindPanel.BorderCornerRadius, BorderThickness = BehindPanel.BorderThickness, BackgroundColor = BehindPanel.BackgroundColor, BorderColor = BehindPanel.BorderColor, TextColor = BehindPanel.TextColor }; newDisplayTemplate.BackgroundColor = BackgroundColor; newDisplayTemplate.TimerColor = TimerColor; return newDisplayTemplate; }
public void Add(DisplayTemplate element) { BaseAdd(element); }
public void Remove(DisplayTemplate element) { BaseRemove(element.TemplateId); }
public DisplayTemplate ConvertToTemplate() { var newDisplayTemplate = new DisplayTemplate(); newDisplayTemplate.TemplateName = "(Copy) " + TemplateName; newDisplayTemplate.WindowHeight = WindowHeight; newDisplayTemplate.WindowWidth = WindowWidth; newDisplayTemplate.MainFont = new FontDefinition() { Family = MainFont.Family, Size = MainFont.Size }; newDisplayTemplate.HeaderFont = new FontDefinition() { Family = HeaderFont.Family, Size = HeaderFont.Size }; newDisplayTemplate.TimerFont = new FontDefinition() { Family = TimerFont.Family, Size = TimerFont.Size }; return newDisplayTemplate; }