示例#1
0
        /// <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);
            }
        }
示例#2
0
 private AppResourcesLisener()
 {
     isDispposing = false;
     languages    = new LanguageResources();
     themes       = new ThemeResources();
     images       = new ImageResources();
 }
示例#3
0
        public SettingsPage()
        {
            LangResources  = BabelTower.getTranslatedResources <SettingsResources>();
            ColorResources = Painter.GetTheme();

            NavigationCacheMode = NavigationCacheMode.Enabled;
            InitializeComponent();
        }
示例#4
0
 public ChangelogPage()
 {
     NavigationCacheMode    = NavigationCacheMode.Enabled;
     githubReleasesEndpoint = Constants.Endpoints.Github;
     LangResources          = BabelTower.getTranslatedResources <ChangelogResources>();
     ColorResources         = Painter.GetTheme();
     InitializeComponent();
 }
示例#5
0
 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();
 }
示例#6
0
        /// <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);
        }
示例#7
0
 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();
        }
示例#9
0
        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();
        }
示例#10
0
 /// <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()));
         });
     }
 }
示例#11
0
 public SettingItem(string DisplayValue, string RawValue)
 {
     this.DisplayValue   = DisplayValue;
     this.RawValue       = RawValue;
     this.ColorResources = Painter.GetTheme();
 }
示例#12
0
        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;
 }