@@ -70,50 +70,43 @@ public class SettingsViewModel : ViewModelBase
7070 /// Open tag search command.
7171 /// </summary>
7272 public ICommand OpenTagSearchCommand =>
73- _openTagSearchCommand
74- ?? ( _openTagSearchCommand = new RelayCommand < string > ( OpenTagSearchUrl ) ) ;
73+ _openTagSearchCommand ??= new RelayCommand < string > ( OpenTagSearchUrl ) ;
7574
7675 /// <summary>
7776 /// Download HEX file.
7877 /// </summary>
7978 public ICommand DownloadHexFileCommand =>
80- _downloadHexFileCommand
81- ?? ( _downloadHexFileCommand = new RelayCommand ( DownloadHexFile , LayoutIsCompiled ) ) ;
79+ _downloadHexFileCommand ??= new RelayCommand ( DownloadHexFile , LayoutIsCompiled ) ;
8280
8381 /// <summary>
8482 /// Download Sources ZIP.
8583 /// </summary>
8684 public ICommand DownloadSourcesCommand =>
87- _downloadSourcesCommand
88- ?? ( _downloadSourcesCommand = new RelayCommand ( DownloadSources , LayoutIsCompiled ) ) ;
85+ _downloadSourcesCommand ??= new RelayCommand ( DownloadSources , LayoutIsCompiled ) ;
8986
9087 /// <summary>
9188 /// Cancel settings edition.
9289 /// </summary>
9390 public ICommand CancelSettingsCommand =>
94- _cancelSettingsCommand
95- ?? ( _cancelSettingsCommand = new RelayCommand ( CancelSettings , IsDirty ) ) ;
91+ _cancelSettingsCommand ??= new RelayCommand ( CancelSettings , IsDirty ) ;
9692
9793 /// <summary>
9894 /// Applies the settings.
9995 /// </summary>
10096 public ICommand ApplySettingsCommand =>
101- _applySettingsCommand
102- ?? ( _applySettingsCommand = new RelayCommand ( SaveSettings , IsDirty ) ) ;
97+ _applySettingsCommand ??= new RelayCommand ( SaveSettings , IsDirty ) ;
10398
10499 /// <summary>
105100 /// Update the layout from Ergodox website.
106101 /// </summary>
107102 public ICommand UpdateLayoutCommand =>
108- _updateLayoutCommand
109- ?? ( _updateLayoutCommand = new RelayCommand ( SaveSettings ) ) ;
103+ _updateLayoutCommand ??= new RelayCommand ( SaveSettings ) ;
110104
111105 /// <summary>
112106 /// Closes the settings window.
113107 /// </summary>
114108 public ICommand CloseSettingsCommand =>
115- _closeSettingsCommand
116- ?? ( _closeSettingsCommand = new RelayCommand ( CloseSettingsWindow ) ) ;
109+ _closeSettingsCommand ??= new RelayCommand ( CloseSettingsWindow ) ;
117110
118111 #endregion
119112
@@ -179,13 +172,13 @@ public string LayoutStatus
179172
180173 public ObservableCollection < string > Tags
181174 {
182- get => _tags ?? ( _tags = new ObservableCollection < string > ( ) ) ;
175+ get => _tags ??= new ObservableCollection < string > ( ) ;
183176 private set => Set ( ref _tags , value ) ;
184177 }
185178
186179 public ObservableCollection < string > Layers
187180 {
188- get => _layers ?? ( _layers = new ObservableCollection < string > ( ) ) ;
181+ get => _layers ??= new ObservableCollection < string > ( ) ;
189182 private set => Set ( ref _layers , value ) ;
190183 }
191184
@@ -382,8 +375,8 @@ private void UpdateButtonCanExecute()
382375 {
383376 Logger . TraceMethod ( ) ;
384377
385- ( ( RelayCommand ) ApplySettingsCommand ) . RaiseCanExecuteChanged ( ) ;
386- ( ( RelayCommand ) CancelSettingsCommand ) . RaiseCanExecuteChanged ( ) ;
378+ ( ( RelayCommand ) ApplySettingsCommand ) . RaiseCanExecuteChanged ( ) ;
379+ ( ( RelayCommand ) CancelSettingsCommand ) . RaiseCanExecuteChanged ( ) ;
387380 }
388381
389382 private bool IsDirty ( )
@@ -451,7 +444,7 @@ private void ClearLayoutInfo()
451444 LayoutTitle = "" ;
452445 KeyboardModel = "" ;
453446 LayoutStatus = "" ;
454-
447+
455448 _layoutIsCompiled = false ;
456449 }
457450
@@ -478,27 +471,13 @@ private void UpdateLayoutInfo(ErgodoxLayout layoutInfo)
478471
479472 private string GetKeyBoardDescription ( string keyboardGeometry , string revisionModel )
480473 {
481- string keyboardDescription ;
482-
483- switch ( keyboardGeometry )
474+ string keyboardDescription = keyboardGeometry switch
484475 {
485- case "ergodox-ez" :
486- keyboardDescription = "ErgoDox EZ " ;
487-
488- break ;
489- case "planck-ez" :
490- keyboardDescription = "Planck EZ " ;
491-
492- break ;
493- case "moonlander" :
494- keyboardDescription = "Moonlander " ;
495- break ;
496- default :
497- keyboardDescription = $ "{ keyboardGeometry } ";
498-
499- break ;
500- }
501-
476+ "ergodox-ez" => "ErgoDox EZ " ,
477+ "planck-ez" => "Planck EZ " ,
478+ "moonlander" => "Moonlander " ,
479+ _ => $ "{ keyboardGeometry } ",
480+ } ;
502481 keyboardDescription += char . ToUpper ( revisionModel [ 0 ] ) + revisionModel . Substring ( 1 ) ;
503482
504483 return keyboardDescription ;
@@ -510,8 +489,8 @@ private void UpdateLayoutButtons(Revision revision)
510489
511490 _layoutIsCompiled = Uri . IsWellFormedUriString ( revision . HexUrl , UriKind . Absolute ) && Uri . IsWellFormedUriString ( revision . SourcesUrl , UriKind . Absolute ) ;
512491
513- ( ( RelayCommand ) DownloadHexFileCommand ) . RaiseCanExecuteChanged ( ) ;
514- ( ( RelayCommand ) DownloadSourcesCommand ) . RaiseCanExecuteChanged ( ) ;
492+ ( ( RelayCommand ) DownloadHexFileCommand ) . RaiseCanExecuteChanged ( ) ;
493+ ( ( RelayCommand ) DownloadSourcesCommand ) . RaiseCanExecuteChanged ( ) ;
515494
516495 _hexFileUri = revision . HexUrl ;
517496 _sourcesZipUri = revision . SourcesUrl ;
@@ -568,7 +547,7 @@ private void ExtractLayoutUrlIds(string layoutUrl)
568547 }
569548
570549 Logger . Debug ( $ "Layout URL = { layoutUrl } ") ;
571- Logger . Debug ( $ "Layout URL has { ( match . Success ? "" : "NOT " ) } been matched") ;
550+ Logger . Debug ( $ "Layout URL has { ( match . Success ? "" : "NOT " ) } been matched") ;
572551 Logger . Debug ( $ "Layout Hash ID = { CurrentLayoutHashId } ") ;
573552 Logger . Debug ( $ "Keyboard geometry = { CurrentGeometry } ") ;
574553 Logger . Debug ( $ "Layout Revision ID = { CurrentLayoutRevisionId } ") ;
0 commit comments