示例#1
0
        public DisassemblyViewModel(
            StoryService storyService,
            DebuggerService debuggerService,
            BreakpointService breakpointService,
            // TODO: I haven't found a better way of enforcing this to be filled in time yet
            LabelService labelService,
            RoutineService routineService,
            NavigationService navigationService,
            EditRoutineNameDialogViewModel editRoutineNameDialogViewModel)
            : base("DisassemblyView")
        {
            this.storyService = storyService;

            this.debuggerService = debuggerService;
            this.debuggerService.MachineCreated   += DebuggerService_MachineCreated;
            this.debuggerService.MachineDestroyed += DebuggerService_MachineDestroyed;
            this.debuggerService.StateChanged     += DebuggerService_StateChanged;
            this.debuggerService.Stepped          += DebuggerService_Stepped;

            this.breakpointService          = breakpointService;
            this.breakpointService.Added   += BreakpointService_Added;
            this.breakpointService.Removed += BreakpointService_Removed;

            this.routineService = routineService;
            this.routineService.RoutineNameChanged += RoutineService_RoutineNameChanged;

            this.navigationService = navigationService;
            this.navigationService.NavigationRequested += NavigationService_NavigationRequested;

            this.editRoutineNameDialogViewModel = editRoutineNameDialogViewModel;

            lines                      = new BulkObservableCollection <DisassemblyLineViewModel>();
            addressToLineMap           = new IntegerMap <DisassemblyLineViewModel>();
            routineAddressAndIndexList = new List <AddressAndIndex>();
            stackLines                 = new List <DisassemblyLineViewModel>();

            this.EditNameCommand = RegisterCommand <int>(
                text: "EditName",
                name: "Edit Name",
                executed: EditNameExecuted,
                canExecute: CanEditNameExecute);
        }
示例#2
0
        public CallStackViewModel(
            DebuggerService debuggerService,
            RoutineService routineService,
            NavigationService navigationService)
            : base("CallStackView")
        {
            this.debuggerService = debuggerService;
            this.debuggerService.MachineCreated   += DebuggerService_MachineCreated;
            this.debuggerService.MachineDestroyed += new System.EventHandler <MachineDestroyedEventArgs>(DebuggerService_MachineDestroyed);
            this.debuggerService.StateChanged     += DebuggerService_StateChanged;
            this.debuggerService.Stepped          += DebuggerService_ProcessorStepped;

            this.routineService    = routineService;
            this.navigationService = navigationService;

            this.stackFrames = new BulkObservableCollection <StackFrameViewModel>();

            JumpToDisassemblyCommand = RegisterCommand <uint>(
                text: "Jump To Address",
                name: "JumpToAddress",
                executed: JumpToExecuted,
                canExecute: CanJumpToExecute);
        }
示例#3
0
        public LocalsViewModel(
            StoryService storyService,
            DebuggerService debuggerService,
            VariableViewService variableViewService,
            RoutineService routineService)
            : base("LocalsView")
        {
            this.storyService = storyService;

            this.debuggerService = debuggerService;
            this.debuggerService.MachineCreated   += DebuggerService_MachineCreated;
            this.debuggerService.MachineDestroyed += DebuggerService_MachineDestroyed;
            this.debuggerService.StateChanged     += DebuggerService_StateChanged;
            this.debuggerService.Stepped          += DebuggerService_ProcessorStepped;

            this.variableViewService              = variableViewService;
            variableViewService.LocalViewChanged += VariableViewService_LocalViewChanged;

            this.routineService = routineService;

            this.locals = new IndexedVariableViewModel[15];

            for (int i = 0; i < 15; i++)
            {
                this.locals[i] = new IndexedVariableViewModel(i, 0);
            }

            this.stack         = new VariableViewModel[0];
            this.reversedStack = new VariableViewModel[0];

            SetVariableViewCommand = RegisterCommand <KeyValuePair <VariableViewModel, VariableView> >(
                text: "Set Variable View",
                name: "SetVariableView",
                executed: SetVariableViewExecuted,
                canExecute: CanSetVariableViewExecute);
        }
示例#4
0
 public RoutineController(IRepository <Routine, RoutineViewModel, RoutineIndexViewModel> repo, RoutineService routineService)
 {
     _repo           = repo;
     _routineService = routineService;
 }
示例#5
0
        static void Main(string[] args)
        {
            FileManager         fileManager         = new FileManager();
            InformationProvider informationProvider = new InformationProvider();
            MenuActionService   actionService       = new MenuActionService();
            IService <Exercise> exerciseService     = new ExerciseService();
            IService <Routine>  routineService      = new RoutineService();
            ExerciseManager     exerciseManager     = new ExerciseManager(actionService,
                                                                          exerciseService,
                                                                          informationProvider,
                                                                          fileManager);

            RoutineManager routineManager = new RoutineManager(routineService, informationProvider, fileManager);

            Console.WriteLine("Welcome to Gymate app!");

            exerciseManager.GetAddedExercicesFromFile();
            routineManager.GetAddedRoutineFromFile();

            while (true)
            {
                informationProvider.ShowSingleMessage("Please let me know what you want to do:");

                var mainMenu = actionService.GetMenuActionsByMenuName("Main");

                foreach (var menuAction in mainMenu)
                {
                    informationProvider.ShowSingleMessage($"{menuAction.Id}. {menuAction.Name}");
                }

                var operation = informationProvider.GetInputString();
                Console.WriteLine("\n");

                switch (operation)
                {
                case "1":
                    exerciseManager.AddNewExercise();
                    break;

                case "2":
                    exerciseManager.RemoveExercise();
                    break;

                case "3":
                    exerciseManager.ShowAllExercises();
                    break;

                case "4":
                    exerciseManager.ViewExerciseDetails();
                    break;

                case "5":
                    exerciseManager.ViewExercisesByTypeId();
                    break;

                case "6":
                    var dayOfWeekId = routineManager.GetRoutineId();
                    exerciseManager.ShowAllExercises();

                    var exerciseToAdd = exerciseManager.GetExerciseById();

                    routineManager.AddSelectedExerciseToRoutineDay(dayOfWeekId, exerciseToAdd);
                    break;

                case "7":
                    routineManager.ShowWholeRoutine();
                    break;

                case "8":
                    exerciseManager.UpdateVolumeInExercise();
                    break;

                case "9":
                    exerciseManager.ExportToXml();
                    break;

                case "10":
                    routineManager.ExportToXml();
                    break;

                default:
                    Console.WriteLine("Action you entered does not exist");
                    break;
                }

                Console.WriteLine("\n");
            }
        }
示例#6
0
        protected override void OnExit(ExitEventArgs e)
        {
            RoutineService.RunClosingRoutines();

            base.OnExit(e);
        }