void EndTouchRowResizing() { IsWorking = false; IsTouchResizingRows = false; HitTestInformation savedHitTestInformation = GetHitInfo(); if ((savedHitTestInformation.HitPoint.Y == MousePosition.Y) || !_DoTouchResizing) { TooltipHelper.CloseTooltip(); _resizingTracker.Visibility = Visibility.Collapsed; } else { RowLayout viewportResizingRowLayoutFromYForTouch = null; switch (savedHitTestInformation.HitTestType) { case HitTestType.Corner: viewportResizingRowLayoutFromYForTouch = GetColumnHeaderRowLayoutModel().FindRow(savedHitTestInformation.HeaderInfo.ResizingRow); if (viewportResizingRowLayoutFromYForTouch != null) { double num6 = (_resizingTracker.Y1 - viewportResizingRowLayoutFromYForTouch.Y) - viewportResizingRowLayoutFromYForTouch.Height; int row = viewportResizingRowLayoutFromYForTouch.Row; double size = Math.Ceiling(Math.Max((double)0.0, (double)(ActiveSheet.ColumnHeader.Rows[row].ActualHeight + (num6 / ((double)ZoomFactor))))); RowResizeExtent[] rows = new RowResizeExtent[] { new RowResizeExtent(row, row) }; RowResizeUndoAction command = new RowResizeUndoAction(ActiveSheet, rows, size, true); DoCommand(command); } break; case HitTestType.RowHeader: { viewportResizingRowLayoutFromYForTouch = GetViewportResizingRowLayoutFromYForTouch(savedHitTestInformation.RowViewportIndex, savedHitTestInformation.HitPoint.Y); bool flag = false; if ((viewportResizingRowLayoutFromYForTouch == null) && (savedHitTestInformation.RowViewportIndex == 0)) { viewportResizingRowLayoutFromYForTouch = GetViewportResizingRowLayoutFromYForTouch(-1, savedHitTestInformation.HitPoint.Y); } if (((viewportResizingRowLayoutFromYForTouch == null) && (savedHitTestInformation.HeaderInfo != null)) && (savedHitTestInformation.HeaderInfo.ResizingRow >= 0)) { viewportResizingRowLayoutFromYForTouch = GetViewportRowLayoutModel(savedHitTestInformation.RowViewportIndex).FindRow(savedHitTestInformation.HeaderInfo.ResizingRow); } if ((viewportResizingRowLayoutFromYForTouch == null) && ((savedHitTestInformation.RowViewportIndex == -1) || (savedHitTestInformation.RowViewportIndex == 0))) { viewportResizingRowLayoutFromYForTouch = GetColumnHeaderResizingRowLayoutFromYForTouch(savedHitTestInformation.HitPoint.Y); flag = true; } if (viewportResizingRowLayoutFromYForTouch != null) { double num = (_resizingTracker.Y1 - viewportResizingRowLayoutFromYForTouch.Y) - viewportResizingRowLayoutFromYForTouch.Height; int firstRow = viewportResizingRowLayoutFromYForTouch.Row; double num3 = Math.Ceiling(Math.Max((double)0.0, (double)(ActiveSheet.Rows[firstRow].ActualHeight + (num / ((double)ZoomFactor))))); if (flag) { RowResizeExtent[] extentArray2 = new RowResizeExtent[] { new RowResizeExtent(firstRow, firstRow) }; RowResizeUndoAction action2 = new RowResizeUndoAction(ActiveSheet, extentArray2, num3, true); DoCommand(action2); break; } List <RowResizeExtent> list = new List <RowResizeExtent>(); if (ActiveSheet.IsSelected(firstRow, -1)) { foreach (CellRange range in ActiveSheet.Selections) { if (range.Column == -1) { int num4 = (range.Row == -1) ? 0 : range.Row; int num5 = ((range.Row == -1) && (range.RowCount == -1)) ? ActiveSheet.RowCount : range.RowCount; list.Add(new RowResizeExtent(num4, (num4 + num5) - 1)); } } } else { list.Add(new RowResizeExtent(firstRow, firstRow)); } RowResizeExtent[] extentArray = new RowResizeExtent[list.Count]; list.CopyTo(extentArray); RowResizeUndoAction action = new RowResizeUndoAction(ActiveSheet, extentArray, num3, false); DoCommand(action); } break; } } TooltipHelper.CloseTooltip(); _resizingTracker.Visibility = Visibility.Collapsed; _DoTouchResizing = false; } }
void EndTouchColumnResizing() { IsWorking = false; IsTouchResizingColumns = false; HitTestInformation savedHitTestInformation = GetHitInfo(); if ((savedHitTestInformation.HitPoint.X == MousePosition.X) || !_DoTouchResizing) { TooltipHelper.CloseTooltip(); _resizingTracker.Visibility = Visibility.Collapsed; } else { ColumnLayout viewportResizingColumnLayoutFromXForTouch; switch (savedHitTestInformation.HitTestType) { case HitTestType.Corner: viewportResizingColumnLayoutFromXForTouch = GetRowHeaderColumnLayoutModel().FindColumn(savedHitTestInformation.HeaderInfo.ResizingColumn); if (viewportResizingColumnLayoutFromXForTouch != null) { double num6 = (_resizingTracker.X1 - viewportResizingColumnLayoutFromXForTouch.X) - viewportResizingColumnLayoutFromXForTouch.Width; int column = viewportResizingColumnLayoutFromXForTouch.Column; double size = Math.Ceiling(Math.Max((double)0.0, (double)(ActiveSheet.RowHeader.Columns[column].ActualWidth + (num6 / ((double)ZoomFactor))))); ColumnResizeExtent[] columns = new ColumnResizeExtent[] { new ColumnResizeExtent(column, column) }; ColumnResizeUndoAction command = new ColumnResizeUndoAction(ActiveSheet, columns, size, true); DoCommand(command); } break; case HitTestType.ColumnHeader: { viewportResizingColumnLayoutFromXForTouch = GetViewportResizingColumnLayoutFromXForTouch(savedHitTestInformation.ColumnViewportIndex, savedHitTestInformation.HitPoint.X); bool flag = false; if (viewportResizingColumnLayoutFromXForTouch == null) { viewportResizingColumnLayoutFromXForTouch = GetViewportColumnLayoutModel(savedHitTestInformation.ColumnViewportIndex).FindColumn(savedHitTestInformation.HeaderInfo.ResizingColumn); if ((viewportResizingColumnLayoutFromXForTouch == null) && (savedHitTestInformation.ColumnViewportIndex == 0)) { viewportResizingColumnLayoutFromXForTouch = GetViewportResizingColumnLayoutFromXForTouch(-1, savedHitTestInformation.HitPoint.X); } if ((viewportResizingColumnLayoutFromXForTouch == null) && ((savedHitTestInformation.ColumnViewportIndex == 0) || (savedHitTestInformation.ColumnViewportIndex == -1))) { viewportResizingColumnLayoutFromXForTouch = GetRowHeaderResizingColumnLayoutFromXForTouch(savedHitTestInformation.HitPoint.X); flag = true; } } if (viewportResizingColumnLayoutFromXForTouch != null) { double num = (_resizingTracker.X1 - viewportResizingColumnLayoutFromXForTouch.X) - viewportResizingColumnLayoutFromXForTouch.Width; int num2 = viewportResizingColumnLayoutFromXForTouch.Column; double num3 = Math.Ceiling(Math.Max((double)0.0, (double)(ActiveSheet.Columns[num2].ActualWidth + (num / ((double)ZoomFactor))))); if (!flag) { List <ColumnResizeExtent> list = new List <ColumnResizeExtent>(); if (ActiveSheet.IsSelected(-1, num2)) { foreach (CellRange range in ActiveSheet.Selections) { if (range.Row == -1) { int firstColumn = (range.Column == -1) ? 0 : range.Column; int num5 = ((range.Column == -1) && (range.ColumnCount == -1)) ? ActiveSheet.ColumnCount : range.ColumnCount; list.Add(new ColumnResizeExtent(firstColumn, (firstColumn + num5) - 1)); } } } else { list.Add(new ColumnResizeExtent(num2, num2)); } ColumnResizeExtent[] extentArray = new ColumnResizeExtent[list.Count]; list.CopyTo(extentArray); ColumnResizeUndoAction action = new ColumnResizeUndoAction(ActiveSheet, extentArray, num3, false); DoCommand(action); } else { ColumnResizeExtent[] extentArray2 = new ColumnResizeExtent[] { new ColumnResizeExtent(num2, num2) }; ColumnResizeUndoAction action2 = new ColumnResizeUndoAction(ActiveSheet, extentArray2, num3, true); DoCommand(action2); } } break; } } TooltipHelper.CloseTooltip(); _resizingTracker.Visibility = Visibility.Collapsed; _DoTouchResizing = false; } }