private void OnSaveClicked() { if (!HasErrors()) { if (DefaultJobs) { string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"DefaultJson\DefaultJobs.json"); ObservableCollection <Job> jobs = JsonConvert.DeserializeObject <ObservableCollection <Job> >(File.ReadAllText(path)); Galaxy.Jobs = jobs; } if (DefaultEconomy) { string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"DefaultJson\DefaultProducts.json"); ObservableCollection <Product> products = JsonConvert.DeserializeObject <ObservableCollection <Product> >(File.ReadAllText(path)); Galaxy.Products = products; } MainData.CreateMapGalaxy(Galaxy, 20, 20, 75); MainViewModel vm = (App.Current.Resources["Locator"] as ViewModelLocator).Main; vm.Galaxy = Galaxy; vm.MainContainer = new MapEditorViewModel(Galaxy); vm.ClearCurrentFilename(); vm.GalaxyExistPropertyChanged("GalaxyExist"); } }