protected override async void OnAppearing() { if (RecentDesigns == null || RecentDesigns.Count == 0) { var service = new DesignService(); RecentDesigns = await service.GetDesigns(Title); RecentDesigns.ForEach(designGroup => { var url = designGroup.Design.Image; var uploadIndex = url.IndexOf("upload/", StringComparison.Ordinal) + 7; url = url.Insert(uploadIndex, "w_0.75,h_0.75,c_crop,g_auto,q_auto/w_180/"); designGroup.Design.Image = url; }); MostLikedDesigns = RecentDesigns; MostRequestedDesigns = RecentDesigns; RecentDesignsViewer.ItemsSource = RecentDesigns; MostLikedDesigns.Sort((x, y) => CompareIntegers(x.Design.Likes, y.Design.Likes)); MostLikedDesignsViewer.ItemsSource = MostRequestedDesigns; } base.OnAppearing(); }
private void LoadData() { CacheManager.RemoveByPattern(CacheNames.GetDesignCacheObjectName("")); _currentDesigns = DesignService.GetDesigns(DesignType); _onLineDesigns = DesignService.GetAvaliableDesignsOnLine(DesignType); DataListDesigns.DataSource = (_onLineDesigns ?? new List <Theme>()).Union(_currentDesigns ?? new List <Theme>()).OrderBy(design => design.Name); DataListDesigns.DataBind(); }
private void UninstallDesign(string themeName) { if (themeName == _none) { return; } try { _currentDesigns = DesignService.GetDesigns(DesignType); string dirname = string.Format("{0}design\\{1}s\\{2}", designFolderPath, DesignType.ToString(), themeName); switch (DesignType) { case eDesign.Theme: if (SettingsDesign.Theme == themeName) { var theme = _currentDesigns.FirstOrDefault(t => t.Name != themeName && t.Name != _none); SettingsDesign.Theme = theme != null ? theme.Name : _none; SettingsDesign.BackGround = _none; } break; case eDesign.Color: if (SettingsDesign.ColorScheme == themeName) { var theme = _currentDesigns.FirstOrDefault(t => t.Name != themeName && t.Name != _none); SettingsDesign.ColorScheme = theme != null ? theme.Name : _none; } break; case eDesign.Background: if (SettingsDesign.BackGround == themeName) { var theme = _currentDesigns.FirstOrDefault(t => t.Name != themeName && t.Name != _none); SettingsDesign.BackGround = theme != null ? theme.Name : _none; SettingsDesign.Theme = _none; } break; } FileHelpers.DeleteDirectory(dirname); MsgErr(successDeleteMsg); } catch (Exception ex) { Debug.LogError(ex); MsgErr(Resource.Admin_ThemesSettings_ErrorDelete); } }
protected void Page_Load(object sender, EventArgs e) { MsgErr(true); CacheManager.RemoveByPattern(CacheNames.GetDesignCacheObjectName("")); _currentDesigns = DesignService.GetDesigns(DesignType); _onLineDesigns = DesignService.GetAvaliableDesignsOnLine(DesignType); if (!IsPostBack) { LoadData(); } switch (DesignType) { case eDesign.Theme: lblLoadNew.Text = Resource.Admin_ThemesSettings_LoadNewTheme; successAddingMsg = Resource.Admin_ThemesSettings_SuccessAddingTheme; successDeleteMsg = Resource.Admin_ThemesSettings_SuccessDeleteTheme; choosegMsg = Resource.Admin_ThemesSettings_ChooseTheme; extensionErrMsg = Resource.Admin_ThemesSettings_ExtErrTheme; break; case eDesign.Color: lblLoadNew.Text = Resource.Admin_ThemesSettings_LoadNewColor; successAddingMsg = Resource.Admin_ThemesSettings_SuccessAddingColor; successDeleteMsg = Resource.Admin_ThemesSettings_SuccessDeleteColor; choosegMsg = Resource.Admin_ThemesSettings_ChooseColor; extensionErrMsg = Resource.Admin_ThemesSettings_ExtErrColor; break; case eDesign.Background: lblLoadNew.Text = Resource.Admin_ThemesSettings_LoadNewBackground; successAddingMsg = Resource.Admin_ThemesSettings_SuccessAddingBackground; successDeleteMsg = Resource.Admin_ThemesSettings_SuccessDeleteBackground; choosegMsg = Resource.Admin_ThemesSettings_ChooseBackground; extensionErrMsg = Resource.Admin_ThemesSettings_ExtErrBackground; break; } }