private void Wrapper_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e) { if (e.PointerDeviceType != PointerDeviceType.Touch) { return; } if (ViewModel.IsEmpty) { } else if (ViewModel.IsNoPossibleVisualizationWarningVisible) { } else if (ViewModel.IsUndoing) { Double delta = e.Cumulative.Translation.Y; if (delta < -Const.PageViewToggleThreshold) // 많이 올라간 경우 { ViewModel.State = PageViewModel.PageViewState.Selected; // undo하는 경우는 조건 체크할 필요 없이 무조건 select해도 됨 ViewModel.StateChanged(this); } else { MoveToDefaultPositionStoryboard.Begin(); ViewModel.IsPrimaryUndoMessageVisible = true; } } else if (ViewModel.IsSelected) // 선택 된 경우 내릴수만 있음 { Double delta = e.Cumulative.Translation.Y; if (delta > Const.PageViewToggleThreshold) // 많이 내려간 경우 { ViewModel.State = PageViewModel.PageViewState.Undoing; ViewModel.StateChanged(this); } else { MoveToSelectedPositionStoryboard.Begin(); SelectedStateStoryboard.Begin(); } } else // 선택되지 않은 경우 올릴수만 있음 { Double delta = e.Cumulative.Translation.Y; if (delta < -Const.PageViewToggleThreshold) // 많이 올라간 경우 { if (this != ViewModel.MainPageViewModel.ExplorationViewModel.TopPageView) { return; // 이게 맨 위에있는게 아니면 reject } if (!ViewModel.IsPreviewing) { return; // 아무것도 프리뷰잉하고 있지 않으면 reject } if (ViewModel.MainPageViewModel.ExplorationViewModel.ViewStatus.SelectedColumnViewModels.IndexOf( ViewModel.ViewStatus.SelectedColumnViewModels.Last() ) >= 0) { return; // 선택된 컬럼이 이미 선택되어잇으면 } ViewModel.State = PageViewModel.PageViewState.Selected; ViewModel.StateChanged(this); } else { MoveToDefaultPositionStoryboard.Begin(); SelectedStateStoryboard.Begin(); } } }
public void ReflectState() { PageViewModel.PageViewState state = ViewModel.State, oldState = ViewModel.OldState; /// /// SelectedStateStoryboard: 차트가 보이도록 애니메이션 /// EmptyStateStoryboard: 차트가 사라지도록 애니메이션 /// EnlargeStoryboard: 차트가 꽉 차서 보이도록 애니메이션 /// DefaultStoryboard: 차트가 줄어들어 보이도록 애니메이션 /// BrightenStoryboard: 차트 바깥 쪽을 흰색으로 /// DarkenStoryboard: 차트 바깥쪽을 회색으로 // 현재 뷰가 위에 있다 if (state == PageViewModel.PageViewState.Selected) { MoveToSelectedPositionStoryboard.Begin(); if (SelectedStateStoryboard.GetCurrentState() != ClockState.Active) { SelectedStateStoryboard.Begin(); } } else if (state == PageViewModel.PageViewState.Undoing) { MoveToDefaultPositionStoryboard.Begin(); UndoStateStoryboard.Begin(); } else if (state == PageViewModel.PageViewState.Empty) { MoveToDefaultPositionStoryboard.Begin(); EmptyStateStoryboard.Begin(); } else if (state == PageViewModel.PageViewState.Previewing) { MoveToDefaultPositionStoryboard.Begin(); if (SelectedStateStoryboard.GetCurrentState() != ClockState.Active) { SelectedStateStoryboard.Begin(); } } switch (state) { case PageViewModel.PageViewState.Selected: BarChartElement.IsHitTestVisible = true; LineChartElement.IsHitTestVisible = true; DistributionViewElement.IsHitTestVisible = true; GroupedBarChartElement.IsHitTestVisible = true; ScatterplotElement.IsHitTestVisible = true; PivotTableView.IsScrollable = true; BarChartTitleElement.IsHitTestVisible = true; GroupedBarChartTitleElement.IsHitTestVisible = true; LineChartTitleElement.IsHitTestVisible = true; DistributionViewTitleElement.IsHitTestVisible = true; DescriptiveStatisticsTitleElement.IsHitTestVisible = true; ScatterplotTitleElement.IsHitTestVisible = true; PivotTableTitleElement.IsHitTestVisible = true; CorrelationStatisticsTitleElement.IsHitTestVisible = true; break; case PageViewModel.PageViewState.Undoing: case PageViewModel.PageViewState.Previewing: case PageViewModel.PageViewState.Empty: ViewModel.IsPrimaryUndoMessageVisible = true; BarChartElement.IsHitTestVisible = false; LineChartElement.IsHitTestVisible = false; DistributionViewElement.IsHitTestVisible = false; GroupedBarChartElement.IsHitTestVisible = false; ScatterplotElement.IsHitTestVisible = false; PivotTableView.IsScrollable = false; BarChartTitleElement.IsHitTestVisible = false; GroupedBarChartTitleElement.IsHitTestVisible = false; LineChartTitleElement.IsHitTestVisible = false; DistributionViewTitleElement.IsHitTestVisible = false; DescriptiveStatisticsTitleElement.IsHitTestVisible = false; ScatterplotTitleElement.IsHitTestVisible = false; PivotTableTitleElement.IsHitTestVisible = false; CorrelationStatisticsTitleElement.IsHitTestVisible = false; break; } }