Ejemplo n.º 1
0
        //---------------------------------------------------
        protected void DrawAffectationIcon(CContextDessinObjetGraphique contexte, CWorkflowEtapeDessin etape, Point pt)
        {
            Image img = IsBlocAInterfaceUtilisateur?Resource1._1346459174_group_alerte:Resource1._1346459174_group;

            contexte.Graphic.DrawImageUnscaled(img, pt);
        }
Ejemplo n.º 2
0
        //---------------------------------------------------
        protected override void MyDraw(CContextDessinObjetGraphique contexte, CWorkflowEtapeDessin donneesDessin)
        {
            Rectangle rct = donneesDessin.RectangleAbsolu;
            Brush     br  = new SolidBrush(Color.FromArgb(64, 0, 0, 0));

            rct.Size = new Size(rct.Width - 4, rct.Height - 4);
            contexte.Graphic.FillRectangle(br,
                                           rct.Left + 4,
                                           rct.Top + 4,
                                           rct.Width,
                                           rct.Height);

            br.Dispose();
            br = new SolidBrush(donneesDessin.BackColor);
            Pen  pen = new Pen(donneesDessin.ForeColor);
            Font ft  = donneesDessin.Font;

            if (ft == null)
            {
                ft = new Font("Arial", 8);
            }

            contexte.Graphic.FillRectangle(br, rct);
            contexte.Graphic.DrawRectangle(pen, rct);
            if (rct.Size.Width > BlocImage.Size.Width &&
                rct.Size.Height > BlocImage.Size.Height)
            {
                contexte.Graphic.DrawImage(BlocImage, new Point(rct.Left, rct.Top));
                Brush brTrans = new SolidBrush(Color.FromArgb(128, donneesDessin.BackColor));
                contexte.Graphic.FillRectangle(brTrans, rct.Left, rct.Top,
                                               BlocImage.Width,
                                               BlocImage.Height);
                brTrans.Dispose();
            }
            Image img = TypeEtape == null || TypeEtape.ParametresInitialisation.Affectations.Formules.Count() == 0 ?
                        Resource1._1346459174_group_alerte:
                        Resource1._1346459174_group;

            if (rct.Size.Width > img.Width &&
                rct.Size.Height > img.Height)
            {
                contexte.Graphic.DrawImage(img, new Rectangle(rct.Right - img.Width, rct.Top, img.Width, img.Height));
            }

            if (m_parametreDeclencheurStop != null)
            {
                img = Resource1.stop_sign;
                if (rct.Width > 32 && rct.Height > 32)
                {
                    contexte.Graphic.DrawImage(img, new Rectangle(rct.Right - img.Width, rct.Bottom - img.Width, img.Width, img.Height));
                }
            }



            if (TypeEtape != null && ft != null)
            {
                br.Dispose();
                br = new SolidBrush(donneesDessin.ForeColor);
                StringFormat sf = new StringFormat();
                sf.Alignment     = StringAlignment.Center;
                sf.LineAlignment = StringAlignment.Center;
                contexte.Graphic.DrawString(TypeEtape.Libelle, ft, br, rct, sf);
                sf.Dispose();
            }
            if (donneesDessin.Font == null)
            {
                ft.Dispose();
            }
            pen.Dispose();
            br.Dispose();
        }
