Пример #1
0
        /// <summary>
        /// Menu item edit variable clicked.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        void EditVariable_Clicked(object sender, EventArgs e)
        {
            // Active parser item
            if (ActiveParserItem == null)
            {
                return;
            }

            Dialog _edit;

            if (ActiveParserItem.value is List <ParserItem> )
            {
                _edit = new EditArrayVariable(ActiveParserItem, ActiveRequest);
            }
            else
            {
                _edit = new EditResponseVariable(ActiveParserItem, ActiveRequest);
            }

            var d = _edit.Run();

            if (d == Command.Ok)
            {
                if (_edit is EditArrayVariable)
                {
                    ActiveParserItem.value = ((EditArrayVariable)_edit).GetValue();
                }
                else
                {
                    ActiveParserItem.value = ((EditResponseVariable)_edit).GetValue();
                }

                // Create string
                string template = Parser.serialize(Template);
                if (ActiveRequest.ResponseTemplateType == ContentType.XML)
                {
                    XmlDocument doc = JsonConvert.DeserializeXmlNode(template);
                    Console.WriteLine(doc.ToString());
                    ActiveRequest.ResponseTemplate = doc.ToString();
                }
                else
                {
                    ActiveRequest.ResponseTemplate = template;
                }

                // Test
                RefreshContent();
            }

            _edit.Dispose();
        }
Пример #2
0
        /// <summary>
        /// Menu item edit variable clicked.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        void EditVariable_Clicked(object sender, EventArgs e)
        {
            // Active parser item
            if (ActiveParserItem == null) return;

            Dialog _edit;

            if (ActiveParserItem.value is List<ParserItem>) {
                _edit = new EditArrayVariable (ActiveParserItem, ActiveRequest);
            } else {
                _edit = new EditResponseVariable (ActiveParserItem, ActiveRequest);
            }

            var d = _edit.Run ();

            if (d == Command.Ok) {
                if (_edit is EditArrayVariable) {
                    ActiveParserItem.value = ((EditArrayVariable)_edit).GetValue ();
                } else {
                    ActiveParserItem.value = ((EditResponseVariable)_edit).GetValue ();
                }

                // Create string
                string template = Parser.serialize (Template);
                if (ActiveRequest.ResponseTemplateType == ContentType.XML) {
                    XmlDocument doc = JsonConvert.DeserializeXmlNode (template);
                    Console.WriteLine (doc.ToString ());
                    ActiveRequest.ResponseTemplate = doc.ToString ();
                } else {
                    ActiveRequest.ResponseTemplate = template;
                }

                // Test
                RefreshContent ();
            }

            _edit.Dispose ();
        }