//Loading filtered data private void LoadData(string name) { using (var db = new ApirsRepository <tblTransect>()) { try { Transects = new BindableCollection <tblTransect>(db.GetModelByExpression(tra => tra.traName == name)); if (Transects.Count == 0) { SelectedTransect = new tblTransect(); SelectedTransect.traName = name; } else if (Transects.Count > 1) { SelectedTransect = Transects.First(); } else { SelectedTransect = Transects.First(); } } catch { Transects = new BindableCollection <tblTransect>(); SelectedTransect = new tblTransect() { traName = name }; } } }
//Loading filtered data private void LoadData(string name) { using (var db = new ApirsRepository <tblHandpiece>()) { try { Handpieces = new BindableCollection <tblHandpiece>(db.GetModelByExpression(hp => hp.hpLabelFk == name)); if (Handpieces.Count == 0) { SelectedHandpiece = new tblHandpiece(); SelectedHandpiece.hpLabelFk = name; } else if (Handpieces.Count > 1) { SelectedHandpiece = Handpieces.First(); } else { SelectedHandpiece = Handpieces.First(); } } catch { Handpieces = new BindableCollection <tblHandpiece>(); SelectedHandpiece = new tblHandpiece(); } } }
//Loading filtered data private void LoadData(string name) { using (var db = new ApirsRepository <tblThinSection>()) { try { ThinSections = new BindableCollection <tblThinSection>(db.GetModelByExpression(ts => ts.tsFromSample == name)); if (ThinSections.Count == 0) { SelectedThinSection = new tblThinSection(); SelectedThinSection.tsFromSample = name; } else if (ThinSections.Count > 1) { SelectedThinSection = ThinSections.First(); } else { SelectedThinSection = ThinSections.First(); } } catch { ThinSections = new BindableCollection <tblThinSection>(); SelectedThinSection = new tblThinSection(); SelectedThinSection.tsFromSample = name; } } }
//Loading filtered data private void LoadData(int id) { try { VolcanicFacys = new BindableCollection <tblVolcanicFacy>(new ApirsRepository <tblVolcanicFacy>().GetModelByExpression(lft => lft.vffacIdFk == id)); if (VolcanicFacys.Count == 0) { SelectedVolcanicFacy = new tblVolcanicFacy(); SelectedVolcanicFacy.vffacIdFk = id; } else if (VolcanicFacys.Count > 1) { SelectedVolcanicFacy = VolcanicFacys.First(); } else { SelectedVolcanicFacy = VolcanicFacys.First(); } } catch (Exception e) { VolcanicFacys = new BindableCollection <tblVolcanicFacy>(); SelectedVolcanicFacy = new tblVolcanicFacy(); } }
//Loading filtered data private void LoadData(string name) { using (var db = new ApirsDatabase()) { try { Drillings = new BindableCollection <tblDrilling>(from drill in db.tblDrillings where drill.drillName == name select drill); if (Drillings.Count == 0) { SelectedDrilling = new tblDrilling(); SelectedDrilling.drillName = name; } else if (Drillings.Count > 1) { SelectedDrilling = Drillings.First(); } else { SelectedDrilling = Drillings.First(); } } catch { Drillings = new BindableCollection <tblDrilling>(); SelectedDrilling = new tblDrilling(); } } }
//Loading filtered data private void LoadData(string name) { using (var db = new ApirsRepository <tblCuboid>()) { try { Cuboids = new BindableCollection <tblCuboid>(db.GetModelByExpression(cub => cub.cubLabel == name)); if (Cuboids.Count == 0) { SelectedCuboid = new tblCuboid(); SelectedCuboid.cubLabel = name; } else if (Cuboids.Count > 1) { SelectedCuboid = Cuboids.First(); } else { SelectedCuboid = Cuboids.First(); } } catch { Cuboids = new BindableCollection <tblCuboid>(); SelectedCuboid = new tblCuboid(); } } }
//Loading filtered data private void LoadData(string name) { using (var db = new ApirsRepository <tblPowder>()) { try { Powders = new BindableCollection <tblPowder>(db.GetModelByExpression(pow => pow.powFromSampleName == name)); if (Powders.Count == 0) { SelectedPowder = new tblPowder(); SelectedPowder.powFromSampleName = name; } else if (Powders.Count > 1) { SelectedPowder = Powders.First(); } else { SelectedPowder = Powders.First(); } } catch { Powders = new BindableCollection <tblPowder>(); SelectedPowder = new tblPowder(); } } }
//Loading filtered data private void LoadData(string name) { using (var db = new ApirsRepository <tblDrilling>()) { try { Drillings = new BindableCollection <tblDrilling>(db.GetModelByExpression(x => x.drillName == name)); if (Drillings.Count == 0) { SelectedDrilling = new tblDrilling(); SelectedDrilling.drillName = name; } else if (Drillings.Count > 1) { SelectedDrilling = Drillings.First(); } else { SelectedDrilling = Drillings.First(); } } catch { Drillings = new BindableCollection <tblDrilling>(); SelectedDrilling = new tblDrilling(); } } }
//Loading filtered data private void LoadData(string name) { using (var db = new ApirsRepository <tblPlug>()) { try { Plugs = new BindableCollection <tblPlug>(db.GetModelByExpression(plug => plug.plugLabel == name)); if (Plugs.Count == 0) { SelectedPlug = new tblPlug(); SelectedPlug.plugLabel = name; } else if (Plugs.Count > 1) { SelectedPlug = Plugs.First(); } else { SelectedPlug = Plugs.First(); } } catch { Plugs = new BindableCollection <tblPlug>(); SelectedPlug = new tblPlug(); } } }
//Loading filtered data private void LoadData(int id) { using (var db = new ApirsRepository <tblIgneousFacy>()) { try { IgneousFacys = new BindableCollection <tblIgneousFacy>(db.GetModelByExpression(lft => lft.iffacIdFk == id)); if (IgneousFacys.Count == 0) { SelectedIgneousFacy = new tblIgneousFacy(); SelectedIgneousFacy.iffacIdFk = id; } else if (IgneousFacys.Count > 1) { SelectedIgneousFacy = IgneousFacys.First(); } else { SelectedIgneousFacy = IgneousFacys.First(); } } catch (Exception e) { IgneousFacys = new BindableCollection <tblIgneousFacy>(); SelectedIgneousFacy = new tblIgneousFacy(); } } }
//Loading filtered data private void LoadData(string name) { using (var db = new ApirsRepository <tblOutcrop>()) { try { Outcrops = new BindableCollection <tblOutcrop>(db.GetModelByExpression(outc => outc.outLocalName == name)); if (Outcrops.Count == 0) { SelectedOutcrop = new tblOutcrop(); SelectedOutcrop.outLocalName = name; } else if (Outcrops.Count > 1) { SelectedOutcrop = Outcrops.First(); } else { SelectedOutcrop = Outcrops.First(); } } catch { Outcrops = new BindableCollection <tblOutcrop>(); SelectedOutcrop = new tblOutcrop(); } } }
//Loading filtered data private void LoadData() { try { using (var db = new ApirsRepository <tblBasin>()) { try { Basins = new BindableCollection <tblBasin>(db.GetModel().ToList()); this.allBasins = Basins; if (Basins.Count == 0) { SelectedBasin = new tblBasin() { basUserIdFk = (int)((ShellViewModel)IoC.Get <IShell>()).UserId }; } else if (Basins.Count > 1) { SelectedBasin = Basins.First(); } else { SelectedBasin = Basins.First(); } } catch { Basins = new BindableCollection <tblBasin>(); this.allBasins = Basins; SelectedBasin = new tblBasin() { basUserIdFk = (int)((ShellViewModel)IoC.Get <IShell>()).UserId }; } } using (var db = new ApirsRepository <LithostratigraphyUnion>()) { try { Lithostratigraphy = new BindableCollection <LithostratigraphyUnion>(db.GetCompleteLithostratigraphy().ToList()); } catch { Lithostratigraphy = new BindableCollection <LithostratigraphyUnion>(); } } } catch { Basins = new BindableCollection <tblBasin>(); SelectedBasin = new tblBasin() { basUserIdFk = (int)((ShellViewModel)IoC.Get <IShell>()).UserId }; } }
/// <summary> /// Редактировать выбранный эпизод /// </summary> public void EditEpisode() { if (CanEditEpisode is false) { return; } if (LoadSelectedEpisodeData() is false) { return; } SelectedEpisodeOption = EpisodeOptions .First(eo => eo.CartoonVoiceOverId == EditableEpisode.CartoonVoiceOver.CartoonVoiceOverId); ImportingEpisodeOption = EpisodeOptions.First(); Jumpers = new BindableCollection <Jumper>(SelectedEpisodeOption.Jumpers); SelectedJumper = Jumpers.First(); EditableEpisodeTime = ConvertToEpisodeTime(SelectedEpisodeOption, SelectedJumper); TempEpisodeSnapshot = JsonConvert.SerializeObject(EditableEpisode); TempEpisodeOptionSnapshot = JsonConvert.SerializeObject(SelectedEpisodeOption); //NotifyOfPropertyChange(() => EpisodeDuration); IsNotEditing = false; NotifyOfPropertyChange(() => CanCancelEpisodeSelection); }
/// <summary> /// Отмена измененных данных /// </summary> public void CancelChanges() { if (CanCancelChanges is false) { return; } var dvm = new DialogViewModel(null, DialogType.CANCEL_CHANGES); WinMan.ShowDialog(dvm); if (dvm.DialogResult == DialogResult.NO_ACTION) { return; } EditableEpisode = JsonConvert.DeserializeObject <CartoonEpisode>(TempEpisodeSnapshot); SelectedEpisodeOption = JsonConvert.DeserializeObject <EpisodeOption>(TempEpisodeOptionSnapshot); var tempId = SelectedJumper.JumperId; Jumpers = new BindableCollection <Jumper>(SelectedEpisodeOption.Jumpers); SelectedJumper = Jumpers.First(j => j.JumperId == tempId); EditableEpisodeTime = ConvertToEpisodeTime(SelectedEpisodeOption, SelectedJumper); NotifyEditingProperties(); NotifyOfPropertyChange(() => Jumpers); NotifyOfPropertyChange(() => SelectedJumper); }
public void SelectFirstCompanyViewModel() { if (m_CompanyViewModels.Any()) { SelectedCompanyViewModel = m_CompanyViewModels.First(); } }
private void SelectFirstInvestmentPlan() { if (m_InvestmentPlanViewModels.Any()) { SelectedInvestmentPlanViewModel = m_InvestmentPlanViewModels.First(); } }
/// <summary> /// Отмена редактирования (разблокировка интрефейса) /// </summary> public void CancelEditing() { if (CanCancelEditing is false) { return; } EditableEpisode = null; EpisodeOptions = new BindableCollection <EpisodeOption>(); Jumpers = new BindableCollection <Jumper>(); SelectedJumper = null; TempEpisodeSnapshot = ""; TempEpisodeOptionSnapshot = ""; IsNotEditing = true; var tempId = SelectedEpisode.CartoonEpisodeId; using (var ctx = new CVDbContext(AppDataPath)) { var episodes = ctx.CartoonEpisodes .Include(ce => ce.EpisodeVoiceOvers) .Where(ce => ce.CartoonSeasonId == GlobalIdList.SeasonId); Episodes = new BindableCollection <CartoonEpisode>(episodes); } SelectedEpisode = Episodes.First(e => e.CartoonEpisodeId == tempId); }
public NewOrderViewModel(IValidationRepository validationRepository) { this.validationRepository = validationRepository; var listDocuments = validationRepository.ListDocuments<Customer>(); Customers = new BindableCollection<Customer>(listDocuments); if (Customers.Count > 0) CustomerId = Customers.First().Id; }
public async Task UpdateSeatMap(BindableCollection <SeatModel> seats) { var seatClient = GetSeatServiceceClient(UserInfo.Username, UserInfo.Token); await DeleteSeatMapAsync(seats.First().AreaId); CreateSeatMap(seats); }
public GenericPropertiesViewModel(LayerEditorViewModel editorVm) : base(editorVm) { LayerAnimations = new BindableCollection<ILayerAnimation>(editorVm.LayerAnimations); OpacityProperties = new LayerDynamicPropertiesViewModel("Opacity", editorVm); SelectedLayerAnimation = LayerAnimations.FirstOrDefault(l => l.Name == editorVm.ProposedLayer.LayerAnimation?.Name) ?? LayerAnimations.First(l => l.Name == "None"); }
public GenericPropertiesViewModel(LayerEditorViewModel editorVm) : base(editorVm) { LayerAnimations = new BindableCollection <ILayerAnimation>(editorVm.LayerAnimations); OpacityProperties = new LayerDynamicPropertiesViewModel("Opacity", editorVm); SelectedLayerAnimation = LayerAnimations.FirstOrDefault(l => l.Name == editorVm.ProposedLayer.LayerAnimation?.Name) ?? LayerAnimations.First(l => l.Name == "None"); }
/// <summary> /// Updates the Brand Dropdown. /// </summary> public void UpdateBrandDropdown() { List <BrandModel> savedBrands = UtilityFilePaths.BrandModelsFile.FullUtilitiesPath().LoadFile().ConvertLinesIntoBrands(); savedBrands.Sort(); Brands = new BindableCollection <BrandModel>(savedBrands); SelectedBrand = Brands.First(); }
//Loading filtered data private void LoadData(int id) { using (var db = new ApirsRepository <tblProject>()) { try { Projects = new BindableCollection <tblProject>(db.GetModelByExpression(x => x.prjCreatorIdFk == id)); if (Projects.Count == 0) { SelectedProject = new tblProject() { prjCreatorIdFk = (int)((ShellViewModel)IoC.Get <IShell>()).UserId }; } else if (Projects.Count > 1) { SelectedProject = Projects.First(); } else { SelectedProject = Projects.First(); } } catch (Exception e) { Projects = new BindableCollection <tblProject>(); SelectedProject = new tblProject() { prjCreatorIdFk = (int)((ShellViewModel)IoC.Get <IShell>()).UserId }; } try { ParticipatingProjects = new BindableCollection <tblProject>(db.GetProjectByParticipation((int)((ShellViewModel)IoC.Get <IShell>()).UserId)); } catch { ParticipatingProjects = new BindableCollection <tblProject>(); } } }
//Initial data load method public async void LoadData(string parameter = "Group") { try { try { Lithostratigraphies = new BindableCollection <LithostratigraphyUnion>(this.allLithostratigraphies.Where(x => x.Hierarchy.Equals(parameter)).OrderBy(x => x.grName).ToList()); switch (parameter) { case "Group": ParentLithostratigraphies = new BindableCollection <LithostratigraphyUnion>(); break; case "Subgroup": ParentLithostratigraphies = new BindableCollection <LithostratigraphyUnion>(this.allLithostratigraphies.Where(x => x.Hierarchy.Equals("Group")).OrderBy(x => x.grName).ToList()); break; case "Formation": ParentLithostratigraphies = new BindableCollection <LithostratigraphyUnion>(this.allLithostratigraphies.Where(x => x.Hierarchy.Equals("Subgroup")).OrderBy(x => x.grName).ToList()); break; case "Subformation": ParentLithostratigraphies = new BindableCollection <LithostratigraphyUnion>(this.allLithostratigraphies.Where(x => x.Hierarchy.Equals("Formation")).OrderBy(x => x.grName).ToList()); break; } if (Lithostratigraphies.Count > 0) { SelectedLithostratigraphy = Lithostratigraphies.First(); } else { SelectedLithostratigraphy = new LithostratigraphyUnion() { Hierarchy = this.Hierarchy } }; } catch (Exception ex) { Lithostratigraphies = new BindableCollection <LithostratigraphyUnion>(); SelectedLithostratigraphy = new LithostratigraphyUnion() { Hierarchy = this.Hierarchy }; ParentLithostratigraphies = new BindableCollection <LithostratigraphyUnion>(); } } catch (Exception e) { Console.WriteLine(e.Message); } }
/// <summary> /// Creates a new instance of the Add New Brand View. /// </summary> /// <param name="newCapModel"> /// The Add Cap view the user is in. /// </param> public AddNewBrandViewModel(AddNewCapViewModel newCapModel) { addCapView = newCapModel; List <string> savedBrandImages = Directory.GetFiles(CapImageFilePaths.CapImageFolderPath).ToList(); ExistingBrandImages = new BindableCollection <string>(savedBrandImages); if (ExistingBrandImages.Count != 0) { SelectedBrandImage = ExistingBrandImages.First(); } }
public ProfileFiltersViewModel(FiltersProfile filtersProfile, LogPaneServices logPaneServices) { FiltersProfile = filtersProfile; this.logPaneServices = logPaneServices; LogLevels = new BindableCollection <LogLevelFilterViewModel>( FiltersProfile.LogLevels.Select(ll => new LogLevelFilterViewModel(logPaneServices, ll))); MinLogLevel = LogLevels.First(); SourceFilterRootViewModel = new SourceFilterViewModel(filtersProfile.SourceFilterRoot, logPaneServices); }
public KeyboardPropertiesViewModel(LayerEditorViewModel editorVm) : base(editorVm) { LayerAnimations = new BindableCollection <ILayerAnimation>(editorVm.LayerAnimations); HeightProperties = new LayerDynamicPropertiesViewModel("Height", editorVm); WidthProperties = new LayerDynamicPropertiesViewModel("Width", editorVm); OpacityProperties = new LayerDynamicPropertiesViewModel("Opacity", editorVm); LayerTweenViewModel = new LayerTweenViewModel(editorVm); SelectedLayerAnimation = LayerAnimations.FirstOrDefault(l => l.Name == editorVm.ProposedLayer.LayerAnimation?.Name) ?? LayerAnimations.First(l => l.Name == "None"); }
public CompilerSettingsViewModel() { WarningLevels = new BindableCollection <WarningLevel> { new WarningLevel("Level 1", "/W1"), new WarningLevel("Level 2", "/W2"), new WarningLevel("Level 3", "/W3"), new WarningLevel("Level 4", "/W4"), }; WarningLevel = WarningLevels.First(x => x.Value == Properties.Settings.Default.CompileWarningLevel); OutputPath = Properties.Settings.Default.CompileOutputPath; }
//Loading filtered data private void LoadData(int id) { try { BiochemicalFacys = new BindableCollection <tblBiochemicalFacy>(new ApirsRepository <tblBiochemicalFacy>().GetModelByExpression(lft => lft.bffacIdFk == id)); if (BiochemicalFacys.Count == 0) { SelectedBiochemicalFacy = new tblBiochemicalFacy(); SelectedBiochemicalFacy.bffacIdFk = id; } else if (BiochemicalFacys.Count > 1) { SelectedBiochemicalFacy = BiochemicalFacys.First(); } else { SelectedBiochemicalFacy = BiochemicalFacys.First(); } } catch (Exception e) { BiochemicalFacys = new BindableCollection <tblBiochemicalFacy>(); SelectedBiochemicalFacy = new tblBiochemicalFacy(); } try { PrimarySedimentaryStructures = new BindableCollection <tblSedimentaryStructure>(new ApirsRepository <tblSedimentaryStructure>().GetModelByExpression(sed => sed.sedRockType.Contains("Biochemical") && sed.sedPrimary == true)); SecondarySedimentaryStructures = new BindableCollection <tblSedimentaryStructure>(new ApirsRepository <tblSedimentaryStructure>().GetModelByExpression(sed => sed.sedRockType.Contains("Biochemical") && sed.sedPrimary == false)); } catch { PrimarySedimentaryStructures = new BindableCollection <tblSedimentaryStructure>(); SecondarySedimentaryStructures = new BindableCollection <tblSedimentaryStructure>(); } }
public AudioPropertiesViewModel(LayerEditorViewModel editorVm) : base(editorVm) { LayerAnimations = new BindableCollection <ILayerAnimation>(editorVm.LayerAnimations); Devices = new BindableCollection <string>(); SelectedLayerAnimation = LayerAnimations.FirstOrDefault(l => l.Name == editorVm.ProposedLayer.LayerAnimation?.Name) ?? LayerAnimations.First(l => l.Name == "None"); SetupAudioSelection(); if (SelectedDevice == null) { SelectedDevice = Devices.First(); } }
private void RefreshResults(ReturnedEntity selectedItem) { Repository.Reload(); GetRecords(); try { SelectedItem = _entities?.First(a => a.Type == selectedItem.Type && a.Id == selectedItem.Id); } catch { Console.WriteLine(); } }
public void RefreshResults(ReturnedEntity entity) { Repository.Reload(); Entities = new BindableCollection <ReturnedEntity>(_sa.GetAllByNoActions()); try { SelectedItem = Entities?.First(a => a.Type == entity.Type && a.Id == entity.Id); } catch { Console.WriteLine(); } }
private void InitializeTheme() { accentColors = new BindableCollection<AccentViewModel>( ThemeManager.Accents.Select(a => new AccentViewModel(a.Name, (Brush)a.Resources["AccentColorBrush"])).ToList()); var currentTheme = themeManager.CurrentConfiguration; if (currentTheme != null) { ActiveAccent = accentColors.First(a => a.Name == currentTheme.Accent); IsThemeDark = currentTheme.Theme == "BaseDark"; IsThemeLight = currentTheme.Theme == "BaseLight"; } IsFlyoutThemeAccent = themeManager.FlyoutTheme == FlyoutTheme.Accent; IsFlyoutThemeLight = themeManager.FlyoutTheme == FlyoutTheme.Light; IsFlyoutThemeDark = themeManager.FlyoutTheme == FlyoutTheme.Dark; }