public LayoutModel UpdateSelectedLayoutModel() { LayoutModel foundModel = null; LayoutSettings currentApplied = App.Overlay.CurrentLayoutSettings; // set new layout if (currentApplied.Type == LayoutType.Custom) { foreach (LayoutModel model in CustomModels) { if (model.Uuid == currentApplied.ZonesetUuid.ToUpperInvariant()) { // found match foundModel = model; break; } } } else { foreach (LayoutModel model in DefaultModels) { if (model.Type == currentApplied.Type) { // found match foundModel = model; foundModel.TemplateZoneCount = currentApplied.ZoneCount; foundModel.SensitivityRadius = currentApplied.SensitivityRadius; if (foundModel is GridLayoutModel grid) { grid.ShowSpacing = currentApplied.ShowSpacing; grid.Spacing = currentApplied.Spacing; } foundModel.InitTemplateZones(); break; } } } if (foundModel == null) { foundModel = DefaultModels[(int)LayoutType.PriorityGrid]; } SetSelectedModel(foundModel); SetAppliedModel(foundModel); FirePropertyChanged(nameof(IsCustomLayoutActive)); return(foundModel); }
public LayoutModel UpdateSelectedLayoutModel() { UpdateTemplateLayoutModels(); ResetAppliedModel(); ResetSelectedModel(); LayoutModel foundModel = null; LayoutSettings currentApplied = App.Overlay.CurrentLayoutSettings; // set new layout if (currentApplied.Type == LayoutType.Blank) { foundModel = BlankModel; } else if (currentApplied.Type == LayoutType.Custom) { foreach (LayoutModel model in MainWindowSettingsModel.CustomModels) { if ("{" + model.Guid.ToString().ToUpperInvariant() + "}" == currentApplied.ZonesetUuid.ToUpperInvariant()) { // found match foundModel = model; break; } } } else { foreach (LayoutModel model in DefaultModels) { if (model.Type == currentApplied.Type) { // found match foundModel = model; break; } } } if (foundModel == null) { foundModel = DefaultModels[4]; // PriorityGrid } foundModel.IsSelected = true; foundModel.IsApplied = true; FirePropertyChanged(nameof(IsCustomLayoutActive)); return(foundModel); }
public void UpdateDesktopDependantProperties(LayoutSettings prevSettings) { UpdateTemplateLayoutModels(); if (prevSettings.ZoneCount != ZoneCount) { FirePropertyChanged(nameof(ZoneCount)); } if (prevSettings.Spacing != Spacing) { FirePropertyChanged(nameof(Spacing)); } if (prevSettings.ShowSpacing != ShowSpacing) { FirePropertyChanged(nameof(ShowSpacing)); } if (prevSettings.SensitivityRadius != SensitivityRadius) { FirePropertyChanged(nameof(SensitivityRadius)); } }