public void Save(string path, savedDataFormat data) { using (StreamWriter sw = new StreamWriter(path)) { sw.Write(JsonConvert.SerializeObject(data)); } }
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); }
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); }
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(); }