private void FetchTurn(int positionId, Action <string> callback) { DataManager <PositionTurn> turnDM = DataManagerFactory.GetManager <PositionTurn> (); TurnRequest request = new TurnRequest(User.Id, User.Code, positionId); request.Get((results, ex) => { if (results == null) { callback("Not found"); } else { IEnumerator <PositionTurn> i = results.GetEnumerator(); if (i.MoveNext()) { PositionTurn pt = i.Current; turnDM.SaveItem(pt); callback(pt.Content); } else { callback("Not Found"); } } }); }
/// <summary> /// Gets the turn report. /// </summary> /// <param name="positionId">Position identifier.</param> /// <param name="callback">Callback.</param> public async void GetTurnReport(int positionId, Action <string> callback) { DataManager <PositionTurn> turnDM = DataManagerFactory.GetManager <PositionTurn> (); PositionTurn pt = await turnDM.GetItem(positionId); if (pt == null) { FetchTurn(positionId, callback); } else { await Task.Factory.StartNew(() => { try { string content = Application.DocumentFolder.ReadFile(pt.TurnPath); callback(content); FetchTurn(positionId, callback); } catch { FetchTurn(positionId, callback); } }); } }
/// <summary> /// Gets the data manager. /// </summary> /// <returns>The data manager.</returns> protected DataManager <T> GetDataManager() { return(DataManagerFactory.GetManager <T> ()); }
private DataManager <User> GetDataManager() { return(DataManagerFactory.GetManager <User> ()); }