Esempio n. 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);
                    }
                }
            }
        }
Esempio n. 2
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));
                    }
                }
            }
        }
Esempio n. 3
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;
            }
        }
Esempio n. 4
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));
                    }
                }
            }
        }
Esempio n. 5
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);
                    }
                }
            }
        }
Esempio n. 6
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;
        }
Esempio n. 7
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);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 8
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);
                            }
                        }
                    }

                }
            }
        }