public MainWindow() { InitializeComponent(); KinectController.EnsureKinectConnection(); kinectController = new KinectController(); alarmController = new AlarmController(); kinectController.Setup( rgbImage: rgbImage, stopButton: stopButton, skeletonCanvas: skeletonCanvas, alarmController: alarmController ); alarmController.Setup( initialWindow: initialWindow, inputGrid: inputGrid, hourInput: hourInput, minuteInput: minuteInput, setButton: setButton, unsetButton: unsetButton, stopButton: stopButton, kinectController: kinectController ); }
public void RoutineCanBeAdded_Order_is_correct() { WashingDayDefinition wd = new WashingDayDefinition(); AlarmController ac = new AlarmController(null, null, null); WashingDayEditorController wdc = new WashingDayEditorController(wd, allRoutines, ac); wdc.AddRoutine(allRoutines[5]); wdc.AddRoutine(allRoutines[1]); wdc.AddRoutine(allRoutines[2]); wdc.AddRoutine(allRoutines[4]); wdc.AddRoutine(allRoutines[3]); string sortOrder = ""; foreach (var item in wdc.GetRoutineDefinitions()) { sortOrder += item.Name; } Assert.AreEqual(wdc.GetRoutineDefinitions()[0], allRoutines[5], sortOrder); Assert.AreEqual(wdc.GetRoutineDefinitions()[1], allRoutines[1], sortOrder); Assert.AreEqual(wdc.GetRoutineDefinitions()[2], allRoutines[2], sortOrder); Assert.AreEqual(wdc.GetRoutineDefinitions()[3], allRoutines[4], sortOrder); Assert.AreEqual(wdc.GetRoutineDefinitions()[4], allRoutines[3], sortOrder); }
public void ControllerCanBeLoaded() { WashingDayDefinition wd = new WashingDayDefinition(); AlarmController ac = new AlarmController(null, null, null); new WashingDayEditorController(wd, allRoutines, ac); Assert.Pass(); }
void Awake() { player = GameObject.FindGameObjectWithTag("Player"); alarmController = GameObject.FindGameObjectWithTag("GameController").GetComponent <AlarmController>(); cameraLight = transform.parent.GetComponent <Light>(); AlarmController.onAlarm += onAlarm; }
public void AlarmShownCanBeSet() { var dbMock = new DbMock(); AlarmController ac = new AlarmController(dbMock, dbMock, dbMock); ac.SetAlarmShown("Foo"); Assert.IsTrue(ac.AlarmShown("Foo")); }
public IntroPage(MainSessionController mainSessionController, AlarmController ac) { InitializeComponent(); mMainSessionController = mainSessionController; mAlarmController = ac; FrenchButton.Clicked += FrenchButton_Clicked; GermanButton.Clicked += GermanButton_Clicked; EnglishButton.Clicked += EnglishButton_Clicked; }
void Awake() { perceptionCollider = GetComponent <SphereCollider>(); alarmController = GameObject.FindGameObjectWithTag("GameController").GetComponent <AlarmController>(); player = GameObject.FindGameObjectWithTag("Player"); lastPlayerPosition = alarmController.lastPlayerPosition; previousSighting = alarmController.playerResetPosition; }
public void AddRoutine_CheckNullArgument() { WashingDayDefinition wd = new WashingDayDefinition(); AlarmController ac = new AlarmController(null, null, null); WashingDayEditorController wdc = new WashingDayEditorController(wd, allRoutines, ac); Assert.Throws <System.ArgumentNullException>(delegate { wdc.AddRoutine(null); }); }
public void Close(object sender, CancelEventArgs e) { kinectController.Dispose(); alarmController.Dispose(); kinectController = null; alarmController = null; rgbImage.Source = null; skeletonCanvas.Children.Clear(); }
public void ControllerCanBeLoaded() { var dbMock = new DbMock(); AlarmController ac = new AlarmController(dbMock, dbMock, dbMock); var days = ac.GetTodayWashDays(); Assert.NotNull(days); }
public Notify() { var fileDb = new FileDB(HairAppBl.Constants.SchedulesStorageFile); var historyfileDb = new FileDB(HairAppBl.Constants.HistoryStorageFile); var settingsDb = new FileDB(HairAppBl.Constants.SettingsStorageFile); mAlarmController = new AlarmController(fileDb, historyfileDb, settingsDb); SetCulture(mAlarmController.GetCulture().Culture); }
public void RoutineCanBeAdded() { WashingDayDefinition wd = new WashingDayDefinition(); AlarmController ac = new AlarmController(null, null, null); WashingDayEditorController wdc = new WashingDayEditorController(wd, allRoutines, ac); var r = allRoutines[0]; wdc.AddRoutine(r); Assert.True(wdc.GetRoutineDefinitions().Contains(r)); Assert.False(wdc.GetUnusedRoutineDefinitions().Contains(r)); }
/// <summary> /// Called when the application starts /// </summary> /// <param name="e"></param> protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); AlarmController ac = new AlarmController(); GuiEventCaller.GetCaller().AddListener(ac); TimeController tc = new TimeController(); TimePulseGenerator.fetch().add(tc); TimePulseGenerator.fetch().add(ac); setAudioFileNames(); }
public void MoveUp() { WashingDayDefinition wd = new WashingDayDefinition(); AlarmController ac = new AlarmController(null, null, null); WashingDayEditorController wdc = new WashingDayEditorController(wd, allRoutines, ac); var unused = wdc.GetUnusedRoutineDefinitions(); wdc.AddRoutine(unused[0]); wdc.AddRoutine(unused[1]); wdc.AddRoutine(unused[2]); wdc.MoveUp(unused[1]); Assert.AreEqual(wdc.GetRoutineDefinitions()[0], unused[1]); }
public void DayCanBeSaved() { var dbMock = new DbMock(); AlarmController ac = new AlarmController(dbMock, dbMock, dbMock); var schedule = new ScheduleDefinition(); schedule.WeeklyPeriod.Period = 4; var day = new ScheduleSqlDefinition(schedule, "Foo", "Bar"); ac.SaveWashDay(day); var restored = ac.LoadScheduleDatabase(); Assert.AreEqual(4, restored["Foo"].Value.WeeklyPeriod.Period); }
public void WashDaysCanBeRead() { var dbMock = new DbMock(); AlarmController ac = new AlarmController(dbMock, dbMock, dbMock); var schedule = new ScheduleDefinition(); schedule.Type = ScheduleDefinition.ScheduleType.Dayly; schedule.DaylyPeriod.Period = 1; var day = new ScheduleSqlDefinition(schedule, "Foo", "Bar"); ac.SaveWashDay(day); var days = ac.GetTodayWashDays(); Assert.AreEqual(1, days.Count); }
public void Monthly_FirstSaturday_MonthlyPeriod_1() { WashingDayDefinition wd = new WashingDayDefinition(); AlarmController ac = new AlarmController(null, null, null); WashingDayEditorController wdc = new WashingDayEditorController(wd, allRoutines, ac); wdc.GetModel().Scheduled.Type = ScheduleDefinition.ScheduleType.Monthly; wdc.GetModel().Scheduled.MonthlyPeriod.Period = 1; wdc.GetModel().Scheduled.StartDate = new DateTime(2019, 2, 1); wdc.GetModel().Scheduled.MonthlyPeriod.Type = ScheduleDefinition.Monthly.ScheduleType.First; wdc.GetModel().Scheduled.MonthlyPeriod.WeekDay = DayOfWeek.Saturday; var controller = wdc.GetScheduleController(); var days = controller.GetScheduledDays(); }
public CareDayList(MainSessionController mainSessionController, HairAppBl.Interfaces.IHairBl hairbl, AlarmController ac, ContentPage page) { mMainSessionController = mainSessionController; mWashingDays = mainSessionController.GetAllWashingDays(); mHairbl = hairbl; mAlarmController = ac; mPage = page; mMainSessionController.DefinitionsEdited += MMainSessionController_DefinitionsEdited; mWashDayList = new StackLayout { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand }; Children.Add(mWashDayList); RefreshList(); }
public void GetScheduledDays_CheckOtherWeekDay() { WashingDayDefinition wd = new WashingDayDefinition(); AlarmController ac = new AlarmController(null, null, null); WashingDayEditorController wdc = new WashingDayEditorController(wd, allRoutines, ac); wdc.GetModel().Scheduled.WeeklyPeriod.WeekDays = new System.Collections.Generic.List <DayOfWeek> { DayOfWeek.Sunday }; var res = wdc.GetScheduledDays(); Assert.AreEqual(DayOfWeek.Sunday, res[0].DayOfWeek); Assert.AreEqual(DayOfWeek.Sunday, res[1].DayOfWeek); }
/// <summary> /// Called when the application starts /// </summary> protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); LaunchOnRestart(); AssignPlatformControllers(); SetAudioFileNames(); TimePulseGenerator.Instance = new TimePulseGenerator(new SengDispatcherTimer()); ac = new AlarmController(); GuiEventCaller.GetCaller().AddListener(ac); TimePulseGenerator.Instance.registerListener(ac); tc = new TimeController(); GuiEventCaller.GetCaller().AddListener(tc); TimePulseGenerator.Instance.registerListener(tc); }
public CalendarPage(MainSessionController controller, AlarmController ac, HairAppBl.Interfaces.IHairBl hairbl) { InitializeComponent(); mMainSessionController = controller; mAlarmController = ac; mHairBl = hairbl; //Calendar InitCalendar(); //Resources mPlanedCareDaysLabel.Text = AppResources.PlanedCareDays; mFinshedCareDaysLabel.Text = AppResources.FinishedCareDays; mMainSessionController.DefinitionsEdited += MMainSessionController_DefinitionsEdited; mMainSessionController.InstanceEdited += MMainSessionController_InstanceEdited; }
public void GetScheduledDays_Period2() { WashingDayDefinition wd = new WashingDayDefinition(); AlarmController ac = new AlarmController(null, null, null); WashingDayEditorController wdc = new WashingDayEditorController(wd, allRoutines, ac); wdc.GetModel().Scheduled.WeeklyPeriod.Period = 2; wdc.GetModel().Scheduled.WeeklyPeriod.WeekDays = new System.Collections.Generic.List <DayOfWeek> { DayOfWeek.Monday, }; wdc.GetModel().Scheduled.StartDate = new DateTime(2019, 2, 5); var res = wdc.GetScheduledDays(); Assert.True(ScheduleController.IsSameDay(res[0], new DateTime(2019, 2, 11))); Assert.True(ScheduleController.IsSameDay(res[1], new DateTime(2019, 2, 25))); }
public void Monthly_SecondSaturday_BeforeStart_MonthlyPeriod_2() { WashingDayDefinition wd = new WashingDayDefinition(); AlarmController ac = new AlarmController(null, null, null); WashingDayEditorController wdc = new WashingDayEditorController(wd, allRoutines, ac); wdc.GetModel().Scheduled.Type = ScheduleDefinition.ScheduleType.Monthly; wdc.GetModel().Scheduled.MonthlyPeriod.Period = 2; wdc.GetModel().Scheduled.StartDate = new DateTime(2019, 2, 23); wdc.GetModel().Scheduled.MonthlyPeriod.Type = ScheduleDefinition.Monthly.ScheduleType.First; wdc.GetModel().Scheduled.MonthlyPeriod.WeekDay = DayOfWeek.Saturday; var controller = wdc.GetScheduleController(); var days = controller.GetScheduledDays(); Assert.AreEqual(new DateTime(2019, 3, 2), days[0]); Assert.AreEqual(new DateTime(2019, 5, 4), days[1]); }
public void Time2CareDay_is0() { WashingDayDefinition wd = new WashingDayDefinition(); AlarmController ac = new AlarmController(null, null, null); WashingDayEditorController wdc = new WashingDayEditorController(wd, allRoutines, ac); wdc.GetModel().Scheduled.WeeklyPeriod.WeekDays = new System.Collections.Generic.List <DayOfWeek> { DayOfWeek.Sunday, DayOfWeek.Thursday }; wdc.GetModel().Scheduled.WeeklyPeriod.Period = 2; wdc.GetModel().Scheduled.StartDate = new DateTime(2019, 2, 5); var controller = wdc.GetScheduleController(); Assert.AreEqual(0, controller.Time2NextCareDay(new DateTime(2019, 2, 7))); }
void Awake() { nav = GetComponent <NavMeshAgent>(); alarmController = GameObject.FindGameObjectWithTag("GameController").GetComponent <AlarmController>(); playerPosition = GameObject.FindGameObjectWithTag("Player").transform.position; if (path != null) { List <Transform> tmp = new List <Transform>(); foreach (Transform pathNode in path) { tmp.Add(pathNode); } pathList = tmp.ToArray(); } else { Debug.Log("Path for enemy is not set"); } }
public void GetScheduledDays_Period2_twoDays() { WashingDayDefinition wd = new WashingDayDefinition(); AlarmController ac = new AlarmController(null, null, null); WashingDayEditorController wdc = new WashingDayEditorController(wd, allRoutines, ac); wdc.GetModel().Scheduled.WeeklyPeriod.WeekDays = new System.Collections.Generic.List <DayOfWeek> { DayOfWeek.Sunday, DayOfWeek.Thursday }; wdc.GetModel().Scheduled.WeeklyPeriod.Period = 2; wdc.GetModel().Scheduled.StartDate = new DateTime(2019, 2, 5); var res = wdc.GetScheduledDays(); Assert.True(ScheduleController.ContainsDay(res, new DateTime(2019, 2, 7))); Assert.True(ScheduleController.ContainsDay(res, new DateTime(2019, 2, 10))); Assert.True(ScheduleController.ContainsDay(res, new DateTime(2019, 2, 21))); Assert.True(ScheduleController.ContainsDay(res, new DateTime(2019, 2, 24))); }
/// <summary> /// Builds controller objects and starts th e app /// </summary> public App() { AbstractGuiController.SetController(new GuiController()); TimePulseGenerator.Instance = new TimePulseGenerator(new SengDispatcherTimer()); AbstractAudioController.SetController(new AudioController()); this.Startup += this.Application_Startup; this.Exit += this.Application_Exit; this.UnhandledException += this.Application_UnhandledException; InitializeComponent(); TimeController tc = new TimeController(); GuiEventCaller.GetCaller().AddListener(tc); TimePulseGenerator.Instance.registerListener(tc); AlarmController ac = new AlarmController(); GuiEventCaller.GetCaller().AddListener(ac); TimePulseGenerator.Instance.registerListener(ac); }
public MainTabPage(IHairBl bl, MainSessionController mainSessionController, AlarmController ac) : base() { App.BL.Logger.Call("MainPage"); mMainsSesion = mainSessionController; mAlarmController = ac; mHairBl = bl; if (!mainSessionController.HasCulture()) { var intro = new IntroPage(mainSessionController, ac); intro.Disappearing += Intro_Disappearing; Navigation.PushAsync(intro); } else { var ci = new System.Globalization.CultureInfo(mainSessionController.GetCulture()); DependencyService.Get <ILocalize>().SetLocale(ci); Init(); } //SetToolbarPlacement(ToolbarPlacement.Bottom); }
public App() { InitializeComponent(); //Init Culture //var ci = DependencyService.Get<ILocalize>().GetCurrentCultureInfo(); //Init Alarms DependencyService.Get <IAlarm>()?.Init(); BL = new HairAppBl.HairAppBl(new FileLogger(), Current.Resources); App.MainSession = new MainSessionController(Current.Properties); App.MainSession.Saved += MainSession_Saved; Session.Register(App.MainSession); Session.Restore(); var fileDb = new FileDB(Constants.SchedulesStorageFile); var historyfileDb = new FileDB(Constants.HistoryStorageFile); var settingsDb = new FileDB(Constants.SettingsStorageFile); var ac = new AlarmController(fileDb, historyfileDb, settingsDb); MainPage = new NavigationPage(new CustomTabBar(BL, MainSession, ac)); ((NavigationPage)MainPage).BarBackgroundColor = Color.FromHex((String)Current.Resources["NavColor"]); }
public CustomTabBar(IHairBl bl, MainSessionController mainSessionController, AlarmController ac) : base() { ToolbarItems.Add(new ToolbarItem("Settings", "settingstitle.png", new Action(Foo), ToolbarItemOrder.Primary)); NavigationPage.SetTitleView(this, CustomTabBar.CreateTitleView(new Xamarin.Forms.Image() { Source = "title.png", HeightRequest = 43 })); SelectedTabColor = Color.White; UnselectedTabColor = Color.Gray; On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom); var navigationPage = new MainPage(ac, bl); navigationPage.IconImageSource = "home.png"; navigationPage.Title = ""; var navigationPage2 = new CalendarPage(mainSessionController, ac, bl); navigationPage2.IconImageSource = "calendar.png"; navigationPage2.Title = ""; var navigationPage3 = new HistoryPage(bl, mainSessionController); navigationPage3.IconImageSource = "checklist.png"; navigationPage3.Title = ""; var navigationPage4 = new ChartPage(bl, mainSessionController); navigationPage4.IconImageSource = "chart.png"; navigationPage4.Title = ""; Children.Add(navigationPage); Children.Add(navigationPage2); Children.Add(navigationPage3); Children.Add(navigationPage4); // NavigationPage.SetHasNavigationBar(this, false); }