Ejemplo n.º 3
0
        //---------------------------------------------------
        protected override void MyDraw(CContextDessinObjetGraphique contexte, CWorkflowEtapeDessin donneesDessin)
        {
            Rectangle rct = donneesDessin.RectangleAbsolu;
            Brush     br  = new SolidBrush(Color.FromArgb(64, 0, 0, 0));

            rct.Size = new Size(rct.Width - 4, rct.Height - 4);
            contexte.Graphic.FillRectangle(br,
                                           rct.Left + 4,
                                           rct.Top + 4,
                                           rct.Width,
                                           rct.Height);

            br.Dispose();
            br = new SolidBrush(donneesDessin.BackColor);
            Pen  pen = new Pen(donneesDessin.ForeColor);
            Font ft  = donneesDessin.Font;

            if (ft == null)
            {
                ft = new Font("Arial", 8);
            }

            contexte.Graphic.FillRectangle(br, rct);
            contexte.Graphic.DrawRectangle(pen, rct);



            if (rct.Size.Width > BlocImage.Size.Width &&
                rct.Size.Height > BlocImage.Size.Height)
            {
                contexte.Graphic.DrawImage(BlocImage, new Point(rct.Left, rct.Top));
                Brush brTrans = new SolidBrush(Color.FromArgb(128, donneesDessin.BackColor));
                contexte.Graphic.FillRectangle(brTrans, rct.Left, rct.Top,
                                               BlocImage.Width,
                                               BlocImage.Height);
                brTrans.Dispose();
            }

            int       nSizeMarge = Math.Min(10, Math.Max(1, rct.Width / 10));
            Rectangle rctMarge   = new Rectangle(rct.Left, rct.Top,
                                                 nSizeMarge,
                                                 rct.Height);
            Brush brMarge = new SolidBrush(Color.FromArgb(64, 0, 0, 0));

            contexte.Graphic.FillRectangle(brMarge, rctMarge);
            rctMarge.Offset(rct.Width - nSizeMarge, 0);
            contexte.Graphic.FillRectangle(brMarge, rctMarge);
            brMarge.Dispose();

            if (TypeEtape != null && ft != null)
            {
                br.Dispose();
                br = new SolidBrush(donneesDessin.ForeColor);
                StringFormat sf = new StringFormat();
                sf.Alignment     = StringAlignment.Center;
                sf.LineAlignment = StringAlignment.Center;
                contexte.Graphic.DrawString(TypeEtape.Libelle, ft, br, rct, sf);
                sf.Dispose();
            }
            if (donneesDessin.Font == null)
            {
                ft.Dispose();
            }
            pen.Dispose();
            br.Dispose();
        }
