protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); if (e.NavigationMode == System.Windows.Navigation.NavigationMode.New) { var vm = new SpeakerDetailsViewModel(); var speaker = default(Speaker); if (NavigationContext.QueryString.ContainsKey("id")) { var id = int.Parse(NavigationContext.QueryString["id"]); speaker = SpeakerManager.GetSpeaker(id); } else if (NavigationContext.QueryString.ContainsKey("key")) { var key = NavigationContext.QueryString["key"]; speaker = SpeakerManager.GetSpeakerWithKey(key); } if (speaker != null) { vm.Update(speaker); } DataContext = vm; } }
public async Task GetAllSpeakerProfile_returns_all_speaker_profilesAsync() { var connection = new SqliteConnection("DataSource=:memory:"); connection.Open(); List <SpeakerProfile> speakerProfiles = new List <SpeakerProfile> { new SpeakerProfile { SpeakerId = Guid.NewGuid().ToString(), FirstName = "Test FN", LastName = "Test LN", Email = "*****@*****.**", Bio = "Test Bio", Company = "Test Compnay", PhotoPath = "testPath.jpg" }, new SpeakerProfile { SpeakerId = Guid.NewGuid().ToString(), FirstName = "Test2 FN", LastName = "Test2 LN", Email = "*****@*****.**", Bio = "Test2 Bio", Company = "Test2 Compnay", PhotoPath = "test2Path.jpg" } }; try { var options = new DbContextOptionsBuilder <PlanificatorDbContext>() .UseSqlite(connection) .Options; using (var context = new PlanificatorDbContext(options)) { context.Database.EnsureCreated(); var service = new SpeakerManager(context); var query = new SpeakerRepository(context); foreach (SpeakerProfile speakerProfile in speakerProfiles) { await service.AddSpeakerProfileAsync(speakerProfile); } context.SaveChanges(); Assert.Equal(speakerProfiles, await query.GetAllSpeakersProfilesAsync()); } } finally { connection.Close(); } }
// Start is called before the first frame update void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } instance = this; }
void OnEnable() { if (SpeakerManager.instance == null) { SpeakerManager.instance = this; } else if (SpeakerManager.instance != this) { Destroy(gameObject); } }
public DoorManager(SpeakerManager inSpeakers, AirManager inAirTanks) { hangarDoors = GridTerminalSystem.GetBlockGroupWithName(hangarDoorGroupName); if (hangarDoors == null) { Echo("Hangar Doors group not found"); throw new ArgumentException("Cannot find Door group: " + hangarDoorGroupName); } doorList = new List <IMyAirtightHangarDoor>(); speakers = inSpeakers; airTanks = inAirTanks; }
public async Task AssignSpeakerToPresentation_writes_to_databaseAsync() { var connection = new SqliteConnection("DataSource=:memory:"); connection.Open(); SpeakerProfile speaker = new SpeakerProfile { SpeakerId = Guid.NewGuid().ToString(), FirstName = "Test First Name", LastName = "Test Last Name", Email = "*****@*****.**", Bio = "My test bio", Company = "Test company", PhotoPath = "Test Path" }; try { var options = new DbContextOptionsBuilder <PlanificatorDbContext>() .UseSqlite(connection) .Options; using (var context = new PlanificatorDbContext(options)) { context.Database.EnsureCreated(); var presentationService = new PresentationManager(context); var speakerServie = new SpeakerManager(context); var testData = new PresentationRepositoryTestsData(); await speakerServie.AddSpeakerProfileAsync(speaker); await presentationService.AddPresentation(testData.presentationTags); await presentationService.AssignSpeakerToPresentationAsync(speaker, testData.presentation); context.SaveChanges(); Assert.Equal(1, context.PresentationSpeakers.Count()); Assert.Equal(speaker, context.PresentationSpeakers.Single().SpeakerProfile); Assert.Equal(testData.presentation, context.PresentationSpeakers.Include(p => p.Presentation).Single().Presentation); } } finally { connection.Close(); } }
/* Planned future features * Projector controls * Welding zones * Entry Airlock control * Read Custom Data of programming block to get Group Names * Read Custom Data of control panels to get welder/projector group names * Write to LCD status of zones, connectors, doors, air pressure, build progress */ public Program() { // The constructor, called only once every session and // always before any other method is called. Use it to // initialize your script. // // The constructor is optional and can be removed if not // needed. // // It's recommended to set Runtime.UpdateFrequency // here, which will allow your script to run itself without a // timer block. Runtime.UpdateFrequency = UpdateFrequency.Update100; speakers = new SpeakerManager(); airTanks = new AirManager(); welders = new WelderManager(); doors = new DoorManager(speakers, airTanks); }
protected override IEnumerable <IGrouping <string, Speaker> > GetGroupedItems() { return(from s in SpeakerManager.GetSpeakers() group s by GetGroupKey(s)); }
public List <Speaker> GetSpeakerData() { SpeakerManager sm = new SpeakerManager(); return(sm.Generatedata()); }