Пример #1
0
        protected void Edit_Click(object sender, EventArgs e)
        {
            if (valueControl.SelectedIndex >= 0)
            {
                int index = valueControl.SelectedIndex;
                using (XmlForm form = new XmlForm())
                {
                    form.LoadDefinition(this.ItemType, null);
                    form.Tag = this.FindForm().Tag;
                    form.Design("", page);
                    if ("ParameterItem" == this.ItemType)
                    {
                        form.AddGlobalData("ruleId", Parent.Parent.Controls[1].Controls[0].Controls[1].Text);
                    }
                    ListItemsObject dgo = (ListItemsObject)valueControl.Items[index];
                    form.SetShapeXml(String.Format("<properties>{0}</properties>", dgo.Column.InnerXml));
                    DialogResult result = form.ShowDialog(this);

                    if (result == DialogResult.OK)
                    {
                        XmlDocument xdoc = form.GetShapeXml(this.ItemName);

                        valueControl.Items[index] = new ListItemsObject(xdoc.DocumentElement, ComplexLabel, ComplexPattern, childPattern);
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the BaseShape class.
        /// </summary>
        /// <param name="shape">Visio shape on which it is based.</param>
        /// <param name="form">Form </param>
        /// <param name="attributes">Configuration attributes.</param>
        public BaseShape( object shape, XmlForm form, XmlElement attributes )
        {
            _shape = (Shape) shape;
            _form = form;
            _attributes = attributes;

            _element = _attributes.Attributes[ "element" ].Value;
            _type = (ModelShapeType) Enum.Parse( typeof( ModelShapeType ), _attributes.Attributes[ "type" ].Value, true );
        }
Пример #3
0
        private void Add_Click(object sender, EventArgs e)
        {
            if (valueControl.Items.Count < columnsXMax)
            {
                using (XmlForm form = new XmlForm())
                {
                    form.LoadDefinition(this.ItemType, null);
                    form.Tag = this.FindForm().Tag;
                    form.Design("", page);
                    if ("ParameterItem" == this.ItemType)
                    {
                        form.AddGlobalData("ruleId", Parent.Parent.Controls[3].Controls[0].Controls[1].Text);
                    }
                    DialogResult result = form.ShowDialog(this);

                    if (result == DialogResult.OK)
                    {
                        XmlDocument xdoc = form.GetShapeXml(this.ItemName);

                        valueControl.Items.Add(new ListItemsObject(xdoc.DocumentElement, ComplexLabel, ComplexPattern, childPattern));
                    }
                }
            }
        }
Пример #4
0
        /// <summary>
        /// Handles the marker events.
        /// </summary>
        /// <param name="context">Parsed event context.</param>
        private void HandleMarkerEvent(NameValueCollection context)
        {
            Shape shape = VisioUtils.GetShape(_application, context);

            if (shape == null)
                return;

            string shapeName = VisioUtils.GetProperty(shape, "User", "Midgard");

            if (shapeName == null)
            {
                // se for um visio desenhado com a versão antiga (sem os layers)
                shapeName = VisioUtils.GetShapeType(shape);
                if (shapeName == null)
                    return;
            }
            string command = context["cmd"];
            if (command == null)
                return;

            /*
             *
             */
            string mode = "live";// GetMode();

            using (XmlForm form = new XmlForm())
            {
                form.LoadDefinition(shapeName, shape);
                form.Design(mode, Application.ActivePage);

                IShapeHandler shapeHandler = (IShapeHandler)form.Tag;
                DisplaySettings newSettings = shapeHandler.Execute(command, context, _displaySettings, _forceFormChange);
                if (newSettings != null)
                    _displaySettings = newSettings;
            }
        }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the NodeShape class.
 /// </summary>
 public NodeShape( object shape, XmlForm form, XmlElement attributes )
     : base(shape, form, attributes)
 {
 }
Пример #6
0
        protected void Edit_Click(object sender, EventArgs e)
        {
            if (valueControl.SelectedIndex >= 0)
            {
                int index = valueControl.SelectedIndex;
                using (XmlForm form = new XmlForm())
                {
                    form.LoadDefinition(this.ItemType, null);
                    form.Tag = this.FindForm().Tag;
                    form.Design("", page);
                    if ("ParameterItem" == this.ItemType)
                        form.AddGlobalData("ruleId", Parent.Parent.Controls[1].Controls[0].Controls[1].Text);
                    ListItemsObject dgo = (ListItemsObject)valueControl.Items[index];
                    form.SetShapeXml(String.Format("<properties>{0}</properties>", dgo.Column.InnerXml));
                    DialogResult result = form.ShowDialog(this);

                    if (result == DialogResult.OK)
                    {
                        XmlDocument xdoc = form.GetShapeXml(this.ItemName);

                        valueControl.Items[index] = new ListItemsObject(xdoc.DocumentElement, ComplexLabel, ComplexPattern, childPattern);
                    }
                }
            }
        }
Пример #7
0
        private void Add_Click(object sender, EventArgs e)
        {
            if (valueControl.Items.Count < columnsXMax)
            {
                using (XmlForm form = new XmlForm())
                {
                    form.LoadDefinition(this.ItemType, null);
                    form.Tag = this.FindForm().Tag;
                    form.Design("", page);
                    if ("ParameterItem" == this.ItemType)
                        form.AddGlobalData("ruleId", Parent.Parent.Controls[3].Controls[0].Controls[1].Text);
                    DialogResult result = form.ShowDialog(this);

                    if (result == DialogResult.OK)
                    {
                        XmlDocument xdoc = form.GetShapeXml(this.ItemName);

                        valueControl.Items.Add(new ListItemsObject(xdoc.DocumentElement, ComplexLabel, ComplexPattern, childPattern));
                    }
                }
            }
        }
Пример #8
0
        private IShapeHandler GetShapeHandler(Hashtable dictionary, Shape shape, string shapeName, string mode)
        {
            IShapeHandler shapeHandler = (IShapeHandler)dictionary[shape];

            if (shapeHandler != null)
                return shapeHandler;

            XmlForm form = new XmlForm();
            form.LoadDefinition(shapeName, shape);
            form.SkipDesign = _skip;

            if (!_skip)
                form.Design(mode);

            shapeHandler = (IShapeHandler)form.Tag;
            shapeHandler.LoadProperties();

            dictionary[shape] = shapeHandler;

            return shapeHandler;
        }
Пример #9
0
 /// <summary>
 /// Initializes a new instance of the NodeShape class.
 /// </summary>
 public WebPage(object shape, XmlForm form, XmlElement attributes)
     : base(shape, form, attributes)
 {
 }
Пример #10
0
        private void lookUp_Click(object sender, EventArgs e)
        {
            if (null == onClickFunction)
            {
                return;
            }

            isProcessing = true;
            if (Start != null)
            {
                Start(this);
            }

            ClickFunction functions = new ClickFunction();
            Type          type      = typeof(ClickFunction);
            MethodInfo    method    = type.GetMethod(onClickFunction);

            string[] lookUp = null;

            try
            {
                if (null == onClickFunctionParams && null == onClickGlobalDataParams)
                {
                    lookUp = (string[])method.Invoke(functions, null);
                }
                else
                {
                    string[] paramValues;
                    if (null != onClickFunctionParams)
                    {
                        Control     c   = ((Button)sender).Parent.Parent.Parent.Parent.Parent;
                        XmlDocument doc = ((XmlForm)c).GetShapeXml();
                        paramValues = new string[onClickFunctionParams.Length];

                        for (int i = 0; i < onClickFunctionParams.Length; ++i)
                        {
                            if (null != doc.DocumentElement[onClickFunctionParams[i]])
                            {
                                paramValues[i] = doc.DocumentElement[onClickFunctionParams[i]].InnerText;
                            }
                        }
                    }
                    else
                    {
                        paramValues = new string[onClickGlobalDataParams.Length];
                        for (int i = 0; i < onClickGlobalDataParams.Length; ++i)
                        {
                            paramValues[i] = globalData[onClickGlobalDataParams[i]];
                        }
                    }
                    lookUp = (string[])method.Invoke(functions, paramValues);
                }
            }
            catch (Exception ex)
            {
                isProcessing = false;
                if (Stop != null)
                {
                    Stop(this);
                }
                //_form.Hide();
                if (null != ex.InnerException)
                {
                    MessageBox.Show(null, ex.InnerException.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show(null, "É necessário definir primeiro o produto composto.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                return;
            }

            isProcessing = false;
            //_form.Hide();
            if (Stop != null)
            {
                Stop(this);
            }

            string xml = WriteXml(lookUp);

            using (XmlForm form = new XmlForm())
            {
                form.LoadDefinition("LookUp", null);
                form.Tag = this.FindForm().Tag;
                form.Design("");
                form.SetShapeXml(xml);
                DialogResult result = form.ShowDialog(this);

                if (result == DialogResult.OK)
                {
                    XmlDocument xdoc = form.GetShapeXml();
                    //valor selecionado na ListBox
                    if (null != ((ListBox)form.Controls[1].Controls[0].Controls[0].Controls[0].Controls[5]).SelectedItem)
                    {
                        string text = ((ListBox)form.Controls[1].Controls[0].Controls[0].Controls[0].Controls[5]).SelectedItem.ToString();

                        if ("GetStates" != onClickFunction)
                        {
                            valueControl.Text = text;
                        }
                        else
                        {
                            string[] values = text.Split(new string[] { " -> " }, StringSplitOptions.RemoveEmptyEntries);
                            string   temp   = values[0].Substring(9);
                            valueControl.Text = temp.Replace(" ", string.Empty);
                            if (2 == values.Length)
                            {
                                ((Button)sender).Parent.Parent.Parent.Controls[0].Controls[0].Controls[1].Text = values[1].Substring(13);
                            }
                        }
                    }
                }
            }
        }
Пример #11
0
        private void lookUp_Click(object sender, EventArgs e)
        {
            if (null == onClickFunction)
                return;

            isProcessing = true;
            if (Start != null)
                Start(this);

            ClickFunction functions = new ClickFunction();
            Type type = typeof(ClickFunction);
            MethodInfo method = type.GetMethod(onClickFunction);
            string[] lookUp = null;

            try
            {
                if (null == onClickFunctionParams && null == onClickGlobalDataParams)
                {
                    lookUp = (string[])method.Invoke(functions, null);
                }
                else
                {
                    string[] paramValues;
                    if (null != onClickFunctionParams)
                    {

                        Control c = ((Button)sender).Parent.Parent.Parent.Parent.Parent;
                        XmlDocument doc = ((XmlForm)c).GetShapeXml();
                        paramValues = new string[onClickFunctionParams.Length];

                        for (int i = 0; i < onClickFunctionParams.Length; ++i)
                        {
                            if (null != doc.DocumentElement[onClickFunctionParams[i]])
                                paramValues[i] = doc.DocumentElement[onClickFunctionParams[i]].InnerText;
                        }

                    }
                    else
                    {
                        paramValues = new string[onClickGlobalDataParams.Length];
                        for (int i = 0; i < onClickGlobalDataParams.Length; ++i)
                        {
                            paramValues[i] = globalData[onClickGlobalDataParams[i]];
                        }

                    }
                    lookUp = (string[])method.Invoke(functions, paramValues);
                }
            }
            catch (Exception ex)
            {
                isProcessing = false;
                if (Stop != null)
                    Stop(this);
                //_form.Hide();
                if(null != ex.InnerException)
                    MessageBox.Show(null, ex.InnerException.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                else
                    MessageBox.Show(null, "É necessário definir primeiro o produto composto.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            isProcessing = false;
            //_form.Hide();
            if (Stop != null)
                Stop(this);

            string xml = WriteXml(lookUp);
            using (XmlForm form = new XmlForm())
            {
                form.LoadDefinition("LookUp", null);
                form.Tag = this.FindForm().Tag;
                form.Design("");
                form.SetShapeXml(xml);
                DialogResult result = form.ShowDialog(this);

                if (result == DialogResult.OK)
                {
                    XmlDocument xdoc = form.GetShapeXml();
                    //valor selecionado na ListBox
                    if (null != ((ListBox)form.Controls[1].Controls[0].Controls[0].Controls[0].Controls[5]).SelectedItem)
                    {
                        string text = ((ListBox)form.Controls[1].Controls[0].Controls[0].Controls[0].Controls[5]).SelectedItem.ToString();

                        if ("GetStates" != onClickFunction)
                        {
                            valueControl.Text = text;
                        }
                        else
                        {
                            string[] values = text.Split(new string[] { " -> " }, StringSplitOptions.RemoveEmptyEntries);
                            string temp = values[0].Substring(9);
                            valueControl.Text = temp.Replace(" ", string.Empty);
                            if (2 == values.Length)
                            {
                                ((Button)sender).Parent.Parent.Parent.Controls[0].Controls[0].Controls[1].Text = values[1].Substring(13);
                            }
                        }
                    }

                }
            }
        }
Пример #12
0
 /// <summary>
 /// Initializes a new instance of the SubProcessShape class.
 /// </summary>
 public ParameterListShape(object shape, XmlForm form, XmlElement attributes)
     : base(shape, form, attributes)
 {
 }
Пример #13
0
 /// <summary>
 /// Initializes a new instance of the SubProcessShape class.
 /// </summary>
 public FieldItem(object shape, XmlForm form, XmlElement attributes)
     : base(shape, form, attributes)
 {
 }
Пример #14
0
 /// <summary>
 /// Initializes a new instance of the EventShape class.
 /// </summary>
 public TransitionShape(object shape, XmlForm form, XmlElement attributes)
     : base(shape, form, attributes)
 {
 }