public override bool Execute(object parameter = null) { var newProject = new Project() { Name = "Project Name", Weapons = new ObservableCollection <Weapon> { new Weapon() { Name = "Pistol" }, new Weapon() { Name = "Shotgun" } } }; if (FileSystemService.SaveProjectAs(newProject)) { var session = ServiceLocator.Fetch <SessionService>(); session.Project = newProject; return(true); } return(false); }
public override bool Execute(object parameter = null) { var sessionService = ServiceLocator.Fetch <SessionService>(); var project = sessionService.Project; sessionService.IsProjectModified = false; project.LastTimeSaved = DateTime.UtcNow.ToString("yyyy-MM-dd_hh:mm:ss"); return(FileSystemService.SaveProject(project)); }
public override bool Execute(object parameter = null) { var result = FileSystemService.ImportWeapon(); if (result.success) { var session = ServiceLocator.Fetch <SessionService>(); session.CurrentWeapon.Copy(result.weapon); return(true); } return(false); }
public override bool Execute(object parameter = null) { var projectFilePath = parameter as string; var result = FileSystemService.LoadProject(projectFilePath); if (result.success) { var session = ServiceLocator.Fetch <SessionService>(); session.Clear(); session.Project = result.project; session.WireEventHandlers(); return(true); } return(false); }
public override bool Execute(object parameter = null) { var result = FileSystemService.OpenProject(); if (result.success) { //TODO: Reuse LoadProjectCommand inside this here var session = ServiceLocator.Fetch <SessionService>(); session.Clear(); session.Project = result.project; session.WireEventHandlers(); var prefService = ServiceLocator.Fetch <PreferencesService>(); prefService.Preferences.LastProjectName = session.Project.Name; prefService.Preferences.LastProjectPath = session.Project.Path; return(true); } return(false); }
public override bool Execute(object parameter = null) { var project = ServiceLocator.Fetch <SessionService>().Project; return(FileSystemService.SaveProjectAs(project)); }
public override bool Execute(object parameter = null) { var weapon = parameter as Weapon; return(FileSystemService.ExportAsJson(weapon, weapon.Name)); }
public override bool Execute(object parameter = null) { var project = parameter as Project; return(FileSystemService.ExportAsJson(project, project.Name)); }