Exemple #1
0
        public BackupSettingsPage()
        {
            this.InitializeComponent();
            this.SetRequestedTheme();

            this.DataContext = Ioc.Build <BackupSettingsPageViewModel>();
        }
        public AdvancedSyncSettingsPage()
        {
            this.InitializeComponent();
            this.SetRequestedTheme();

            this.DataContext = Ioc.Build <AdvancedSyncSettingsPageViewModel>();
        }
Exemple #3
0
        public DebugPage()
        {
            this.InitializeComponent();
            this.SetRequestedTheme();

            this.workbook = Ioc.Resolve <IWorkbook>();
            this.synchronizationManager = Ioc.Resolve <ISynchronizationManager>();
            this.persistence            = Ioc.Resolve <IPersistenceLayer>();
            this.messageBoxService      = Ioc.Resolve <IMessageBoxService>();

            this.DataContext = Ioc.Build <DebugPageViewModel>();

            this.Loaded += this.OnLoaded;

            var descriptors = new List <BrushDescriptor>();

            foreach (var key in ApplicationBrushes.GetKeys())
            {
                descriptors.Add(new BrushDescriptor
                {
                    Key   = key,
                    Brush = this.FindResource <SolidColorBrush>(key)
                });
            }

            this.ItemsControlBrushes.ItemsSource = descriptors;
        }
Exemple #4
0
        public MiscSettingsPage()
        {
            this.InitializeComponent();
            this.SetRequestedTheme();

            this.viewModel   = Ioc.Build <MiscSettingsPageViewModel>();
            this.DataContext = this.viewModel;
        }
        public VercorsSettingsPage()
        {
            this.InitializeComponent();
            this.SetRequestedTheme();

            this.viewmodel   = Ioc.Build <VercorsSettingsViewModel>();
            this.DataContext = this.viewmodel;
            this.Loaded     += this.OnLoaded;
        }
        public App(Ioc ioc)
        {
            // The root page of your application
            var container = ioc.Build();

            var nav = new NavigationPage(container.ResolveNamed <ContentPage>("HomeView"));

            MainPage = nav;
        }
Exemple #7
0
        public FolderSettingsPage()
        {
            this.InitializeComponent();
            this.SetRequestedTheme();

            this.ViewModel   = Ioc.Build <FolderSettingsPageViewModel>();
            this.DataContext = this.ViewModel;

            this.listview.Tapped += this.OnListViewTapped;
        }
Exemple #8
0
        public AboutSettingsPage()
        {
            this.InitializeComponent();
            this.SetRequestedTheme();

            this.viewModel   = Ioc.Build <AboutPageViewModel>();
            this.DataContext = this.viewModel;

            this.navigationService = Ioc.Resolve <INavigationService>();
        }
        public EmbeddedQuickAdd()
        {
            this.InitializeComponent();

            this.viewmodel        = Ioc.Build <QuickAddTaskViewModel>();
            this.viewmodel.Saved += (s, e) =>
            {
                this.viewmodel.Title   = null;
                this.viewmodel.DueDate = null;
                // TreeHelper.FindVisualAncestor<MainPage>(this).HideEmbeddedQuickAdd();
            };

            this.DataContext = this.viewmodel;
        }
        public DisplaySettingsPage()
        {
            this.InitializeComponent();
            this.SetRequestedTheme();

            this.viewmodel = Ioc.Build <DisplaySettingsPageViewModel>();
            this.viewmodel.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == "UseDarkTheme" || e.PropertyName == "UseLightTheme")
                {
                    this.UpdateAppTheme();
                }
            };
            this.DataContext = this.viewmodel;
        }
