Beispiel #1
0
        private void m_btnPaste_Click(object sender, EventArgs e)
        {
            if (m_extModeEdition.ModeEdition && m_editeurActif != null && m_editeurActif.CurrentGenerator != null)
            {
                IMapItemGenerator generator = m_editeurActif.CurrentGenerator;
                I2iSerializable   pasted    = null;
                CResultAErreur    result    = CSerializerObjetInClipBoard.Paste(ref pasted, generator.GetType().ToString());
                if (!result)
                {
                    CFormAlerte.Afficher(result);
                }
                else
                {
                    if (MessageBox.Show(I.T("Replace current setup ?|20049"),
                                        "",
                                        MessageBoxButtons.YesNo,
                                        MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        //Trouve l'item
                        foreach (ListViewItem item in m_wndListeItems.Items)
                        {
                            if (item.Tag == generator)
                            {
                                IMapItemGenerator newGenerator = (IMapItemGenerator)pasted;
                                newGenerator.Generator = m_mapDatabaseGenerator;

                                FillItemGenerator(item, newGenerator);
                                m_editeurActif.InitChamps(newGenerator);
                                break;
                            }
                        }
                    }
                }
            }
        }
Beispiel #2
0
 //--------------------------------------------------------------------------
 private void EditeItemGenerator(IMapItemGenerator generator)
 {
     try
     {
         m_panelEditeGenerator.SuspendDrawing();
         m_panelCopierColler.Visible = false;
         if (m_editeurActif != null)
         {
             m_editeurActif.MajChamps();
             UpdateItemsGenerator();
         }
         m_editeurActif = null;
         foreach (Control ctrlToHide in m_panelEditeGenerator.Controls)
         {
             ctrlToHide.Visible = false;
         }
         if (generator == null)
         {
             return;
         }
         IControleEditeMapItem ctrl = null;
         if (!m_dicControlesAlloues.TryGetValue(generator.GetType(), out ctrl))
         {
             ctrl = CAllocateurInterfaceMapItemGenerator.GetNewControle(generator);
             if (ctrl != null)
             {
                 CWin32Traducteur.Translate(ctrl);
                 m_panelEditeGenerator.Controls.Add(ctrl as Control);
                 ((Control)ctrl).Dock = DockStyle.Fill;
                 m_dicControlesAlloues.Add(generator.GetType(), ctrl);
             }
         }
         if (ctrl != null)
         {
             m_panelCopierColler.Visible = true;
             ((Control)ctrl).Visible     = true;
             ((IControlALockEdition)ctrl).LockEdition = LockEdition;
             ctrl.InitChamps(generator);
             m_editeurActif = ctrl;
         }
     }
     finally
     {
         m_panelEditeGenerator.ResumeDrawing();
     }
 }