Ejemplo n.º 4
0
        /// //////////////////////////////////////////////////
        protected override void Editeur_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
        {
            if (ObjetEdite == null)
            {
                return;
            }
            if (LockEdition)
            {
                return;
            }

            if (e.Data.GetDataPresent(typeof(CReferenceObjetDonnee)))
            {
                CReferenceObjetDonnee reference = e.Data.GetData(typeof(CReferenceObjetDonnee)) as CReferenceObjetDonnee;
                if (reference.TypeObjet == typeof(CModeleAffectationUtilisateurs))
                {
                    Point pt        = PointToClient(new Point(e.X, e.Y));
                    Point ptLogique = GetLogicalPointFromDisplay(pt);
                    CWorkflowEtapeDessin dessinEtape = ObjetEdite.SelectionnerElementDuDessus(ptLogique) as CWorkflowEtapeDessin;
                    if (dessinEtape != null)
                    {
                        CModeleAffectationUtilisateurs modele = reference.GetObjet(CSc2iWin32DataClient.ContexteCourant) as CModeleAffectationUtilisateurs;
                        if (modele != null)
                        {
                            CParametresAffectationEtape parametres = modele.ParametresAffectation;
                            if (parametres != null)
                            {
                                CParametresInitialisationEtape parametre = dessinEtape.Initializations;
                                CParametresAffectationEtape    parAff    = parametre.Affectations;
                                if (parAff != null)
                                {
                                    if (MessageBox.Show(I.T("Replace current assignments(Yes) or add new assignemnts(No) ?|20135"), "",
                                                        MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                                    {
                                        parAff = new CParametresAffectationEtape();
                                    }
                                    parAff.AddFormules(parametres.Formules);
                                    parametre.Affectations      = parAff;
                                    dessinEtape.Initializations = parametre;
                                    e.Effect = DragDropEffects.Link;
                                    Refresh();
                                    return;
                                }
                            }
                        }
                    }
                }
            }

            List <CDonneeDragDropObjetGraphique> datas = GetDragDropData(e.Data);

            if (datas == null || datas.Count == 0)
            {
                return;
            }

            List <I2iObjetGraphique> candidats = new List <I2iObjetGraphique>();

            foreach (CRectangleDragForObjetGraphique rct in RectsDrags)
            {
                candidats.Add(rct.ObjetGraphique);
            }

            Point             ptLocal = GetLogicalPointFromDisplay(PointToClient(new Point(e.X, e.Y)));
            I2iObjetGraphique parent  = ObjetEdite.SelectionnerElementConteneurDuDessus(ptLocal, candidats);

            parent = DessinWorkflow;;
            if (parent == null)
            {
                e.Effect = DragDropEffects.None;
            }
            else
            {
                List <I2iObjetGraphique> nouveaux = new List <I2iObjetGraphique>();
                foreach (CRectangleDragForObjetGraphique rct in RectsDrags)
                {
                    rct.RectangleDrag = rct.Datas.GetDragDropPosition(ptLocal);
                    rct.RectangleDrag = GetRectangleSelonModesActives(rct.RectangleDrag, ptLocal);
                    // rct.RectangleDrag.Offset((int)(AutoScrollPosition.X / Echelle), (int)(AutoScrollPosition.Y / Echelle));

                    //Si dummy de création (type de bloc), création d'une nouvelle étape
                    I2iObjetGraphique objetGraphique = rct.Datas.ObjetDragDrop;
                    CDummyObjetWorkflowPourCreation dummyCreation = objetGraphique as CDummyObjetWorkflowPourCreation;
                    if (dummyCreation != null)
                    {
                        CTypeEtapeWorkflow typeEtape = dummyCreation.TypeEtape;
                        if (typeEtape == null)
                        {
                            typeEtape = new CTypeEtapeWorkflow(DessinWorkflow.TypeWorkflow.ContexteDonnee);
                            typeEtape.CreateNewInCurrentContexte();
                            typeEtape.Workflow = DessinWorkflow.TypeWorkflow;
                            typeEtape.Bloc     = Activator.CreateInstance(dummyCreation.TypeBloc, new object[] { typeEtape }) as CBlocWorkflow;
                        }
                        CWorkflowEtapeDessin graphEtape = new CWorkflowEtapeDessin();
                        graphEtape.TypeEtape = typeEtape;
                        objetGraphique       = graphEtape;
                        objetGraphique.Size  = dummyCreation.Size;
                    }

                    JusteBeforePositionneSurApresDragDrop(objetGraphique);
                    bool bParentIsInSelec = objetGraphique.Parent != null && candidats.Contains(objetGraphique.Parent);

                    bool bHasMove = false;

                    if (e.Effect == DragDropEffects.Copy)
                    {
                        Dictionary <Type, object> dicObjetsPourCloner = new Dictionary <Type, object>();
                        AddObjectsForClonerSerializer(dicObjetsPourCloner);
                        objetGraphique = (I2iObjetGraphique)objetGraphique.GetCloneAMettreDansParent(parent, dicObjetsPourCloner);

                        if (objetGraphique == null || !parent.AddChild(objetGraphique))
                        {
                            e.Effect = DragDropEffects.None;
                            objetGraphique.CancelClone();
                            continue;
                        }
                        else
                        {
                            objetGraphique.Parent = parent;
                            nouveaux.Add(objetGraphique);
                        }
                        bHasMove = true;
                    }
                    else
                    {
                        bHasMove = true;
                        if (objetGraphique.Parent != parent)
                        {
                            if (objetGraphique.Parent != null)
                            {
                                if (!bParentIsInSelec)
                                {
                                    objetGraphique.Parent.RemoveChild(objetGraphique);
                                }
                            }
                            else
                            {
                                nouveaux.Add(objetGraphique);
                            }
                            if (!bParentIsInSelec)
                            {
                                if (!parent.AddChild(objetGraphique))
                                {
                                    e.Effect = DragDropEffects.None;
                                    continue;
                                }
                                else
                                {
                                    objetGraphique.Parent = parent;
                                }
                            }
                        }
                    }


                    if (!bParentIsInSelec && bHasMove)
                    {
                        Point ptDrop = new Point(rct.RectangleDrag.Left, rct.RectangleDrag.Top);
                        objetGraphique.PositionAbsolue = ptDrop;
                    }
                }
                if (nouveaux.Count > 0)
                {
                    RefreshSelectionChanged = false;
                    Selection.Clear();
                    Selection.AddRange(nouveaux);
                    RefreshSelectionChanged = true;
                    DeclencheAfterAddElements(nouveaux);
                    Refresh();
                }
            }


            ElementModifie();
            EnDeplacement = false;
            Dessiner(true, true);
        }
Ejemplo n.º 5
0
        //-------------------------------------------------------------------
        private void m_menuEditWorkflow_Click(object sender, EventArgs e)
        {
            CWorkflowEtapeDessin etape = EtapeSelectionnee;

            if (etape == null)
            {
                return;
            }
            CBlocWorkflowWorkflow blocwkf = etape != null && etape.TypeEtape != null ?
                                            etape.TypeEtape.Bloc as CBlocWorkflowWorkflow : null;

            if (blocwkf != null)
            {
                CReferenceTypeForm refFrm = CFormFinder.GetRefFormToEdit(typeof(CTypeWorkflow));
                if (refFrm != null)
                {
                    CTypeWorkflow typeWorkflow = null;
                    if (blocwkf.DbKeyTypeWorkflow == null)
                    {
                        if (!LockEdition)
                        {
                            typeWorkflow = new CTypeWorkflow(CSc2iWin32DataClient.ContexteCourant);
                            typeWorkflow.CreateNew();
                            typeWorkflow.Libelle = blocwkf.TypeEtape.Libelle;
                        }
                    }
                    else
                    {
                        typeWorkflow = new CTypeWorkflow(CSc2iWin32DataClient.ContexteCourant);
                        if (!typeWorkflow.ReadIfExists(blocwkf.DbKeyTypeWorkflow))
                        {
                            typeWorkflow = null;
                        }
                    }
                    if (typeWorkflow != null)
                    {
                        CFormNavigateur navigateur = null;
                        if (LockEdition)
                        {
                            Form frm = FindForm();
                            if (frm != null)
                            {
                                Control ctrl = frm.Parent;
                                while (ctrl != null && ctrl.Parent != null && !(ctrl is CFormNavigateur))
                                {
                                    ctrl = ctrl.Parent;
                                }
                                if (typeof(CFormNavigateur).IsAssignableFrom(ctrl.GetType()))
                                {
                                    navigateur = (CFormNavigateur)ctrl;
                                }
                            }
                        }
                        CFormEditionStandard frmEdition = refFrm.GetForm(typeWorkflow) as CFormEditionStandard;
                        if (navigateur == null && frmEdition != null)
                        {
                            CFormNavigateurPopup.Show(frmEdition);
                            if (!LockEdition && typeWorkflow.IsValide() && typeWorkflow.Id >= 0)
                            {
                                blocwkf.DbKeyTypeWorkflow = typeWorkflow.DbKey;
                                etape.TypeEtape.Bloc      = blocwkf;
                            }
                        }
                        else
                        {
                            navigateur.AffichePage(frmEdition);
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
        //---------------------------------------------------
        protected override void MyDraw(CContextDessinObjetGraphique contexte, CWorkflowEtapeDessin donneesDessin)
        {
            NormalizeSize(donneesDessin);
            Rectangle rct = donneesDessin.RectangleAbsolu;
            Brush     br  = new SolidBrush(Color.FromArgb(64, 0, 0, 0));

            rct.Size = new Size(rct.Width - 4, rct.Height - 4);
            Region       rgn  = new Region();
            GraphicsPath path = new GraphicsPath();



            path.AddLine(rct.Left + rct.Height / 2, rct.Top,
                         rct.Right - rct.Height / 2, rct.Top);
            path.AddArc(rct.Right - rct.Height, rct.Top, rct.Height, rct.Height,
                        -90, 180);
            path.AddLine(rct.Right - rct.Height / 2, rct.Bottom,
                         rct.Left + rct.Height / 2, rct.Bottom);
            path.AddArc(rct.Left, rct.Top, rct.Height, rct.Height,
                        90, 180);

            Matrix mat = new Matrix();

            mat.Translate(4, 4);
            path.Transform(mat);
            mat.Dispose();
            contexte.Graphic.FillPath(br, path);
            br.Dispose();

            mat = new Matrix();
            mat.Translate(-4, -4);
            path.Transform(mat);
            mat.Dispose();

            br = new SolidBrush(donneesDessin.BackColor);
            Pen  pen = new Pen(donneesDessin.ForeColor);
            Font ft  = donneesDessin.Font;

            if (ft == null)
            {
                ft = new Font("Arial", 8);
            }

            contexte.Graphic.FillPath(br, path);
            contexte.Graphic.DrawPath(pen, path);

            /*if (rct.Size.Width > BlocImage.Size.Width &&
             *  rct.Size.Height > BlocImage.Size.Height )
             * {
             *  contexte.Graphic.DrawImage(BlocImage, new Point(rct.Left, rct.Top));
             *  Brush brTrans = new SolidBrush(Color.FromArgb(128, donneesDessin.BackColor));
             *  contexte.Graphic.FillRectangle(brTrans, rct.Left, rct.Top,
             *      BlocImage.Width,
             *      BlocImage.Height);
             *  brTrans.Dispose();
             * }*/
            path.Dispose();

            if (TypeEtape != null && ft != null)
            {
                br.Dispose();
                br = new SolidBrush(donneesDessin.ForeColor);
                StringFormat sf = new StringFormat();
                sf.Alignment     = StringAlignment.Center;
                sf.LineAlignment = StringAlignment.Center;
                contexte.Graphic.DrawString(TypeEtape.Libelle, ft, br, rct, sf);
                sf.Dispose();
            }
            if (donneesDessin.Font == null)
            {
                ft.Dispose();
            }
            pen.Dispose();
            br.Dispose();
        }