/* FirstRunViewModel.cs * part of zaaReloaded2 * * Copyright 2015-2017 Daniel Kraus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using System.Collections.Generic; using System.Linq; using System.Text; using Bovender.Mvvm; using Bovender.Mvvm.ViewModels; namespace zaaReloaded2.ViewModels { /// /// View model for the first-run wizard /// class FirstRunViewModel : ViewModelBase { #region Static method /// /// If the first-run wizard hasn't been shown to this user /// yet, creates a new instance of FirstRunViewModel, /// injects it into the view T and shows the view. /// /// Window to inject the view model into. public static void InjectIntoIfNeeded() where T: System.Windows.Window, new() { if (UserSettings.Default.FirstRun) { FirstRunViewModel vm = new FirstRunViewModel(); vm.InjectInto().Show(); } } #endregion #region Commands public DelegatingCommand SelectDoctorsModeCommand { get { if (_selectDoctorsModeCommand == null) { _selectDoctorsModeCommand = new DelegatingCommand( param => DoSelectDoctorsMode()); } return _selectDoctorsModeCommand; } } public DelegatingCommand SelectTypistsModeCommand { get { if (_selectTypistsModeCommand == null) { _selectTypistsModeCommand = new DelegatingCommand( param => DoSelectTypistsMode()); } return _selectTypistsModeCommand; } } #endregion #region Constructor /// /// Private constructor to enforce using the static /// private FirstRunViewModel() : base() { } #endregion #region Private methods void DoSelectDoctorsMode() { // Properties will be saved by the DoCloseView override. UserSettings.Default.SuppressItemCommentInteraction = false; CloseViewCommand.Execute(null); } void DoSelectTypistsMode() { // Properties will be saved by the DoCloseView override. UserSettings.Default.SuppressItemCommentInteraction = true; CloseViewCommand.Execute(null); } #endregion #region Implementation of ViewModelBase public override object RevealModelObject() { throw new NotImplementedException(); } #endregion #region Fields DelegatingCommand _selectDoctorsModeCommand; DelegatingCommand _selectTypistsModeCommand; #endregion } }