/ src / modules / cmdpal / Core / Microsoft.CmdPal.Core.ViewModels / GalleryGridPropertiesViewModel.cs
GalleryGridPropertiesViewModel.cs
 1  // Copyright (c) Microsoft Corporation
 2  // The Microsoft Corporation licenses this file to you under the MIT license.
 3  // See the LICENSE file in the project root for more information.
 4  
 5  using Microsoft.CmdPal.Core.ViewModels.Models;
 6  using Microsoft.CommandPalette.Extensions;
 7  
 8  namespace Microsoft.CmdPal.Core.ViewModels;
 9  
10  public class GalleryGridPropertiesViewModel : IGridPropertiesViewModel
11  {
12      private readonly ExtensionObject<IGalleryGridLayout> _model;
13  
14      public bool ShowTitle { get; private set; }
15  
16      public bool ShowSubtitle { get; private set; }
17  
18      public GalleryGridPropertiesViewModel(IGalleryGridLayout galleryGridLayout)
19      {
20          _model = new(galleryGridLayout);
21      }
22  
23      public void InitializeProperties()
24      {
25          var model = _model.Unsafe;
26          if (model is null)
27          {
28              return; // throw?
29          }
30  
31          ShowTitle = model.ShowTitle;
32          ShowSubtitle = model.ShowSubtitle;
33      }
34  }