public DarumaDomain(string wish, DarumaWishTheme theme) { Id = Guid.NewGuid(); Wish = wish; Theme = theme; //TODO: remove datetime Now for more testable code CreateDate = DateTime.Now; ChangeStatus(DarumaStatus.MakedWish); }
public async Task<DarumaView> CreateDaruma(string wish, DarumaWishTheme theme) { var daruma = new DarumaDomain(wish, theme); //TODO: need another way handle exception bool result = await _storage.Add(daruma); if(!result) { throw new NullReferenceException("can't add daruma((("); } return new DarumaView(daruma, _imageUriResolver); }
public KeyValuePair<string, string> GetQuotationSourse(DarumaWishTheme theme) { var resource = resourseStorage.GetByDarumsWishTheme(theme); var resolver = new RandomQuotationResolver(resource.GetResourceSet(CultureInfo.CurrentUICulture, true, true)); var seed = (int)DateTime.Now.Ticks + //change app memory usage determine type to comparable with WinRT api (int)Windows.System.MemoryManager.AppMemoryUsage; var quaotation = resolver.RenturnRandomQuotation(seed); return quaotation; }
public ResourceManager GetByDarumsWishTheme(DarumaWishTheme theme) { if (_dict.ContainsKey(theme)) { var resource = _dict[theme]; if (resource != null) { //var resourceSet = resource.GetResourceSet(CultureInfo.CurrentUICulture, true, true); return resource; } } return null; }
public string GetQuotationByKey(DarumaWishTheme theme, string key) { var resource = resourseStorage.GetByDarumsWishTheme(theme); var text = resource.GetString(key); return text; }
public string GetQuote(DarumaWishTheme theme, string key = null) { return _darumaService.GetQuote(theme, key); }
public string GetLocalizationByTheme(DarumaWishTheme theme) { return _dict[theme]; }
// public RelayCommand CreateDarumaCommand { get; private set; } public async Task<DarumaView> CreateDaruma(string wish, DarumaWishTheme theme) { return await _darumaService.CreateDaruma(wish, theme); }
public DarumaInfoSharing(DarumaWishTheme theme, string quote) { WishTheme = theme; Quote = quote; }
public KeyValuePair<string, string> GetQuotationByDarumaTheme(DarumaWishTheme theme) { var quoteSource = _quotationSource.GetQuotationSourse(theme); return quoteSource; }
//public async Task UpdateQuoteOnTile(Guid id) //{ // DarumaDomain daruma = await _storage.GetById(id); // var quoteSource = _quotationSource.GetQuotationSourse(daruma.Theme); // daruma.CurrentQuoteKey = quoteSource.Key; // await _storage.Update(daruma); //} //TODO: may be need quotation service public string GetQuote(DarumaWishTheme theme, string key = null) { var quote = key == null ? _quotationSource.GetQuotationSourse(theme).Value : _quotationSource.GetQuotationByKey(theme, key); return quote; }