public FileExecutionTabPage(DisassembledFileViewModel viewModel) : this() { m_PrimarySrcGridRowColor = m_SrcGrid.DefaultCellStyle.BackColor; m_AlternateSrcGridRowColor = m_SrcGrid.AlternatingRowsDefaultCellStyle.BackColor; m_ShowDecValuesItem.Click += OnShowDecimalValuesToolbarItemClick; m_ShowHexValuesItem.Click += OnShowHexValuesToolbarItemClick; m_ShowDataElemsAsDecimalBtn.Click += OnShowDataElemsAsDecimalToolbarItemClick; m_ShowDataElemsAsHexBtn.Click += OnShowDataElemsAsHexToolbarItemClick; m_FileViewModel = viewModel; m_ExConsole = new AssemblerExecutionConsole(m_ConsoleTxt.InputStream, m_ConsoleTxt.OutputStream); m_ExViewModel = new ExecutionViewModel(m_ExConsole, viewModel, viewModel.InstructionList); var usrRegBindingAdapter = new BindingList <RegisterViewModel>(m_ExViewModel.Registers); m_UsrRegisterData.AutoGenerateColumns = false; m_UsrRegisterData.DataSource = usrRegBindingAdapter; var fpRegBindingAdapter = new BindingList <FloatingPointRegisterViewModel>(m_ExViewModel.FloatingPointRegisters); m_FpRegisterData.AutoGenerateColumns = false; m_FpRegisterData.DataSource = fpRegBindingAdapter; m_DataSegmentGrdView.AutoGenerateColumns = false; m_DataSegmentGrdView.DataSource = m_ExViewModel.DataElements; usrRegisterBindingSource.DataSource = usrRegBindingAdapter; fpRegBindingSource.DataSource = fpRegBindingAdapter; jefFileViewModelBindingSource.DataSource = m_FileViewModel; m_ExViewModel.PropertyChanged += OnExecutionViewModelChanged; // just bind the "isEnabled" property here since we have an event handler // here to clear the console, then execute the underlying view model command. // we can't convert this to a simple binding statement like the other buttons have // because of this. BindingHelper.BindPredicateToEnabledProperty(m_StartBtn, m_ExViewModel.ExecuteFileUntilEndCommand); m_TerminateBtn.BindToCommand(m_ExViewModel.TerminateExecutionCommand); m_PauseBtn.BindToCommand(m_ExViewModel.PauseExecutionCommand); m_ResumeBtn.BindToCommand(m_ExViewModel.ResumeExecutionCommand); m_StepBtn.BindToCommand(m_ExViewModel.StepToNextInstructionCommand); }
private TabPage CreateTabPage(DisassembledFileViewModel file) { var newTabPage = new TabPage(); var tabContent = new FileExecutionTabPage(file) { Dock = DockStyle.Fill }; newTabPage.DataBindings.Add(new Binding(nameof(newTabPage.Text), file, nameof(file.FileName))); newTabPage.Dock = DockStyle.Fill; newTabPage.Controls.Add(tabContent); AreAnyFilesOpened = m_ViewModel.FilesToExecute.Any(); if (AreAnyFilesOpened) { m_NoFileAssembledLbl.Visible = false; m_OpenFilesTabCtrl.Visible = true; } return(newTabPage); }