public async void onSearchAlarms() { //Implement for each query Group by PropertyName : StationName , Priority or Desc. //ExpressGen(); IEnumerable <IGrouping <string, Item> > groupFields = from item in searchList group item by item.FieldName; string[] search_Parse_Pri_List = search_Parse_Pri.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); Console.WriteLine(search_Parse_Pri_List.Length); //searchParseDeleg = SearchingExpressionBuilder.GetExpression<RestorationAlarmList>(groupFields, search_Parse_Pri); searchParseDeleg = SearchingExpressionBuilder.GetExpression <RestorationAlarmLists>(groupFields, search_Parse_Pri_List, _search_Parse_Sec); if (searchParseDeleg == null) { Console.WriteLine("Expression Building Error"); } else { RestAlarmsRepo.filterParseDeleg = searchParseDeleg; await RestAlarmsRepo.GetCustAlarmAct(); Console.WriteLine(searchParseDeleg.Body); } }
private async void onSearchCommand() { if (this.fileList != null) { m_repoEventLog.ErrorFile.Clear(); this.ErrorFile = null; List <SearchElement> searchItems = new List <SearchElement>(); searchItems.Add(new SearchElement(StrSearchEventList1, fieldName[(int)EventLogField.EVENT_FIELD], true)); // Event Include Keyword 1 searchItems.Add(new SearchElement(StrSearchEventList2, fieldName[(int)EventLogField.EVENT_FIELD], true)); // Event Include Keyword 2 searchItems.Add(new SearchElement(StrSearchEventList3, fieldName[(int)EventLogField.EVENT_FIELD], true)); // Event Include Keyword 3 searchItems.Add(new SearchElement(StrSearchEventList4, fieldName[(int)EventLogField.MESSAGE_FIELD], true)); // Message Include Keyword searchItems.Add(new SearchElement(StrSearchEventList5, fieldName[(int)EventLogField.EVENT_FIELD], false)); // Event Exclude Keyword //Generate Search Expression searchParseDeleg = SearchingExpressionBuilder.GetExpression <EventLog>(searchItems); if (searchParseDeleg == null) { Console.WriteLine("Expression Building Error"); ExpressionTree = "Expression Building Error"; } else { Console.WriteLine(searchParseDeleg.Body); ExpressionTree = searchParseDeleg.Body.ToString(); using (new WaitCursor()) { StringBuilder txt = new StringBuilder(); await Task.Run(() => m_repoEventLog.ReadRptFileAsync(fileList, searchParseDeleg)); if (m_repoEventLog.ErrorFile.Count != 0) { foreach (var item in m_repoEventLog.ErrorFile) { txt.Append(item); txt.AppendLine(); //this.fileList.Remove(item); //Remove Error File from List } } this.ErrorFile = txt.ToString(); // very long task } } //For only first time if (this.ListEventLog == null) { this.ListEventLog = new ObservableCollection <EventLog>(this.m_repoEventLog.ListEventLog); } else //Next Time { foreach (var EventLog in this.m_repoEventLog.ListEventLog) { this.ListEventLog.Add(EventLog); } } //EventLogs = ListEventLog.Select(s => s.Event); MessageBox.Show("ค้นพบ " + this.ListEventLog.Count.ToString() + " Event(s)", "เสร็จสิ้นการค้นหา", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("คุณไม่ได้เลือก file ที่ต้องการค้นหา ", "File Path Error", MessageBoxButton.OK, MessageBoxImage.Information); } }