private static bool IsInFinally(ICSharpStatement statement) { var block = BlockNavigator.GetByStatement(statement); while (block != null) { if (block.Parent is ITryStatement) { // Looks ugly, but I don't know how to check that the statement in the finally block only! var tryStatement = (ITryStatement)block.Parent; return(tryStatement.FinallyBlock == block); } block = block.Parent as IBlock; } return(false); }
public void NavigateToBlock() { var proc = new Procedure("foo", null); var block = new Block(proc, "foo_block"); var codeSvc = mr.DynamicMock <ICodeViewerService>(); codeSvc.Expect(x => x.DisplayProcedure( Arg <Procedure> .Is.Same(proc))); mr.ReplayAll(); var sc = new ServiceContainer(); sc.AddService <ICodeViewerService>(codeSvc); var nav = new BlockNavigator(block, sc); nav.NavigateTo(); mr.VerifyAll(); }
private async void Profiles_ComboBox_ItemClicked(object sender, ComboBoxItemContainer item) { if (await ConfirmLeave((FrameworkElement)sender) == false) { return; } var ctx = new SaveData.SaveData(); var profile = (SaveData.Models.Profile)item.DataContext; var panelButtons = ctx.PanelButtons.Where(p => p.Profile.Id == profile.Id); var formData = new EditorFormData { Profile = profile, PanelButtons = panelButtons }; LoadProfile(formData); _hasUnsavedChanges = false; Profiles_ComboBox.Close(); BlockNavigator.NavigateBack((FrameworkElement)sender); }
public BlockNavigatorViewModel(Project project, BlocksToDisplay mode, BookBlockIndices startingIndices, ProjectSettingsViewModel settingsViewModel = null) { m_project = project; m_project.QuoteParseCompleted += (s, e) => { m_navigator = new BlockNavigator(m_project.IncludedBooks); ResetFilter(null); }; m_navigator = new BlockNavigator(m_project.IncludedBooks); m_includedBooks = project.IncludedBooks.Select(b => b.BookId); Versification = project.Versification; if (settingsViewModel != null) { m_fontFamily = settingsViewModel.WsModel.CurrentDefaultFontName; m_baseFontSizeInPoints = (int)settingsViewModel.WsModel.CurrentDefaultFontSize; m_rightToLeftScript = settingsViewModel.WsModel.CurrentRightToLeftScript; } else { m_fontFamily = project.FontFamily; m_baseFontSizeInPoints = project.FontSizeInPoints; m_rightToLeftScript = project.RightToLeftScript; } FontSizeUiAdjustment = project.FontSizeUiAdjustment; Mode = mode; if (startingIndices != null && !startingIndices.IsUndefined) { SetBlock(startingIndices); m_currentBlockIndex = m_relevantBlocks.IndexOf(startingIndices); if (m_currentBlockIndex < 0) { m_temporarilyIncludedBlock = startingIndices; } } }
public static IBlock GetTargetBlock(ICSharpStatement currentStatement) { // Looking for the block that is not a part of Try statement ICSharpStatement statement = currentStatement; while (true) { IBlock result = BlockNavigator.GetByStatement(statement); if (result == null) { return(null); } var tryStatement = result.GetContainingNode <ITryStatement>(); if (tryStatement == null) { return(result); } statement = tryStatement; } }
public void NavigateToBlock() { var proc = new Procedure(program.Architecture, "foo", Address.Ptr32(0x00123400), null); var block = new Block(proc, "foo_block"); var codeSvc = mr.DynamicMock <ICodeViewerService>(); codeSvc.Expect(x => x.DisplayProcedure( Arg <Program> .Is.Same(program), Arg <Procedure> .Is.Same(proc), Arg <bool> .Is.Equal(true))); mr.ReplayAll(); var sc = new ServiceContainer(); sc.AddService <ICodeViewerService>(codeSvc); var nav = new BlockNavigator(program, block, sc); nav.NavigateTo(); mr.VerifyAll(); }
public void SetUp() { var blockA = new Block("ip"); var blockB = new Block("p", 1, 1); var blockC = new Block("p", 2, 7); var bookScriptA = new BookScript("LUK", new List <Block> { blockA, blockB, blockC }); var blockD = new Block("ip"); var blockE = new Block("p", 1, 1); var blockF = new Block("p", 5, 7); var blockG = new Block("p", 5, 7); var bookScriptB = new BookScript("ROM", new List <Block> { blockD, blockE, blockF, blockG }); m_books = new List <BookScript> { bookScriptA, bookScriptB }; m_navigator = new BlockNavigator(m_books); }
private void OnButtonB(object sender, GamePadEventArgs args) { Disable(); BlockNavigator.NavigateBack(ButtonsCanvas); }
void HandleProjectQuoteParseCompleted(object sender, EventArgs e) { m_navigator = new BlockNavigator(m_project.IncludedBooks); ResetFilter(null); }