/// <summary> /// Parses the raw data into a ListItems object, raising FinishedFetchingResults event when finished. /// In case of failure, it FailedFetchingResults event will be raised. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ParseResults(Object sender, DownloadStringCompletedEventArgs e) { this.parsedResults = new ListItems(); ThemeResources colorResources = Painter.GetTheme(); try { JsonArray jArray = JsonArray.Parse((string)e.Result); foreach (JsonValue jValue in jArray) { JsonObject jObject = jValue.GetObject(); ListItem resultItem = new ListItem( jObject.GetNamedString("mediaType"), jObject.GetNamedString("mediaTitle"), jObject.GetNamedString("channelTitle"), jObject.GetNamedString("mediaUrl")); resultItem.ColorResources = colorResources; this.parsedResults.Add(resultItem); } this.OnFinishedFetchingResults(EventArgs.Empty); } catch { this.OnFailedFetchingResults(EventArgs.Empty); } }
private AppResourcesLisener() { isDispposing = false; languages = new LanguageResources(); themes = new ThemeResources(); images = new ImageResources(); }
public SettingsPage() { LangResources = BabelTower.getTranslatedResources <SettingsResources>(); ColorResources = Painter.GetTheme(); NavigationCacheMode = NavigationCacheMode.Enabled; InitializeComponent(); }
public ChangelogPage() { NavigationCacheMode = NavigationCacheMode.Enabled; githubReleasesEndpoint = Constants.Endpoints.Github; LangResources = BabelTower.getTranslatedResources <ChangelogResources>(); ColorResources = Painter.GetTheme(); InitializeComponent(); }
internal static void Restrictions(ThemeResources argument, string parameterName) { if (argument == ThemeResources.Inherited) { throw new ArgumentException("AppThemeDictionary can't have Inherited source at application level", parameterName); } Contract.EndContractBlock(); }
/// <summary> /// Gets the theme resources based on the user preferences. /// </summary> /// <returns></returns> public static ThemeResources GetTheme() { ThemeResources Theme = new ThemeResources(); Theme.AccentColor = (string)Utils.GetSettingValue(Constants.Settings.AccentColors["varname"]); Theme.SecondaryColor = (string)Utils.GetSettingValue(Constants.Settings.SecondaryColors["varname"]); Theme.AuxiliaryColor = (string)Utils.GetSettingValue(Constants.Settings.AuxiliaryColors["varname"]); return(Theme); }
protected override void OnActivated(EventArgs e) { if (!setupComplete) { Theme = new ThemeResources(Resources); new Setup(Dispatcher, new Presenter(MainWindow)).Initialize(); Mvx.Resolve <IMvxAppStart>().Start(); setupComplete = true; } base.OnActivated(e); }
public MainPage() { Search = new Search(); Search.FinishedFetchingResults += PresentResults; Search.FailedFetchingResults += PresentSearchError; LangResources = BabelTower.getTranslatedResources <MainPageResources>(); ColorResources = Painter.GetTheme(); NavigationCacheMode = NavigationCacheMode.Enabled; InitializeComponent(); }
public void Initialize(FlyoutWindow flyoutWindow) { _flyoutWindow = flyoutWindow; themeResources = (ThemeResources)App.Current.Resources.MergedDictionaries.FirstOrDefault(x => x is ThemeResources); lightResources = themeResources.ThemeDictionaries["Light"]; darkResources = themeResources.ThemeDictionaries["Dark"]; FlyoutBackgroundOpacity = AppDataHelper.FlyoutBackgroundOpacity; UseColoredTrayIcon = AppDataHelper.UseColoredTrayIcon; SystemTheme.SystemThemeChanged += OnSystemThemeChange; SystemTheme.Initialize(); }
/// <summary> /// Loads the theme file. /// </summary> private void LoadThemeFile() { if (this.ThemeFile != null && this._themeResources == null) { this._themeResources = new LoadSerializedXmlFile <ThemeResources>().FromFile( GetMappedThemeFile(this.ThemeFile), "THEMEFILE{0}".FormatWith(this.ThemeFile), r => { // transform the page and tag name ToUpper... r.page.ForEach(p => p.name = p.name.ToUpper()); r.page.Where(p => p.Resource == null).ForEach( p => p.Resource = new ResourcesPageResource[0]); r.page.ForEach(p => p.Resource.ForEach(i => i.tag = i.tag.ToUpper())); }); } }
public SettingItem(string DisplayValue, string RawValue) { this.DisplayValue = DisplayValue; this.RawValue = RawValue; this.ColorResources = Painter.GetTheme(); }
public void Initialize(FlyoutWindow flyoutWindow) { _flyoutWindow = flyoutWindow; FlyoutTimeout = AppDataHelper.FlyoutTimeout; MaxVerticalSessionControlsCount = AppDataHelper.MaxVerticalSessionControlsCount; SessionsPanelOrientation = AppDataHelper.SessionsPanelOrientation; themeResources = (ThemeResources)App.Current.Resources.MergedDictionaries.FirstOrDefault(x => x is ThemeResources); lightResources = themeResources.ThemeDictionaries["Light"]; darkResources = themeResources.ThemeDictionaries["Dark"]; FlyoutBackgroundOpacity = AppDataHelper.FlyoutBackgroundOpacity; #region Setup TaskbarIcon var settingsItem = new MenuItem() { Header = Properties.Strings.SettingsItem, ToolTip = Properties.Strings.SettingsItemDescription, Icon = new SymbolIcon() { Symbol = Symbol.Setting } }; settingsItem.Click += (_, __) => FlyoutHandler.ShowSettingsWindow(); var exitItem = new MenuItem() { Header = Properties.Strings.ExitItem, ToolTip = Properties.Strings.ExitItemDescription, Icon = new FontIcon() { Glyph = CommonGlyphs.PowerButton } }; exitItem.Click += (_, __) => FlyoutHandler.SafelyExitApplication(); TaskbarIconContextMenu = new ContextMenu() { Items = { settingsItem, exitItem } }; TaskbarIconToolTip = new ToolTip() { Content = Program.AppName }; TaskbarIcon = new TaskbarIcon() { TrayToolTip = TaskbarIconToolTip, ContextMenu = TaskbarIconContextMenu }; TaskbarIcon.TrayMouseDoubleClick += (_, __) => FlyoutHandler.ShowSettingsWindow(); #endregion UseColoredTrayIcon = AppDataHelper.UseColoredTrayIcon; SystemTheme.SystemThemeChanged += OnSystemThemeChange; SystemTheme.Initialize(); }
public WarnPage() { ColorResources = Painter.GetTheme(); InitializeComponent(); NavigationCacheMode = NavigationCacheMode.Enabled; }