//Suppression Item private void m_lnkSupprimerFormatNumerotation_LinkClicked(object sender, EventArgs e) { if (m_wndListeFormatNumerotation.SelectedItems.Count != 1) { return; } CRelationSystemeCoordonnees_FormatNumerotation rel = (CRelationSystemeCoordonnees_FormatNumerotation)m_wndListeFormatNumerotation.SelectedItems[0].Tag; int pos = rel.Position; m_gestionnaireEditionRelationSysCoorFormatNum.SetObjetEnCoursToNull(); CResultAErreur result = rel.Delete(); if (!result) { CFormAlerte.Afficher(result.Erreur); return; } //On met à jour les positions des éléments restant if (m_wndListeFormatNumerotation.SelectedItems.Count == 1) { if (m_wndListeFormatNumerotation.SelectedItems[0] != null) { m_wndListeFormatNumerotation.SelectedItems[0].Remove(); } while (pos <= m_wndListeFormatNumerotation.Items.Count - 1) { CRelationSystemeCoordonnees_FormatNumerotation reltmp = (CRelationSystemeCoordonnees_FormatNumerotation)m_wndListeFormatNumerotation.Items[pos].Tag; reltmp.Position = pos; pos++; } } }
//Ajout Item private void m_lnkAjouterNumerotation_LinkClicked(object sender, EventArgs e) { if (m_cmbFormatNumerotation.ElementSelectionne == null) { CFormAlerte.Afficher(I.T("Select a Numbering Format to add|1164"), EFormAlerteType.Exclamation); return; } CRelationSystemeCoordonnees_FormatNumerotation rel = new CRelationSystemeCoordonnees_FormatNumerotation(SystemeCoordonnees.ContexteDonnee); rel.CreateNewInCurrentContexte(); rel.FormatNumerotation = (CFormatNumerotation)m_cmbFormatNumerotation.ElementSelectionne; rel.SystemeDeCoordonnees = SystemeCoordonnees; rel.Position = m_wndListeFormatNumerotation.Items.Count; ListViewItem item = new ListViewItem(); m_wndListeFormatNumerotation.Items.Add(item); m_wndListeFormatNumerotation.UpdateItemWithObject(item, rel); foreach (ListViewItem itemSel in m_wndListeFormatNumerotation.SelectedItems) { itemSel.Selected = false; } item.Selected = true; }
private void m_ctrlMD_ApresRenumeration(object sender, EventArgs e) { if (m_wndListeFormatNumerotation.SelectedItems.Count != 1) { return; } CRelationSystemeCoordonnees_FormatNumerotation rel = (CRelationSystemeCoordonnees_FormatNumerotation)m_wndListeFormatNumerotation.SelectedItems[0].Tag; m_lblPositionCurrent.Text = rel.Position.ToString(); }
/// <summary> /// Initialise les champs au moment de l'édition /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void m_gestionnaireEditionRelationSysCoorFormatNum_InitChamp(object sender, CObjetDonneeResultEventArgs args) { if (args.Objet == null) { m_panelNumerotation.Visible = false; return; } CRelationSystemeCoordonnees_FormatNumerotation rel = (CRelationSystemeCoordonnees_FormatNumerotation)args.Objet; //m_lblPositionCurrent.Text = rel.Position.ToString(); m_panelNumerotation.Visible = true; m_cmbFormatNumerotation.ElementSelectionne = rel.FormatNumerotation; m_cmbUnite.ElementSelectionne = rel.Unite; m_lnkEditionRelationSysCoorFormatNum.FillDialogFromObjet(args.Objet); }
//----------------------------------------------------------- public void Init(bool bAvecEntete, CParametrageSystemeCoordonnees parametrage, CRelationSystemeCoordonnees_FormatNumerotation relFormat) { m_parametrageEdite = parametrage; m_relFormat = relFormat; if (m_relFormat == null) { Visible = false; } if (m_relFormat.FormatNumerotation == null) { Visible = false; } if (m_parametrageEdite == null) { Visible = false; } m_panelEntete.Visible = bAvecEntete; int nHeight = m_lblLibelle.Height; if (bAvecEntete) { nHeight += m_panelEntete.Height; } Size = new Size(Width, nHeight); m_lblLibelle.Text = m_relFormat.Libelle; CUniteCoordonnee unite = m_relFormat.Unite; if (unite != null) { m_lblUnite.Text = unite.Libelle; } else { m_lblUnite.Text = ""; } int nNiveau = m_relFormat.Position; CListeObjetsDonnees liste = m_parametrageEdite.RelationParametragesNiveau; m_parametrageNiveau = m_parametrageEdite.GetParametrageNiveau(m_relFormat.Position); CResultAErreur result = CResultAErreur.True; if (m_parametrageNiveau != null) { result = m_relFormat.FormatNumerotation.GetReference(m_parametrageNiveau.PremierIndice); if (result) { m_txtStartAt.Text = result.Data.ToString(); } m_numUpSize.IntValue = m_parametrageNiveau.Taille; } else { result = m_relFormat.FormatNumerotation.GetReference(0); if (result) { m_txtStartAt.Text = (string)result.Data; } else { m_txtStartAt.Text = ""; } m_numUpSize.IntValue = 10; } m_bIsInit = true; m_tooltip.SetToolTip(m_txtStartAt, m_relFormat.FormatNumerotation.Libelle); }