private void AddCharset(ref ObservableCollectionExt <CharExt> charactersToUse, char [] charset) { foreach (char ch in charset) { charactersToUse.Add(new CharExt(ch)); } }
private void Add_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { if (nodeSelectionne == null) { Annee nouvelleAnne = new Annee { Nom = "Nouvelle annee", Departement = depart.find(departementSelectionne.Id), NavigationDestination = typeof(AnneeVue), Description = "" }; annee.create(nouvelleAnne); annees.Add(nouvelleAnne); } else if (nodeSelectionne.GetType() == typeof(Annee)) { PartieAnnee nouvellePartieAnnee = new PartieAnnee { Nom = "Nouveau semestre", Annee = (Annee)nodeSelectionne, NavigationDestination = typeof(PartieAnneeVue), Description = "", Parent = nodeSelectionne }; partieAnnee.create(nouvellePartieAnnee); nodeSelectionne.Children.Add(nouvellePartieAnnee); } else if (nodeSelectionne.GetType() == typeof(PartieAnnee)) { Enseignement nouvelEnseignement = new Enseignement { Nom = "Nouveau enseignement", PartieAnnee = (PartieAnnee)nodeSelectionne, NavigationDestination = typeof(EnseignementVue), Description = "", Parent = nodeSelectionne }; enseignement.create(nouvelEnseignement); nodeSelectionne.Children.Add(nouvelEnseignement); } // nodeSelectionne.Nom = "fffsdfds"; }
protected void AddViewMenuItems(IEnumerable <IMenuViewModel> viewModels) { foreach (var item in viewModels) { _viewMenuItems.Add(item); } }
protected void SetContextMenuItems(IEnumerable <IMenuViewModel> contextMenuItems) { _contextMenuItems.Clear(); foreach (var item in contextMenuItems) { _contextMenuItems.Add(item); } }
private void AjouterEquivalentTD_Tapped(object sender, TappedRoutedEventArgs e) { EquivalentTD nouveauEquivalentTD = new EquivalentTD { Categorie = enseignantSelectionne.Categorie, TypeCours = null, Ratio = 1, tCs = tCs, Nom = "" }; equivalentTD.create(nouveauEquivalentTD); equivalentTDs.Add(nouveauEquivalentTD); }
private void AjouterEnseignant(object sender, Windows.UI.Xaml.RoutedEventArgs e) { Enseignant nouvelEnseignant = new Enseignant { Nom = "Nouvel", Prenom = "enseignant", Categorie = categ.find(1), NavigationDestination = typeof(EnseignantVue) }; enseignant.create(nouvelEnseignant); enseignants.Add(nouvelEnseignant); }
private void TabEC_Click(object sender, RoutedEventArgs e) { EC nouvelEc = new EC { Nom = "Nouvel EC", Enseignement = enseignementSelect }; EC.create(nouvelEc); ECs.Add(nouvelEc); }
internal void OnSnipeData(EncounteredEvent e) { var session = TinyIoCContainer.Current.Resolve <ISession>(); if (!e.IsRecievedFromSocket) { return; } lock (pending) { pending.Add(e); if (lastUpdateTime > DateTime.Now.AddSeconds(-session.LogicSettings.UIConfig.SnipeListRefreshInterval)) { return; } foreach (var item in pending) { var model = new SnipePokemonViewModel(item); var grade = PokemonGradeHelper.GetPokemonGrade(model.PokemonId); PokemonData best = null; if (bestPokemons != null) { best = bestPokemons.FirstOrDefault(x => x.PokemonId == model.PokemonId); } if (best == null || PokemonInfo.CalculatePokemonPerfection(best) < model.IV) { model.Recommend = true; } if (model.IV >= 100) { Handle100IV(model); } else if (grade == PokemonGrades.Legendary || grade == PokemonGrades.VeryRare || grade == PokemonGrades.Epic || grade == PokemonGrades.Rare) { HandleRarePokemon(model); } else { HandleOthers(model); } HandlePokedex(model); } pending.RemoveAll(x => true); lastUpdateTime = DateTime.Now; } }
public void TestConstructionInputBindings() { var command = new KeyBindingCommand(() => { }) { GestureKey = Key.B, GestureModifier = ModifierKeys.Control | ModifierKeys.Alt }; _keyBindings.Add(command); var control = CreateControl(); control.InputBindings.Should().NotBeEmpty(); var inputBinding = control.InputBindings.Cast <InputBinding>().First(x => x.Command == command); inputBinding.Command.Should().BeSameAs(command); inputBinding.Gesture.Should().BeOfType <KeyGesture>(); var keyGesture = (KeyGesture)inputBinding.Gesture; keyGesture.Key.Should().Be(Key.B); keyGesture.Modifiers.Should().Be(ModifierKeys.Control | ModifierKeys.Alt); }
private ObservableCollectionExt <Departement> GetDepartements() { ObservableCollectionExt <Departement> departements = new ObservableCollectionExt <Departement>(); foreach (Departement dpt in depart.findAll()) { departements.Add(new Departement { Visibility = true, Id = dpt.Id, Nom = dpt.Nom.TrimEnd() }); } return(departements); }
private ObservableCollectionExt <ObjetBase> GetEnseignants() { ObservableCollectionExt <ObjetBase> Enseignants = new ObservableCollectionExt <ObjetBase>(); foreach (Enseignant enseignant in enseignant.findAll()) { Enseignants.Add(new Enseignant { Id = enseignant.Id, Nom = enseignant.Nom.TrimEnd(), Prenom = enseignant.Prenom.TrimEnd(), nbHeuresTravaillees = enseignant.nbHeuresTravaillees, Categorie = enseignant.Categorie }); } return(Enseignants); }
private ObservableCollectionExt <Categorie> GetCategories() { ObservableCollectionExt <Categorie> categories = new ObservableCollectionExt <Categorie>(); foreach (Categorie categorie in categ.findAll()) { categories.Add(new Categorie { Id = categorie.Id, Nom = categorie.Nom.TrimEnd(), Heures = categorie.Heures }); } return(categories); }
private ObservableCollectionExt <Enseignant> GetEnseignants() { ObservableCollectionExt <Enseignant> enseignants = new ObservableCollectionExt <Enseignant>(); foreach (Enseignant ens in enseignant.findAll()) { enseignants.Add(new Enseignant { Id = ens.Id, Categorie = ens.Categorie, Prenom = ens.Prenom.TrimEnd(), Nom = ens.Nom.TrimEnd(), NavigationDestination = typeof(EnseignantVue), TreeView = annees }); } return(enseignants); }
private ObservableCollectionExt <TypeCours> GetTypeCours() { ObservableCollectionExt <TypeCours> tCs = new ObservableCollectionExt <TypeCours>(); foreach (TypeCours tC in tps.findAll()) { tCs.Add(new TypeCours { Id = tC.Id, Nom = tC.Nom.TrimEnd(), Groupes = tC.Groupes }); } return(tCs); }
private ObservableCollectionExt <EquivalentTD> GetEquivalentTDs(Categorie categorieSelectionnee) { ObservableCollectionExt <EquivalentTD> equivalentTDs = new ObservableCollectionExt <EquivalentTD>(); foreach (EquivalentTD eqTD in equivalentTD.findAll()) { if (eqTD.Categorie.Id == categorieSelectionnee.Id) { EquivalentTD equivalent = new EquivalentTD { Id = eqTD.Id, Categorie = categorieSelectionnee, TypeCours = eqTD.TypeCours, tCs = tCs, Nom = "", Ratio = eqTD.Ratio }; equivalentTDs.Add(equivalent); } } return(equivalentTDs); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { ObservableCollectionExt result = new ObservableCollectionExt(); string type = null; int i; while (reader.Read()) { if (reader.TokenType == JsonToken.PropertyName) { type = reader.Value.ToString(); } else if (reader.TokenType == JsonToken.EndObject) { return(result); } else if (!string.IsNullOrEmpty(type) && reader.Value != null) { switch (type) { case "mydata1": { result.MyData1 = reader.Value.ToString(); break; } case "mydata2": { result.MyData2 = reader.Value.ToString(); break; } case "elements": { if (int.TryParse(reader.Value.ToString(), out i)) { result.Add(i); } break; } } } } return(result); }
private void PreviewWorkerDoWork(object sender, DoWorkEventArgs e) { List <string> regExList = new List <string>(); const int maxCount = 100; object[] args = (object[])e.Argument; RegularExpression passwordIterator = (RegularExpression)args[0]; int maxRows = (int)args[1]; string currentPassword = passwordIterator.GetNextPassword(); while (!string.IsNullOrEmpty(currentPassword) && !previewBackgroundWorker.CancellationPending && passwordIterator.Progress < maxRows) { regExList.Add(currentPassword); currentPassword = passwordIterator.GetNextPassword(); if (string.IsNullOrEmpty(currentPassword) || regExList.Count > maxCount || passwordIterator.Progress >= maxRows) { App.Current.Dispatcher.Invoke(delegate { RegExMatches.BeginUpdate(); foreach (string regEx in regExList) { RegExMatches.Add(regEx); } RegExMatches.EndUpdate(); }); regExList.Clear(); } } if (previewBackgroundWorker.CancellationPending) { e.Cancel = true; } else { e.Result = passwordIterator.Progress; } }
private void DisplayListPokemons(List <PokemonId> affectToPokemons) { pokemonList = new ObservableCollectionExt <AffectPokemonViewModel>(); foreach (var item in Enum.GetValues(typeof(PokemonId))) { if ((PokemonId)item == PokemonId.Missingno) { continue; } pokemonList.Add(new AffectPokemonViewModel() { Pokemon = (PokemonId)item, Selected = affectToPokemons != null && affectToPokemons.Contains((PokemonId)item) }); } lslAllPokemons.ItemsSource = pokemonList; }
private void ComboBoxTypeCours_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBox comboBox = sender as ComboBox; TypeCours typeCoursSelectionne = (TypeCours)comboBox.SelectedItem; if (typeCoursSelectionne.Id == -1) { typeCoursSelectionne.Nom = "Nouveau type de cours"; TypeCours.create(typeCoursSelectionne); infosAssignationSelect.TypeCours = typeCoursSelectionne; InfosAssignation.update(infosAssignationSelect.Id, infosAssignationSelect); tCs.Add(new TypeCours { Nom = "Créer un type de cours...", Groupes = 1 }); } else { infosAssignationSelect.TypeCours = typeCoursSelectionne; InfosAssignation.update(infosAssignationSelect.Id, infosAssignationSelect); } }
private void ComboBoxCategorie_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBox comboBox = sender as ComboBox; categorieSelectionne = (Categorie)comboBox.SelectedItem; if (categorieSelectionne != null && categorieSelectionne.Id == -1) { categorieSelectionne.Nom = "Nouvelle catégorie"; categorie.create(categorieSelectionne); enseignantSelectionne.Categorie = categorieSelectionne; enseignant.update(enseignantSelectionne.Id, enseignantSelectionne); categories.Add(new Categorie { Nom = "Créer une catégorie...", Heures = 0 }); } else { equivalentTDs.Replace(GetEquivalentTDs(categorieSelectionne)); enseignantSelectionne.Categorie = categorieSelectionne; enseignant.update(enseignantSelectionne.Id, enseignantSelectionne); } }
private ObservableCollectionExt <ObjetBase> GetAnnees(int idDepartement) { ObservableCollectionExt <ObjetBase> annees = new ObservableCollectionExt <ObjetBase>(); foreach (Annee annee in annee.findAll()) { if (idDepartement == annee._departement.Id) { Annee nodeAnnee = new Annee { Visibility = true, Id = annee.Id, Nom = annee.Nom.TrimEnd(), Description = annee._description, NavigationDestination = typeof(AnneeVue), Departement = annee.Departement, ListView = enseignants }; annees.Add(nodeAnnee); foreach (PartieAnnee partieAnnee in partieAnnee.findAll()) { if (annee.Id == partieAnnee.Annee.Id) { PartieAnnee nodePartieAnnee = new PartieAnnee { Visibility = true, Id = partieAnnee.Id, Nom = partieAnnee.Nom.TrimEnd(), Description = partieAnnee.Description, Annee = annee, Parent = nodeAnnee, NavigationDestination = typeof(PartieAnneeVue), ListView = enseignants }; nodeAnnee.Children.Add(nodePartieAnnee); foreach (Enseignement enseignement in enseignement.findAll()) { if (partieAnnee.Id == enseignement.PartieAnnee.Id) { Enseignement nodeEnseignement = new Enseignement { Visibility = true, Id = enseignement.Id, Nom = enseignement.Nom.TrimEnd(), PartieAnnee = partieAnnee, Description = enseignement.Description, Parent = nodePartieAnnee, NavigationDestination = typeof(EnseignementVue), ListView = enseignants }; nodePartieAnnee.Children.Add(nodeEnseignement); } } } } } } return(annees); }
private void ComboBoxTypeCours_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBox comboBox = sender as ComboBox; typeCoursSelectionne = (TypeCours)comboBox.SelectedItem; if (typeCoursSelectionne.Id == -1) { typeCoursSelectionne.Nom = "Nouveau type de cours"; typeCours.create(typeCoursSelectionne); equivalentTDSelectionne.TypeCours = typeCoursSelectionne; equivalentTD.update(equivalentTDSelectionne.Id, equivalentTDSelectionne); tCs.Add(new TypeCours { Nom = "Créer un type de cours...", Groupes = 1 }); } else { equivalentTDSelectionne.TypeCours = typeCoursSelectionne; equivalentTD.update(equivalentTDSelectionne.Id, equivalentTDSelectionne); } service.Heures = GetHeures(); service.Information = GetInformation(service.Heures); }
private ObservableCollectionExt <Enseignement> GetEnseignementsAssignes() { ObservableCollectionExt <Enseignement> enseignementsAssignes = new ObservableCollectionExt <Enseignement>(); foreach (InfosAssignation infoAssignation in infoAssignations.findAll()) { if (!(infoAssignation.Enseignant is null) && infoAssignation.Enseignant.Id == enseignantSelectionne.Id) { foreach (EC ec in eC.findAll()) { if (infoAssignation.EC.Id == ec.Id && !enseignementsAssignes.Any(a => a.Id == ec.Enseignement.Id)) { ObjetBase Annee = enseignantSelectionne.TreeView.Where(x => x.Id == annee.find(ec.Enseignement.PartieAnnee.Annee.Id).Id).FirstOrDefault(); ObjetBase PartieAnnee = Annee.Children.Where(x => x.Id == partieAnnee.find(ec.Enseignement.PartieAnnee.Id).Id).FirstOrDefault(); ObjetBase Enseignement = PartieAnnee.Children.Where(x => x.Id == ec.Enseignement.Id).FirstOrDefault(); enseignementsAssignes.Add((Enseignement)Enseignement); } } } } return(enseignementsAssignes); }