Пример #1
0
 public void Save(string path, savedDataFormat data)
 {
     using (StreamWriter sw = new StreamWriter(path))
     {
         sw.Write(JsonConvert.SerializeObject(data));
     }
 }
Пример #2
0
        public savedDataFormat New()
        {
            var data = new savedDataFormat();

            data.url    = "";
            data.method = "get";
            data.header = new List <DataGridValue>()
            {
                new DataGridValue(true, "Content-Type", "application/json")
            };
            data.parameters = new List <DataGridValue>();
            data.content    = "";

            return(data);
        }
Пример #3
0
        private Requester.savedDataFormat GetSavedData()
        {
            Requester.savedDataFormat toReturn = new Requester.savedDataFormat();
            toReturn.url     = urlTextBox.Text;
            toReturn.method  = methodComboBox.Text;
            toReturn.content = new TextRange(
                bodyTextBlock.Document.ContentStart,
                bodyTextBlock.Document.ContentEnd
                ).Text;

            toReturn.header = new List <Requester.DataGridValue>();
            foreach (var item in headerData)
            {
                toReturn.header.Add(item);
            }

            toReturn.parameters = new List <Requester.DataGridValue>();
            foreach (var item in paramsData)
            {
                toReturn.parameters.Add(item);
            }

            return(toReturn);
        }
Пример #4
0
        private void ApplySavedData(Requester.savedDataFormat data)
        {
            urlTextBox.Text = data.url;

            methodComboBox.Text = data.method.ToUpper();

            TextRange tr = new TextRange(bodyTextBlock.Document.ContentEnd, bodyTextBlock.Document.ContentEnd);

            tr.Text = data.content;

            headerData.Clear();
            foreach (var item in data.header)
            {
                headerData.Add(item);
            }
            dataGridHeader.Items.Refresh();

            paramsData.Clear();
            foreach (var item in data.parameters)
            {
                paramsData.Add(item);
            }
            dataGridParams.Items.Refresh();
        }