Exemple #11
0
        public override async Task <IWorkbook> ConfigureAsync(Frame rootFrame)
        {
            if (rootFrame == null)
            {
                throw new ArgumentNullException(nameof(rootFrame));
            }

            bool sendAnalytics = WinSettings.Instance.GetValue <bool>(CoreSettings.SendAnalytics);

            string deviceId = "n/a";

            try
            {
                var settings = WinSettings.Instance;
                if (!settings.HasValue(CoreSettings.DeviceId) || settings.GetValue <string>(CoreSettings.DeviceId) == "N/A")
                {
                    string id = this.ComputeDeviceId();
                    settings.SetValue(CoreSettings.DeviceId, id);
                }

                deviceId = settings.GetValue <string>(CoreSettings.DeviceId);
            }
            catch (Exception ex)
            {
                TrackingManagerHelper.Exception(ex, "Error while setting device id");
            }

            var platformService = new PlatformService(this.version, deviceId, () => CrashHandler.GetDiagnosticsInformation());

            Ioc.RegisterInstance <IPlatformService, PlatformService>(platformService);

            TrackingManager trackingManager = new TrackingManager(sendAnalytics, platformService.DeviceFamily);

            Ioc.RegisterInstance <ITrackingManager, TrackingManager>(trackingManager);

            HttpClientHandler.Setup();

            ResourcesLocator.Initialize("ms-appx://", UriKind.Absolute);
            if (!WinSettings.Instance.GetValue <bool>(CoreSettings.UseDarkTheme))
            {
                ResourcesLocator.UpdateTheme(true);
            }

            var persistence = Ioc.RegisterInstance <IPersistenceLayer, WinPersistenceLayer>(new WinPersistenceLayer(automaticSave: true));

            LogService.Log("Bootstraper", string.Format("Version: {0}", ApplicationVersion.GetAppVersion()));

            var navigationService = new NavigationService(rootFrame, platformService);

            Ioc.RegisterInstance <INavigationService, NavigationService>(navigationService);

            var messageBoxService = new MessageBoxService(navigationService);

            Ioc.RegisterInstance <IMessageBoxService, MessageBoxService>(messageBoxService);

            Ioc.RegisterInstance <ISpeechService, SpeechService>(new SpeechService(messageBoxService));

            var workbook = this.InitializeWorkbook(persistence, platformService);

            // we just read the latest value of data from the DB, so even if there was a background sync
            // we now have the latest version, so we remove the background sync flag here
            workbook.Settings.SetValue(CoreSettings.SyncBackgroundOccured, false);

            this.keyboardShortcutManager = new KeyboardShortcutManager(workbook, rootFrame, navigationService, trackingManager);

            var backgroundTaskManager = new BackgroundTaskManager(workbook);

            backgroundTaskManager.InitializeAsync();
            Ioc.RegisterInstance <IBackgroundTaskManager, BackgroundTaskManager>(backgroundTaskManager);

            var notificationService = new NotificationService();

            Ioc.RegisterInstance <INotificationService, NotificationService>(notificationService);

            var startupManager = Ioc.Build <StartupManager>();

            Ioc.RegisterInstance <IStartupManager, StartupManager>(startupManager);

            Ioc.RegisterInstance <IAlarmManager, AlarmManager>(new AlarmManager(workbook));

            var tileManager = new TileManager(workbook, trackingManager, notificationService, false);

            tileManager.LoadSecondaryTilesAsync();
            Ioc.RegisterInstance <ITileManager, TileManager>(tileManager);

            var synchronizationManager = await InitializeSyncAsync(workbook, platformService, trackingManager);

            // it is important to remove old task after sync is initialized otherwise changes would not
            // tracked and put in the changelog for the next sync
            workbook.RemoveOldTasks();

            var cortanaService = new CortanaRuntimeService(workbook);

            // no need to await this call because it can runs in the background
            Task.Run(() =>
            {
                JumpListManager.SetupJumpListAsync();
                cortanaService.SetupDefinitionsAsync();
            });
            Ioc.RegisterInstance <ICortanaRuntimeService, CortanaRuntimeService>(cortanaService);

            return(workbook);
        }
