private void ProcessSearch(string searchString) { int routeNumber = 0; bool canConvert = int.TryParse(searchString, out routeNumber); //check if it's a number if (canConvert == true) //it's a route or stop number { int number = int.Parse(searchString); if (number < 1000) //route number { viewModel.SearchByRoute(searchString, SearchByRouteCallback); } else //stop number { viewModel.SearchByStop(searchString, SearchByStopCallback); } } else if (string.IsNullOrEmpty(searchString) == false) // Try to find the location { viewModel.SearchByAddress(searchString, SearchByLocationCallback); } SearchStoryboard.Seek(TimeSpan.Zero); SearchStoryboard.Stop(); this.Focus(); }