Ejemplo n.º 1
0
        public void Initialize(GridViewSelectionManager taskListSelectionManager)
        {
            if (taskListSelectionManager == null)
            {
                throw new ArgumentNullException(nameof(taskListSelectionManager));
            }

            this.selectionManager = taskListSelectionManager;
        }
Ejemplo n.º 2
0
        public MainPage()
        {
            this.InitializeComponent();

            this.workbook          = Ioc.Resolve <IWorkbook>();
            this.navigationService = Ioc.Resolve <INavigationService>();
            this.messageBoxService = Ioc.Resolve <IMessageBoxService>();
            this.trackingManager   = Ioc.Resolve <ITrackingManager>();
            this.tileManager       = Ioc.Resolve <ITileManager>();
            this.platformService   = Ioc.Resolve <IPlatformService>();

            // setup cache mode so that this page is cached accross navigation
            this.NavigationCacheMode = NavigationCacheMode.Required;

            this.viewModel = Ioc.Build <MainPageViewModel>();
            this.viewModel.PropertyChanged += this.OnViewModelPropertyChanged;
            Ioc.RegisterInstance <IMainPageViewModel, MainPageViewModel>(this.viewModel);

            this.navigationMenuManager    = Ioc.Build <NavigationMenuManager>();
            this.taskListSelectionManager = new GridViewSelectionManager(this.workbook, this.viewModel, this.GridViewTasks);
            this.dragDropManager          = new DragDropManager(this, this.GridViewTasks, this.ListViewNavigation, this.workbook, this.navigationService, this.trackingManager);

            this.lastSplitViewOpen = !this.workbook.Settings.GetValue <bool>(CoreSettings.NavigationMenuMinimized);

            this.Loaded      += this.OnLoaded;
            this.SizeChanged += this.OnSizeChanged;

            this.DataContext = this.viewModel;

            this.HeaderBarAutoSuggestBox.QuerySubmitted += (s, e) =>
            {
                this.HeaderBarAutoSuggestBox.Focus(FocusState.Programmatic);
            };
            this.HeaderBarAutoSuggestBox.GotFocus += (s, e) =>
            {
                this.PanelHeaderContent.Visibility = Visibility.Collapsed;
                this.HeaderBarAutoSuggestBoxBorderMask.Visibility = Visibility.Collapsed;
            };
            this.HeaderBarAutoSuggestBox.LostFocus += (s, e) =>
            {
                if (string.IsNullOrWhiteSpace(this.ViewModel.SearchText))
                {
                    this.PanelHeaderContent.Visibility = Visibility.Visible;
                    this.HeaderBarAutoSuggestBoxBorderMask.Visibility = Visibility.Visible;
                }
            };

            // when user types text in the search box, update the view model
            var synchronizationContext = SynchronizationContext.Current;

            Observable
            .FromEventPattern <AutoSuggestBoxTextChangedEventArgs>(this.NavBarAutoSuggestBox, "TextChanged")
            .Throttle(TimeSpan.FromMilliseconds(250))
            .ObserveOn(synchronizationContext)
            .Subscribe(e => this.viewModel.SearchText = this.NavBarAutoSuggestBox.Text);
            Observable
            .FromEventPattern <AutoSuggestBoxTextChangedEventArgs>(this.HeaderBarAutoSuggestBox, "TextChanged")
            .Throttle(TimeSpan.FromMilliseconds(250))
            .ObserveOn(synchronizationContext)
            .Subscribe(e => this.viewModel.SearchText = this.HeaderBarAutoSuggestBox.Text);

            DataTransferManager.GetForCurrentView().DataRequested += this.OnDataRequested;

            this.SplitView.RegisterPropertyChangedCallback(SwipeableSplitView.IsSwipeablePaneOpenProperty, this.OnSplitViewIsOpenChanged);

            this.ContextualActionBar.Visibility = Visibility.Collapsed;
            this.ContextualActionBar.Initialize(this.SelectionManager);

            this.ListViewTasks.Tapped += (s, e) =>
            {
                this.navigationService.CloseFlyouts();
            };
        }