Exemplo n.º 1
0
        public SessionManagerMonkey(IMessenger messenger, UserTaskRepository taskRepository)
        {
            this.messenger = messenger;
            this.taskRepository = taskRepository;

            messenger.Register<CreateUserTaskMessage>(this, HandleUserTaskCreatedMessage);
        }
Exemplo n.º 2
0
 public SessionInitializer(
     BucketRepository bucketRepository,
     UserTaskRepository userTaskRepository)
 {
     this.bucketRepository = bucketRepository;
     this.userTaskRepository = userTaskRepository;
 }
Exemplo n.º 3
0
        protected override async void OnLaunched(LaunchActivatedEventArgs args)
        {
            this.service.StartService();

            if (args.PreviousExecutionState == ApplicationExecutionState.Running)
            {
                Window.Current.Activate();
                return;
            }

            // Create a Frame to act as the navigation context and associate it with a SuspensionManager key
            var rootFrame = new Frame();
            SuspensionManager.RegisterFrame(rootFrame, "AppFrame");

            if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                await SuspensionManager.RestoreAsync();
            }

            await DebuggingCleanup();

            var bucketRepository = new BucketRepository(DatabaseConfiguration.Current);
            var userTaskRepository = new UserTaskRepository(DatabaseConfiguration.Current);
            var session = new SessionInitializer(bucketRepository, userTaskRepository);

            sessionMonkey = new SessionManagerMonkey(Messenger.Default, userTaskRepository);

            await session.Initialize();

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation parameter
                if (!rootFrame.Navigate(typeof(DashboardView)))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Place the frame in the current Window and ensure that it is active
            Window.Current.Content = rootFrame;
            Window.Current.Activate();
        }