Пример #1
0
        public WallpapersWindow(MainWindow.ShowPageEventHandler showPage)
        {
            InitializeComponent();
            AppData._wallpapersManifest = WallpapersManifest.GetWallpapersList("wallpaperManifest.json");
            foreach (var each in AppData._wallpapersManifest.list)
            {
                WallpaperItem item = AddWallpaper(each);

                if (each.IsInPlaylist)
                {
                    AddWallpaperItemInPlaylist(item);
                }

                if (each == AppData._wallpapersManifest.list[0])
                {
                    showDetailsFromItem(item);
                }
            }

            _showPage = showPage;

            ButtonAdd.Click    += new RoutedEventHandler(AddButtonClicked);
            ButtonDelete.Click += new RoutedEventHandler(DeleteButtonClicked);
            ButtonPlay.Click   += new RoutedEventHandler(PlayButtonClicked);

            SearchButton.Click += new RoutedEventHandler(SearchWallpaper);
        }
Пример #2
0
        private void RandomWallpaper()
        {
            // random wallpaper
            AppData._wallpapersManifest = WallpapersManifest.GetWallpapersList("wallpaperManifest.json");
            Wallpapers.WallpaperManifestItem randomWallpaper = AppData._wallpapersManifest.RandomWallpaperInPlaylist();
            WallpaperManifest manifest = WallpaperManifest.GetWallpaper(randomWallpaper.WallpaperPath);

            // get index.html path
            string wallpaperDirectory = System.IO.Path.GetFullPath(System.IO.Path.GetDirectoryName(randomWallpaper.WallpaperPath));
            string indexPath          = System.IO.Path.Combine(wallpaperDirectory, manifest.WallpaperMainPath);

            // create browser
            _chromiumWebBrowser.SetValue(ChromiumWebBrowser.AddressProperty,
                                         "file:///" + indexPath);
        }