public MainViewModel(ILastAuth lastAuth) { _lastAuth = lastAuth; GenerateProgressReportCommand = new AsyncDelegateCommand(GenerateProgressReport); OpenReportCommand = new DelegateCommand(OpenProgressReport); ExecuteSelectedCommandCommand = new AsyncDelegateCommand(ExecuteSelectedCommand); var currentDir = AppDomain.CurrentDomain.BaseDirectory; SolutionDir = Path.GetFullPath(currentDir + "../../../../"); // assuming this is running in debug dir BaseCommandTypes = new List <Type> { typeof(DummyGetAsyncCommand <>), typeof(DummyPostAsyncCommand <>) }; LastObjectTypes = Reflektor.FindClassesCastableTo(typeof(ILastfmObject)); LastResponseTypes = Reflektor.FindClassesCastableTo(typeof(LastResponse)); SelectedBaseCommandType = BaseCommandTypes.FirstOrDefault(); SelectedLastObjectType = LastObjectTypes.FirstOrDefault(); SelectedResponseType = LastResponseTypes.FirstOrDefault(); CommandParameters = new ObservableCollection <Pair <string, string> >(new List <Pair <string, string> > { new Pair <string, string>(), new Pair <string, string>(), new Pair <string, string>(), new Pair <string, string>(), new Pair <string, string>() }); CommandMethodName = "album.getInfo"; CommandPageNumber = "0"; CommandItemCount = "20"; }
public MainState LoadState() { MainState state = null; if (File.Exists(_configPath)) { try { var json = File.ReadAllText(_configPath); state = JsonConvert.DeserializeObject <MainState>(json); } catch { state = null; } } if (state == null) { state = new MainState { SelectedBaseCommandType = BaseCommandTypes.FirstOrDefault(), SelectedLastObjectType = LastObjectTypes.FirstOrDefault(), SelectedResponseType = LastResponseTypes.FirstOrDefault(), CommandParameters = new Dictionary <string, string> { { "album", "The Fall of Math" }, { "artist", "65daysofstatic" } }, CommandMethodName = "album.getInfo", CommandPageNumber = "0", CommandItemCount = "20", }; } return(state); }