private void LoadData(string result) { m_lstPinCode = new ObservableCollection <PinCodeViewModel>(); while (result.Length > 0) { PinCodeViewModel pinCodeViewModel = new PinCodeViewModel(); var index = result.IndexOf("width:25%"); if (index == -1) { break; } result = result.Substring(index + 12); var stopIndex = result.IndexOf("</td>"); pinCodeViewModel.City = result.Substring(0, stopIndex); result = result.Substring(stopIndex + 5); index = result.IndexOf("width:25%"); result = result.Substring(index + 12); stopIndex = result.IndexOf("</td>"); pinCodeViewModel.State = result.Substring(0, stopIndex); result = result.Substring(stopIndex + 5); index = result.IndexOf("width:30%"); result = result.Substring(index + 12); stopIndex = result.IndexOf("</td>"); pinCodeViewModel.Area = result.Substring(0, stopIndex); result = result.Substring(stopIndex + 5); m_lstPinCode.Add(pinCodeViewModel); } lbPinCode.ItemsSource = PinCodeList; }
private void LoadData(string result) { m_lstPinCode = new ObservableCollection<PinCodeViewModel>(); while (result.Length > 0) { PinCodeViewModel pinCodeViewModel = new PinCodeViewModel(); var index = result.IndexOf("width:25%"); if (index == -1) break; result = result.Substring(index + 12); var stopIndex = result.IndexOf("</td>"); pinCodeViewModel.City = result.Substring(0, stopIndex); result = result.Substring(stopIndex + 5); index = result.IndexOf("width:25%"); result = result.Substring(index + 12); stopIndex = result.IndexOf("</td>"); pinCodeViewModel.State = result.Substring(0, stopIndex); result = result.Substring(stopIndex + 5); index = result.IndexOf("width:30%"); result = result.Substring(index + 12); stopIndex = result.IndexOf("</td>"); pinCodeViewModel.Area = result.Substring(0, stopIndex); result = result.Substring(stopIndex + 5); m_lstPinCode.Add(pinCodeViewModel); } lbPinCode.ItemsSource = PinCodeList; }