private void ClearClasses_Click(object sender, EventArgs e) { for (int i = 0; i < ListClasses.Items.Count; i++) { ListClasses.SetItemChecked(i, false); } }
private void ToggleClasses_Click(object sender, EventArgs e) { for (int i = 0; i < ListClasses.Items.Count; i++) { ListClasses.SetItemChecked(i, !ListClasses.GetItemChecked(i)); } }
/// <summary> /// Code ajouté lors de la création d'une action /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ListClasses_ItemToCreate(object sender, EventArgs e) { VO_Class newItem = _Service.CreateClass(); ListClasses.AddItem(newItem.Id, newItem.Title); LoadClass(newItem.Id); }
/// <summary> /// Lors de l'edit du titre /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtName_TextChanged(object sender, EventArgs e) { if (ListClasses.ChangeItemName(CurrentClass.Id, txtName.Text)) { CurrentClass.Title = txtName.Text; } else { txtName.Text = CurrentClass.Title; MessageBox.Show(Errors.ERROR_UNIQUE_TITLE, Errors.ERROR_BOX_TITLE); } }
public void ListClassesBehaviorTest() { ListClasses listClasses = new ListClasses(); listClasses.ListClassesName = new string[] { "Fire", "Water" }; StackPanel stkPnl = (listClasses as UserControl).Content as StackPanel; if (stkPnl != null) { Assert.IsTrue(stkPnl.Children.Count == 2); } }
public async Task DeleteClasse(int id) { try { Classe classroom = await ApiManager.Instance.DeleteClassroomById(id); ListClasses.Remove(classroom); } catch (Exception ex) { AlertError.ShowErrorAlert(ex.Message); } }
private void AddClasses() { var listClasses = tEntity.tClasses.ToList(); foreach (var cl in listClasses) { var listDivisions = tEntity.tBatchClassSections.Where(t => t.csc_ClassId == cl.cla_id).Select(t => new Division { Id = t.csc_SectionId, Name = t.tSection.sec_SectionName }).ToList(); ListClasses.Add(new Class { Id = cl.cla_id, Name = cl.cla_Name, ListDivisions = listDivisions }); } }
/// <summary> /// Survient lorsque le formulaire devient visible /// </summary> public void InitializeDBClasses() { CurrentClass = null; ProvisionList(); if (ListClasses.DataSource.Count > 0) { Guid firstAction = ListClasses.DataSource[0].Id; ListClasses.SelectItem(firstAction); LoadClass(firstAction); } else { ListClasses_ListIsEmpty(this, new EventArgs()); } }
// ============================================================================= #region Classes public async Task AddClasse(ClasseAdded c) { try { if (ListClasses.FirstOrDefault(x => x.Nom == c.Nom) != null) { throw new Exception("Une classe avec ce nom existe déjà !"); } Classe classroom = await ApiManager.Instance.AddClassroom(c); ListClasses.Add(classroom); } catch (Exception ex) { AlertError.ShowErrorAlert(ex.Message); } }
private void btnSelect_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() != DialogResult.OK) { return; } txtPath.Text = openFileDialog1.FileName; // Cerco tutte le classi che implementano IJeepModule var myAssembly = Assembly.LoadFrom(txtPath.Text); var classes = myAssembly.GetTypes().Where(m => m.IsClass && m.GetInterface("IJeepModule") != null); try { foreach (var item in classes) { ListClasses.Items.Add(item); } if (ListClasses.Items.Count == 1) { ListClasses.SetItemChecked(0, true); } var parameters = myAssembly.GetTypes().Where(m => m.IsClass && m.GetInterface("IJeepParameter") != null); foreach (var item in parameters) { ListParameters.Items.Add(item); } if (ListParameters.Items.Count == 1) { ListParameters.SetItemChecked(0, true); } } catch (Exception ex) { MessageBox.Show("Errore in caricamento Classi automatico: " + ex.Message); } }
public void CreateData() { try { #region Activites Activite act1 = new Activite() { Id = 1, Libelle = "Echecs", NomIntervenant = "", PrenomIntervenant = "", PathBackground = @"Res\echecBg.jpg", }; Activite act2 = new Activite() { Id = 2, Libelle = "Musique", NomIntervenant = "", PrenomIntervenant = "", PathBackground = @"Res\musiqueBg.jpg", Id_LinkedActivity = 3, }; Activite act3 = new Activite() { Id = 3, Libelle = "Musique Chorale", NomIntervenant = "", PrenomIntervenant = "", PathBackground = @"Res\choraleBg.jpg", Id_LinkedActivity = 2, }; Activite act4 = new Activite() { Id = 4, Libelle = "Pastorale", NomIntervenant = " ", PrenomIntervenant = " ", PathBackground = @"Res\pastoraleBg.jpg", }; Activite act5 = new Activite() { Id = 5, Libelle = "Bibliothèque", NomIntervenant = " ", PrenomIntervenant = " ", PathBackground = @"Res\biblioBg.jpg", Id_LinkedActivity = 6, }; Activite act6 = new Activite() { Id = 6, Libelle = "Informatique", NomIntervenant = " ", PrenomIntervenant = " ", PathBackground = @"Res\infoBg.jpg", Id_LinkedActivity = 5, }; Activite act7 = new Activite() { Id = 7, Libelle = "Sport", NomIntervenant = " ", PrenomIntervenant = " ", PathBackground = @"Res\sportBg.jpg", }; Activite act8 = new Activite() { Id = 8, Libelle = "Anglais", NomIntervenant = " ", PrenomIntervenant = " ", PathBackground = @"Res\anglaisBg.jpg", }; Activite act9 = new Activite() { Id = 9, Libelle = "Histoire", NomIntervenant = " ", PrenomIntervenant = " ", PathBackground = @"Res\histoireBg.jpg", }; Activite act10 = new Activite() { Id = 10, Libelle = "Autre", NomIntervenant = " ", PrenomIntervenant = " ", PathBackground = @"Res\autreBg.jpg", }; ListActivites.Add(act1); ListActivites.Add(act2); ListActivites.Add(act3); ListActivites.Add(act4); ListActivites.Add(act5); ListActivites.Add(act6); ListActivites.Add(act7); ListActivites.Add(act8); ListActivites.Add(act9); ListActivites.Add(act10); #endregion BrushConverter brushConverter = new BrushConverter(); #region Classes Classe cl1 = new Classe() { Id = 1, Libelle = "PS/MS", NomProfesseur = " ", PrenomProfesseur = "Axelle & Chantal", BackgroundColor = (SolidColorBrush)brushConverter.ConvertFrom("#80ffbf") }; Classe cl2 = new Classe() { Id = 2, Libelle = "MS/GS", NomProfesseur = " ", PrenomProfesseur = "Cassandra & Sylvie", BackgroundColor = (SolidColorBrush)brushConverter.ConvertFrom("#ffe680") }; Classe cl3 = new Classe() { Id = 3, Libelle = "GS/CP", NomProfesseur = " ", PrenomProfesseur = "Virginie", BackgroundColor = (SolidColorBrush)brushConverter.ConvertFrom("#EE607B") }; Classe cl4 = new Classe() { Id = 4, Libelle = "CP/CE1", NomProfesseur = " ", PrenomProfesseur = "Caroline", BackgroundColor = (SolidColorBrush)brushConverter.ConvertFrom("#00cccc") }; Classe cl5 = new Classe() { Id = 5, Libelle = "CE1/CE2", NomProfesseur = " ", PrenomProfesseur = "Nathalie", BackgroundColor = (SolidColorBrush)brushConverter.ConvertFrom("#8080ff") }; Classe cl6 = new Classe() { Id = 6, Libelle = "CE2/CM1", NomProfesseur = " ", PrenomProfesseur = "Laurence & Chantal", BackgroundColor = (SolidColorBrush)brushConverter.ConvertFrom("#d5ff80") }; Classe cl7 = new Classe() { Id = 7, Libelle = "CM1/CM2", NomProfesseur = " ", PrenomProfesseur = "Florent", BackgroundColor = (SolidColorBrush)brushConverter.ConvertFrom("#ff8080") }; Classe cl8 = new Classe() { Id = 8, Libelle = "CM2", NomProfesseur = " ", PrenomProfesseur = "Sophie", BackgroundColor = (SolidColorBrush)brushConverter.ConvertFrom("#80dfff") }; ListClasses.Add(cl1); ListClasses.Add(cl2); ListClasses.Add(cl3); ListClasses.Add(cl4); ListClasses.Add(cl5); ListClasses.Add(cl6); ListClasses.Add(cl7); ListClasses.Add(cl8); #endregion #region Duree DureeModel duree1 = new DureeModel() { Libelle = "30min", Minutes = 30, RowSpan = 2 }; DureeModel duree2 = new DureeModel() { Libelle = "45min", Minutes = 45, RowSpan = 3 }; DureeModel duree3 = new DureeModel() { Libelle = "1h", Minutes = 60, RowSpan = 4 }; DureeModel duree4 = new DureeModel() { Libelle = "1h30", Minutes = 90, RowSpan = 6 }; DureeModel duree5 = new DureeModel() { Libelle = "2h", Minutes = 120, RowSpan = 8 }; DureeAvailable.Add(duree1); DureeAvailable.Add(duree2); DureeAvailable.Add(duree3); DureeAvailable.Add(duree4); DureeAvailable.Add(duree5); #endregion #region Heures TimeSpan timeStart = new TimeSpan(8, 30, 0); TimeSpan timeEnd = new TimeSpan(16, 30, 0); for (TimeSpan time = new TimeSpan(8, 30, 0); time <= timeEnd; time = time.Add(new TimeSpan(0, 15, 0))) { //Pas les plages horaires entre 11h45 et 13h30 if (time != new TimeSpan(11, 45, 0) && time != new TimeSpan(12, 0, 0) && time != new TimeSpan(12, 15, 0) && time != new TimeSpan(12, 30, 0) && time != new TimeSpan(12, 45, 0) && time != new TimeSpan(13, 0, 0) && time != new TimeSpan(13, 15, 0)) { HoursAvailables.Add(new HourModel() { Time = time, Libelle = time.ToString("hh") + "H" + time.ToString("mm") }); } } #endregion StreamReader reader; string myJson; string folderSave = ConfigurationManager.AppSettings["FolderSaveJSON"].ToString(); // Chargement des créneaux reader = new StreamReader(folderSave + "listCreneauChoosed.json"); myJson = reader.ReadToEnd(); CalendarManager.Instance.ListCreneauChoosed = JsonConvert.DeserializeObject <List <Creneau> >(myJson); } catch (Exception ex) { string message = "Un problème est survenu lors du chargement des données ! \n \n" + ex; MessageBox.Show(message); } }
private void ButtonOK_Click(object sender, EventArgs e) { bool negate = false; // factions negate = ((ListFactions.CheckedItems.Count * 2) > ListFactions.Items.Count); for (int i = 0; i < ListFactions.Items.Count; i++) { if (ListFactions.GetItemChecked(i) != negate) { AllowedFactions.Add(ListFactions.Items[i].ToString()); } } NegateFactions = negate; // classes negate = ((ListClasses.CheckedItems.Count * 2) > ListClasses.Items.Count); for (int i = 0; i < ListClasses.Items.Count; i++) { if (ListClasses.GetItemChecked(i) != negate) { AllowedClasses.Add(ListClasses.Items[i].ToString()); } } NegateClasses = negate; // races negate = ((ListRaces.CheckedItems.Count * 2) > ListRaces.Items.Count); for (int i = 0; i < ListRaces.Items.Count; i++) { if (ListRaces.GetItemChecked(i) != negate) { AllowedRaces.Add(ListRaces.Items[i].ToString()); } } NegateRaces = negate; // rarities negate = ((ListRarities.CheckedItems.Count * 2) > ListRarities.Items.Count); for (int i = 0; i < ListRarities.Items.Count; i++) { if (ListRarities.GetItemChecked(i) != negate) { AllowedRarities.Add(ListRarities.Items[i].ToString()); } } NegateRarities = negate; // expansions negate = ((ListExpansions.CheckedItems.Count * 2) > ListExpansions.Items.Count); for (int i = 0; i < ListExpansions.Items.Count; i++) { if (ListExpansions.GetItemChecked(i) != negate) { AllowedExpansions.Add(ListExpansions.Items[i].ToString()); } } NegateExpansions = negate; Close(); }
/// <summary> /// Charge la liste de classes /// </summary> private void ProvisionList() { ListClasses.DataSource = _Service.ProvisionList(); ListClasses.LoadList(); }