private void StateLoadedNotifcation(NotificationMessage <StateFileModel> notificationMessage) { if (notificationMessage.Notification != "FileLoaded") { return; } Reset(); FilePath = string.Format("Loaded State: {0}", notificationMessage.Content.FilePath); RaisePropertyChanged("FilePath"); Listing = notificationMessage.Content.Listing; RaisePropertyChanged("Listing"); OutputLog = new MultiThreadedObservableCollection <OutputLog>(notificationMessage.Content.OutputLog); RaisePropertyChanged("OutputLog"); NumberOfCycles = notificationMessage.Content.NumberOfCycles; Proc = notificationMessage.Content.Processor; UpdateMemoryPage(); UpdateUi(); IsProgramLoaded = true; RaisePropertyChanged("IsProgramLoaded"); }
/// <summary> /// Creates a new Instance of the MainViewModel /// </summary> public MainViewModel() { Proc = new Proc(); Proc.Reset(); ResetCommand = new RelayCommand(Reset); StepCommand = new RelayCommand(Step); OpenCommand = new RelayCommand(OpenFile); RunPauseCommand = new RelayCommand(RunPause); UpdateMemoryMapCommand = new RelayCommand(UpdateMemoryPage); SaveStateCommand = new RelayCommand(SaveState); AddBreakPointCommand = new RelayCommand(AddBreakPoint); RemoveBreakPointCommand = new RelayCommand(RemoveBreakPoint); SendNonMaskableInterruptComand = new RelayCommand(SendNonMaskableInterrupt); SendInterruptRequestCommand = new RelayCommand(SendInterruptRequest); Messenger.Default.Register <NotificationMessage <AssemblyFileModel> >(this, FileOpenedNotification); Messenger.Default.Register <NotificationMessage <StateFileModel> >(this, StateLoadedNotifcation); FilePath = "No File Loaded"; MemoryPage = new MultiThreadedObservableCollection <MemoryRowModel>(); OutputLog = new MultiThreadedObservableCollection <OutputLog>(); Breakpoints = new MultiThreadedObservableCollection <Breakpoint>(); UpdateMemoryPage(); _backgroundWorker = new BackgroundWorker { WorkerSupportsCancellation = true, WorkerReportsProgress = false }; _backgroundWorker.DoWork += BackgroundWorkerDoWork; }
private void StateLoadedNotifcation(NotificationMessage<StateFileModel> notificationMessage) { if (notificationMessage.Notification != "FileLoaded") { return; } Reset(); FilePath = string.Format("Loaded State: {0}", notificationMessage.Content.FilePath); RaisePropertyChanged("FilePath"); Listing = notificationMessage.Content.Listing; RaisePropertyChanged("Listing"); OutputLog = new MultiThreadedObservableCollection<OutputLog>(notificationMessage.Content.OutputLog); RaisePropertyChanged("OutputLog"); NumberOfCycles = notificationMessage.Content.NumberOfCycles; Proc = notificationMessage.Content.Processor; UpdateMemoryPage(); UpdateUi(); IsProgramLoaded = true; RaisePropertyChanged("IsProgramLoaded"); }
/// <summary> /// Creates a new Instance of the MainViewModel /// </summary> public MainViewModel() { Proc = new Proc(); Proc.Reset(); ResetCommand = new RelayCommand(Reset); StepCommand = new RelayCommand(Step); OpenCommand = new RelayCommand(OpenFile); RunPauseCommand = new RelayCommand(RunPause); UpdateMemoryMapCommand = new RelayCommand(UpdateMemoryPage); SaveStateCommand = new RelayCommand(SaveState); AddBreakPointCommand = new RelayCommand(AddBreakPoint); RemoveBreakPointCommand = new RelayCommand(RemoveBreakPoint); SendNonMaskableInterruptComand = new RelayCommand(SendNonMaskableInterrupt); SendInterruptRequestCommand = new RelayCommand(SendInterruptRequest); Messenger.Default.Register<NotificationMessage<AssemblyFileModel>>(this, FileOpenedNotification); Messenger.Default.Register<NotificationMessage<StateFileModel>>(this, StateLoadedNotifcation); FilePath = "No File Loaded"; MemoryPage = new MultiThreadedObservableCollection<MemoryRowModel>(); OutputLog = new MultiThreadedObservableCollection<OutputLog>(); Breakpoints = new MultiThreadedObservableCollection<Breakpoint>(); UpdateMemoryPage(); _backgroundWorker = new BackgroundWorker {WorkerSupportsCancellation = true, WorkerReportsProgress = false}; _backgroundWorker.DoWork += BackgroundWorkerDoWork; }