internal void UpdateDataGrid_OnTextBox() { ObservableCollection <WebRequestParamsItem> Collection = GetLinkRequestToCollection.GetCollection(EditorRequestData.RequestLink); if (Collection != null) { WebRequestParamsItem[] CollectionArray; CollectionArray = WebRequestItems.ToArray(); foreach (var WebRequestItem in Collection) { if (WebRequestItem != null && WebRequestItem.Key != null) { WebRequestParamsItem GWebRequestItem = Array.Find(CollectionArray, x => x.Key == WebRequestItem.Key); if (GWebRequestItem == null) { WebRequestItems.Add(WebRequestItem); } else { GWebRequestItem.Key = WebRequestItem.Key; GWebRequestItem.Value = WebRequestItem.Value; DataGrid_FormRequestData.Items.Refresh(); } } } CollectionArray = Collection.ToArray(); var RemoveIndexs = new List <int>(); for (int i = 0; i < WebRequestItems.Count; i++) { WebRequestParamsItem RequestParamsItem = WebRequestItems[i]; if (RequestParamsItem != null && RequestParamsItem.Key != null) { if (!Array.Exists(CollectionArray, x => x.Key == RequestParamsItem.Key)) { WebRequestItems.RemoveAt(i); GeneralLogic.DataGrid_RemoveParamsById(RequestParamsItem.Id); } } } GeneralLogic.DataGrid_UpdateParamsBroadcast(); } else { WebRequestItems.Clear(); if (RequestDirectory != null) { GeneralLogic.DataGrid_RemoveParamsAll(RequestDirectory.WebRequestId); } } }
private void Button_SendRequest_Click(object sender, RoutedEventArgs e) { if (RequestDirectory == null) { new ConfirmWindow("Предупреждение", "Если вы хотите сохранить всю историю для запроса, вам следует сохранить запрос. " + "Создать новый запрос?", delegate() { LEditorNetwork.SaveRequest( GeneralLogic.RequestLink, GeneralLogic.RequestMethod, WebRequestItems.ToArray() ); }, delegate() { GeneralLogic.WebRequestSend(); }); } else { GeneralLogic.WebRequestSend(); } }
private void Button_SaveRequest_Click(object sender, RoutedEventArgs e) { // Удаление пустых строк RemoveEmptyCollectionValues(); LEditorNetwork.SaveRequest(GeneralLogic.RequestLink, GeneralLogic.RequestMethod, WebRequestItems.ToArray()); }