void toolStripPourcentage_OnValideSaisie(object sender, EventArgs e) { CToolStripPourcentage pct = sender as CToolStripPourcentage; CRelationBesoin_Satisfaction rel = pct != null ? pct.Tag as CRelationBesoin_Satisfaction : null; if (rel != null && pct.Value != null) { if (CFormAlerte.Afficher(I.T("Change repartition for '@1' uses '@2'% of '@3' cost ?|20687", rel.Besoin.LibelleComplet, pct.Value.Value.ToString("0.##"), rel.Satisfaction.Libelle), EFormAlerteBoutons.OuiNon, EFormAlerteType.Question) == DialogResult.Yes) { bool bCommit = false; if (rel.ContexteDonnee.ContextePrincipal == null) { bCommit = true; rel.BeginEdit(); } CUtilSatisfaction.SetPourcentageFor(rel.Besoin, rel.Satisfaction, pct.Value.Value); if (bCommit) { CResultAErreur result = rel.CommitEdit(); if (!result) { CFormAlerte.Afficher(result.Erreur); } } Refresh(); } } }
//----------------------------------------------------- private void m_panelDessin_MouseUp(object sender, MouseEventArgs e) { m_panelDessin.Capture = false; m_panelDessin.Cursor = Cursors.Arrow; m_ptStartScroll = null; if (e.Button == MouseButtons.Right && !m_bHasScroll) { DoSelection(new Point(e.X, e.Y), true); if (m_satisfactionSel != null) { m_menuSatisfaction.Show(m_panelDessin, new Point(e.X, e.Y)); } else if (m_lienSel != null) { ContextMenuStrip strip = new ContextMenuStrip(); double fPct = CUtilSatisfaction.GetPourcentageFor(m_lienSel.Besoin, m_lienSel.Satisfaction); CToolStripPourcentage toolStripPourcentage = new CToolStripPourcentage(fPct); toolStripPourcentage.OnValideSaisie += new EventHandler(toolStripPourcentage_OnValideSaisie); toolStripPourcentage.Tag = m_lienSel; strip.Items.Add(toolStripPourcentage); strip.Show(this, new Point(e.X, e.Y)); } } if (m_satisfactionSel != null) { CDessinSatisfaction dessin = m_baseMap.GetDessin(m_satisfactionSel); { Point pt = PointToLogical(new Point(e.X, e.Y)); dessin.OnMouseUp(this, pt); } } Cursor = Cursors.Arrow; }