private void LoadNewests() { AsyncCallback callback = ar => Deployment.Current.Dispatcher.BeginInvoke( () => { try { NewestProducts = Services.ProductManager.EndGetNewests(ar); } catch (Exception e) { LoadNewests_Catch(e); } }); try { Services.ProductManager.BeginGetNewests(2, 8, 16, callback, null); AreNewestsLoaded = true; } catch (Exception e) { LoadNewests_Catch(e); } }
private void LoadNewests_Catch(Exception e) { AreNewestsLoaded = false; if (!_isDebug) { throw e; } else { var sampleData = new SampleData.MainHighlightedProductsSD().MainHighlightedProducts; NewestProducts = sampleData; } }
public MainHighlightedProductsSD() { string readToEnd; try { // Case for: Offline Device using (var streamReader = new StreamReader(SampleDataRootOnWP + "MainHighlightedProductsSD.json")) { readToEnd = streamReader.ReadToEnd(); } } catch (Exception e) { // Case for: Designer using (var streamReader = new StreamReader(SampleDataRootOnPC + "MainHighlightedProductsSD.json")) { readToEnd = streamReader.ReadToEnd(); } } MainHighlightedProducts = JsonConvert.DeserializeObject <BookBlockPLVM>(readToEnd); }