示例#1
0
        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);
        }
示例#2
0
        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));
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
        public override bool Execute(object parameter = null)
        {
            var project = ServiceLocator.Fetch <SessionService>().Project;

            return(FileSystemService.SaveProjectAs(project));
        }
示例#7
0
        public override bool Execute(object parameter = null)
        {
            var weapon = parameter as Weapon;

            return(FileSystemService.ExportAsJson(weapon, weapon.Name));
        }
示例#8
0
        public override bool Execute(object parameter = null)
        {
            var project = parameter as Project;

            return(FileSystemService.ExportAsJson(project, project.Name));
        }