Exemple #12
0
        public TaskPage()
        {
            this.InitializeComponent();

            this.NavigationCacheMode = NavigationCacheMode.Required;

            this.NotesEditor.SkipDisposeOnUnload = true;

            this.BtnAddDueDate.Tapped   += this.OnBtnTapped;
            this.BtnAddStartDate.Tapped += this.OnBtnTapped;
            this.BtnAddReminder.Tapped  += this.OnBtnTapped;
            this.BtnAddFrequency.Tapped += this.OnBtnTapped;
            this.BtnAddProgress.Tapped  += this.OnBtnTapped;
            this.BtnAddTags.Tapped      += this.OnBtnTapped;
            this.BtnAddContext.Tapped   += this.OnBtnTapped;
            this.BtnAddSubtask.Tapped   += this.OnBtnTapped;
            this.BtnFolder.Tapped       += this.OnBtnTapped;
            this.BtnPriority.Tapped     += this.OnBtnTapped;

            this.Loaded += this.OnLoaded;
            this.ItemsControlEntries.SizeChanged += this.OnItemsControlEntriesSizeChanged;

            var navigationService = (NavigationService)Ioc.Resolve <INavigationService>();

            this.createViewModel           = Ioc.Build <CreateTaskViewModel>();
            this.createViewModel.Disposed += (s, e) =>
            {
                // do not dispose if the TaskPage is still shown as a flyout, eg. when user close the extended task notes flyout
                var peekFlyout = navigationService.PeekFlyout();
                if (peekFlyout == null || !(peekFlyout.Content is TaskPage))
                {
                    this.currentViewModel = null;
                }
            };

            this.editViewModel           = Ioc.Build <EditTaskViewModel>();
            this.editViewModel.Disposed += (s, e) =>
            {
                // do not dispose if the TaskPage is still shown as a flyout, eg. when user close the extended task notes flyout
                var peekFlyout = navigationService.PeekFlyout();
                if (peekFlyout == null || !(peekFlyout.Content is TaskPage))
                {
                    this.currentViewModel = null;
                }
            };
            this.editViewModel.NavigateNext     += (s, e) => this.Navigate(forward: true);
            this.editViewModel.NavigatePrevious += (s, e) => this.Navigate(forward: false);

            this.workbook = Ioc.Resolve <IWorkbook>();

            // sync folders
            this.workbook.FolderAdded += (s, e) =>
            {
                if (this.currentViewModel != null)
                {
                    this.currentViewModel.Refresh();
                    this.currentViewModel.TargetFolder = this.workbook.Folders.LastOrDefault();
                }
            };
            this.workbook.FolderRemoved += (s, e) =>
            {
                if (this.currentViewModel != null)
                {
                    this.currentViewModel.Refresh();
                    if (this.currentViewModel.TargetFolder == e.Item)
                    {
                        this.currentViewModel.TargetFolder = this.workbook.Folders.FirstOrDefault();
                    }
                }
            };
            this.workbook.FolderChanged += (s, e) =>
            {
                if (this.currentViewModel != null)
                {
                    this.currentViewModel.Refresh();
                }
            };
            this.workbook.FoldersReordered += (s, e) =>
            {
                if (this.currentViewModel != null)
                {
                    this.currentViewModel.Refresh();
                }
            };

            // sync contexts
            this.workbook.ContextAdded += (s, e) =>
            {
                if (this.currentViewModel != null)
                {
                    this.currentViewModel.Refresh();
                    this.currentViewModel.TargetContext = this.workbook.Contexts.LastOrDefault();
                }
            };
            this.workbook.ContextRemoved += (s, e) =>
            {
                if (this.currentViewModel != null)
                {
                    this.currentViewModel.Refresh();
                    if (this.currentViewModel.TargetContext == e.Item)
                    {
                        this.currentViewModel.TargetContext = this.workbook.Contexts.FirstOrDefault();
                    }
                }
            };
            this.workbook.ContextChanged += (s, e) =>
            {
                if (this.currentViewModel != null)
                {
                    this.currentViewModel.Refresh();
                }
            };
            this.workbook.ContextsReordered += (s, e) =>
            {
                if (this.currentViewModel != null)
                {
                    this.currentViewModel.Refresh();
                }
            };
        }
Exemple #13
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();
            };
        }