private void ScreenshotElement([CanBeNull] object lt) { if (lt == null) { throw new LPGException("No item was found!"); } Logger.Get().SafeExecuteWithWait(() => { _applicationPresenter.OpenItem(lt); var idx = _tabControl.SelectedIndex; _tab = (TabItem)_tabControl.Items[idx]; }); Thread.Sleep(500); if (_tab == null) { throw new LPGException("Tab was null"); } SnapshotExpanders(_tab); Logger.Get().SafeExecuteWithWait(() => _tabControl.Items.RemoveAt(0)); _itemCount++; }
public void MakeCopy() { var newaction = Sim.DeviceActions.CreateNewItem(Sim.ConnectionString); newaction.Name = _deviceAction.Name + " (Copy)"; newaction.Description = _deviceAction.Description; newaction.Device = _deviceAction.Device; newaction.DeviceActionGroup = _deviceAction.DeviceActionGroup; newaction.SaveToDB(); foreach (var actionProfile in _deviceAction.Profiles) { if (actionProfile.Timeprofile != null && actionProfile.VLoadType != null) { newaction.AddDeviceProfile(actionProfile.Timeprofile, actionProfile.TimeOffset, actionProfile.VLoadType, actionProfile.Multiplier); } } newaction.SaveToDB(); ApplicationPresenter.OpenItem(newaction); }
public static void CreateItems([NotNull] Simulator sim, [NotNull] string affordanceName, [NotNull] string desirename, [NotNull] string devicename, [NotNull] string traitName, [NotNull] VLoadType loadType, [NotNull] DeviceCategory deviceCategory, [NotNull] TimeBasedProfile timeprofile, double desireWeight, double desireDecay, int minimumAge, int maximumAge, [NotNull] Location location, [NotNull] TraitTag traitTag, [NotNull] string traitClassification, [NotNull] TimeLimit timelimit, [NotNull] string affordanceCategory, [CanBeNull] ApplicationPresenter app, bool useExistingLocation, [NotNull] string locationName) { Location loc; if (useExistingLocation) { loc = location; } else { loc = sim.Locations.CreateNewItem(sim.ConnectionString); loc.Name = locationName; loc.SaveToDB(); } var aff = sim.Affordances.CreateNewItem(sim.ConnectionString); aff.Name = affordanceName; aff.PersonProfile = timeprofile; aff.MinimumAge = minimumAge; aff.MaximumAge = maximumAge; aff.TimeLimit = timelimit; aff.Red = 255; aff.Blue = 0; aff.AffCategory = affordanceCategory; var device = sim.RealDevices.CreateNewItem(sim.ConnectionString); device.Name = devicename; device.DeviceCategory = deviceCategory; device.AddLoad(loadType, 1, 0, 0); device.SaveToDB(); aff.AddDeviceProfile(device, timeprofile, 0, sim.RealDevices.It, sim.DeviceCategories.It, loadType, 1); var desire = sim.Desires.CreateNewItem(sim.ConnectionString); desire.DefaultDecayRate = (decimal)desireDecay; desire.DefaultWeight = (decimal)desireWeight; desire.Name = desirename; desire.SaveToDB(); aff.AddDesire(desire, 1, sim.Desires.It); if (loc.LocationDevices.Count > 0) { aff.NeedsLight = true; } aff.SaveToDB(); var trait = sim.HouseholdTraits.CreateNewItem(sim.ConnectionString); trait.AddTag(traitTag); var webtag = sim.TraitTags.FindFirstByName("web", FindMode.Partial); if (webtag != null) { trait.AddTag(webtag); } trait.Name = traitName; trait.Classification = traitClassification; trait.AddDesire(desire, (decimal)desireDecay, "all", 0.5M, (decimal)desireWeight, minimumAge, maximumAge, PermittedGender.All); trait.AddLocation(loc); trait.AddAffordanceToLocation(loc, aff, null, 100, 0, 0, 0, 0); trait.CalculateEstimatedTimes(); trait.SaveToDB(); if (app != null) { app.OpenItem(aff); app.OpenItem(desire); app.OpenItem(device); app.OpenItem(trait); } }
public void CopyRoute() { TravelRoute newRoute = ThisRoute.MakeACopy(Sim); ApplicationPresenter.OpenItem(newRoute); }
public void MakeCopy() { var newSite = ThisSite.MakeCopy(Sim); ApplicationPresenter.OpenItem(newSite); }