// Constructor public SystemTests(AppSimulationDatabaseFixture fixture) { this.db = fixture.Db; this.dbMeta = fixture; this.systemTime = fixture.SystemTime; this.tasks = fixture.Tasks; this.timer = fixture.Timer; this.dbMeta.PopulateTasks("Tasks"); }
// Event Handlers - Activations protected override void OnLaunched(LaunchActivatedEventArgs e) // Occurrence // - when user launches app (ie. tile selection) // - during prelaunch, when system launches app // Assumptions // - prelaunch is disabled by default (post v1607) // - when enabled, may be prelaunch or may have already prelaunched // - app may not immediately be visible (eg. prelaunch) // - previous state unknown (eg. user terminated, system terminated, crashed/hasn't-run, suspended, running) // - app will feel unresponsive if execution exceeds a few seconds // Actions // - initial app resources and state // - register event handlers // - configure and set initial page (on user launch) // - display splash screen (on user launch) // - (utilize custom SplashScreen if initialization requires more time) { if (App.State == null) { var systemTime = new SystemTimeDev(DateTimeOffset.UtcNow, TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time")); var taskAide = new TaskAide(new Database("Filename=TaskAide.db"), systemTime, new TimerDev(systemTime)); systemTime.Rewound += taskAide.OnSystemRewound; var appEvents = new AppEvents(); appEvents.TaskAdded += (s, args) => taskAide.AddTask(args.Name); appEvents.TaskNameChanged += (s, args) => taskAide.RenameTask(args.Task, args.NewName); appEvents.TaskRemoved += (s, args) => taskAide.RemoveTask(args.Task); appEvents.UserChangedInterval += (s, args) => taskAide.UserChangedInterval(args.Interval, args.StartDelta, args.SpanDelta); appEvents.UserSwitchedTasks += (s, args) => taskAide.SwitchTasks(args.Task); if ((e.PreviousExecutionState == ApplicationExecutionState.ClosedByUser) || (e.PreviousExecutionState == ApplicationExecutionState.Terminated)) { // restore previous user session state } App.Events = appEvents; App.Settings = new AppSettings(); App.State = taskAide; } if (!e.PrelaunchActivated) { if (Window.Current.Content == null) { Window.Current.Content = new AppNavigation(); } Window.Current.Activate(); } }
// Constructor public TaskPersistenceTests(EmptyDatabaseFixture fixture) { this.db = fixture.Db; this.systemTime = fixture.SystemTime; this.timer = fixture.Timer; }