internal void RemoveEmptyCollectionValues() { try { var RemoveIndexs = new List <int>(); for (int i = 0; i < WebRequestItems.Count; i++) { WebRequestParamsItem WebRequestItem = WebRequestItems[i]; if (WebRequestItem != null && WebRequestItem.Key != null && WebRequestItem.Value != null) { if (WebRequestItem.Key.Trim() == string.Empty && WebRequestItem.Value.Trim() == string.Empty) { RemoveIndexs.Add(i); } } else { RemoveIndexs.Add(i); } } foreach (var ItemIndex in RemoveIndexs) { WebRequestItems.RemoveAt(ItemIndex); } } catch { } }
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); } } }