Example #1
0
        public MainPageViewModel(IMainPage view)
        {
            this.view = view;

            var bounds = ApplicationView.GetForCurrentView().VisibleBounds;

            var scaleFactor = 1.0; // DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;

            this.bounds = new Size(bounds.Width * scaleFactor, bounds.Height * scaleFactor);

            SheetViewModel       = new SheetViewModel(this, view);
            TableViewModel       = new TableViewModel(this, view);
            ExplorationViewModel = new ExplorationViewModel(this, view);
            FilterViewModel      = new FilterViewModel(this, view);
            SelectionViewModel   = new SelectionViewModel(this, view);
            Const.Initialize();
        }
Example #2
0
        public void ReflectAll(ViewStatus viewStatus, ReflectReason reason)
        {
            Boolean isN = viewStatus.IsN;

            foreach (ColumnViewModel cvm in SheetViewModel.ColumnViewModels)
            {
                cvm.IsSelected = viewStatus.SelectedColumnViewModels.IndexOf(cvm) >= 0;
            }

            if (reason == ReflectReason.RowFiltered)
            {
                View.SelectionView.ChangeSelecion(null, SelectionChangedType.Clear, false);
                tableViewModel.SelectedRows = null;
            }
            if (reason == ReflectReason.ColumnUnselected && viewStatus.SelectedCount == 0)
            {
                View.SelectionView.ChangeSelecion(null, SelectionChangedType.Clear, false);
            }

            Logger.Instance.Log($"{reason}");

            viewStatus.Generate(SheetViewModel);

            // sheet 업데이트
            SheetViewModel.Reflect(viewStatus);

            // 테이블 업데이트
            TableViewModel.Reflect(viewStatus, reason);

            Boolean updateAllPageViews = reason.UpdateAllPageViews();
            Boolean updateLastPageView = reason.UpdateLastPageView();

            // 차트 업데이트
            if (updateAllPageViews)
            {
                foreach (PageView pageView in ExplorationViewModel.SelectedPageViews)
                {
                    if (pageView.ViewModel.ViewStatus != viewStatus)
                    {
                        pageView.ViewModel.ViewStatus.Generate(sheetViewModel);
                    }

                    pageView.ViewModel.Reflect(reason);
                }

                {
                    PageView topPageView = ExplorationViewModel.TopPageView;
                    if (topPageView.ViewModel.ViewStatus != null)
                    {
                        topPageView.ViewModel.ViewStatus.Generate(sheetViewModel);
                        topPageView.ViewModel.Reflect(reason);
                    }
                }
            }
            else if (updateLastPageView)
            {
                if (ExplorationViewModel.SelectedPageViews.Count > 0)
                {
                    PageView pageView = ExplorationViewModel.SelectedPageViews.Last();
                    if (pageView.ViewModel.ViewStatus != viewStatus)
                    {
                        pageView.ViewModel.ViewStatus.Generate(sheetViewModel);
                    }

                    pageView.ViewModel.Reflect(reason);
                }
            }
        }