public override bool Equals(object obj) { if (obj is DictionaryInfo) { DictionaryInfo other = (DictionaryInfo)obj; return(Id == other.Id && IsDemo == other.IsDemo); } return(false); }
public void Open(DictionaryInfo info) { lock (_locker) { ProductId = info.Id; _dictBaseId = Path.GetFileNameWithoutExtension(info.DictBasePath); Dictionary.DictionaryFactory.Initialize(info.DictBasePath, info.SoundBasesPaths, info.MorphoBasesPaths); _dictionary = Dictionary.DictionaryFactory.GetDictionary(); _articleService = Dictionary.DictionaryFactory.GetArticleService(); Initialize(); } }
public async Task <DictionaryInfo> GetInfo() { bool isDemo = !IsPurchased; PBase dictBase = null; if (isDemo) { dictBase = _basesManager.DemoBase; } else { dictBase = _basesManager.DictBase; } string dictBasePath = await dictBase.GetPath(); if (string.IsNullOrEmpty(dictBasePath)) { throw new Exception("File of dictionary base is not found"); } DictionaryInfo dictionaryInfo = new DictionaryInfo(_model.Id, Name, isDemo); dictionaryInfo.DictBasePath = dictBasePath; dictionaryInfo.Colors = _model.Colors; foreach (PBase morphoBase in _basesManager.MorphoBases) { string morphoBasePath = await morphoBase.GetPath(); if (!string.IsNullOrEmpty(morphoBasePath)) { dictionaryInfo.MorphoBasesPaths.Add(morphoBasePath); } } foreach (PBase soundBase in _basesManager.SoundBases) { string soundBasePath = await soundBase.GetPath(); if (!string.IsNullOrEmpty(soundBasePath)) { dictionaryInfo.SoundBasesPaths.Add(soundBasePath); } } return(dictionaryInfo); }
public static async Task OpenProduct(DictionaryInfo info) { Common.ISettingsManager settingsManager = Mvx.Resolve <Common.ISettingsManager>(); IParametersManager parametersManager = Mvx.Resolve <IParametersManager>(); IAppStylesService appStylesService = Mvx.Resolve <IAppStylesService>(); parametersManager.Set(Parameters.LaunchedProduct, info); if (!info.IsDemo) { settingsManager.Set(Settings.LastProductId, info.Id); } IDictionaryService dictionary = Mvx.Resolve <IDictionaryService>(); dictionary.Open(info); IArticleRenderingService articleRenderingService = Mvx.Resolve <IArticleRenderingService>(); articleRenderingService.Reset(); DataConverter dataConverter = new DataConverter(); await dataConverter.ConvertHistory(info.Id); await dataConverter.ConvertFavorites(info.Id); IHistoryService historyService = Mvx.Resolve <IHistoryService>(); historyService.Reset(); IFavoritesService favoritesService = Mvx.Resolve <IFavoritesService>(); favoritesService.Reset(); appStylesService.SetDefaultColors(); foreach (Models.ProductColor color in info.Colors) { appStylesService.SetColor(color.Title, color.Value); } }
private async void LaunchCommandImpl() { DictionaryInfo dictionaryInfo = await GetInfo(); Common.Delegate.Call(ProductLaunched, dictionaryInfo); }
private void ProductOnProductLaunched(DictionaryInfo info) { Common.Delegate.Call(ProductLaunched, info); }