private void UpdateZOrder(ActivityDesigner activityDesigner, ZOrder zorder)
        {
            IDesignerHost       service     = base.GetService(typeof(IDesignerHost)) as IDesignerHost;
            DesignerTransaction transaction = null;

            if (service != null)
            {
                transaction = service.CreateTransaction(DR.GetString("ZOrderUndoDescription", new object[] { activityDesigner.Text }));
            }
            try
            {
                bool flag = false;
                CompositeActivityDesigner parentDesigner = this;
                ActivityDesigner          designer2      = activityDesigner;
                while ((parentDesigner != null) && (designer2 != null))
                {
                    if (parentDesigner is FreeformActivityDesigner)
                    {
                        ReadOnlyCollection <ActivityDesigner> containedDesigners = parentDesigner.ContainedDesigners;
                        if ((containedDesigners.Count > 1) && (containedDesigners[(zorder == ZOrder.Background) ? 0 : (containedDesigners.Count - 1)] != designer2))
                        {
                            int connector = (zorder == ZOrder.Background) ? 0 : containedDesigners.Count;
                            parentDesigner.MoveActivities(new ConnectorHitTestInfo(this, HitTestLocations.Designer, connector), new List <Activity>(new Activity[] { designer2.Activity }).AsReadOnly());
                            flag = true;
                        }
                    }
                    designer2      = parentDesigner;
                    parentDesigner = parentDesigner.ParentDesigner;
                }
                if (flag)
                {
                    base.Invalidate();
                }
                if (transaction != null)
                {
                    transaction.Commit();
                }
            }
            catch (Exception exception)
            {
                if (transaction != null)
                {
                    transaction.Cancel();
                }
                throw exception;
            }
        }