Exemple #1
0
        public MajorPage(MajorContext majorContext, AppConfig appConfig, Window window)
        {
            _majorContext = majorContext;
            _appConfig    = appConfig;
            _window       = window;
            InitializeComponent();
            PrepareGrid();
            PrepareGrid(this.ToolsGrid, this._majorContext.ResourceInfos);
            var majorBackgroundImagePath = appConfig.GetMajorBackgroundImagePath(_majorContext.MajorName);

            if (!string.IsNullOrWhiteSpace(majorBackgroundImagePath))
            {
                GridUtility.SetBackGround(majorBackgroundImagePath, MainGrid);
            }
            else
            {
                GridUtility.SetBackGround(_majorContext.TopBackgroundImagePath, TopGrid);
                GridUtility.SetBackGround(_majorContext.BottomBackgroundImagePath, BottomGrid);
            }

            if (!string.IsNullOrWhiteSpace(_majorContext.MajorName) && appConfig.ShowMajorNameAtMajorPage)
            {
                Title = _majorContext.MajorName;
                var textBlock = new TextBlock
                {
                    Text = _majorContext.MajorName
                };
                PageTitleViewBox.Child = textBlock;
            }

            BarPageUtility.PrepareBarPage(this, _appConfig);
        }
Exemple #2
0
        public MajorsPage(MajorsContext majorsContext, AppConfig appConfig, Window window)
        {
            InitializeComponent();
            _majorsContext = majorsContext;
            _appConfig     = appConfig;
            _window        = window;
            var majorsGrid = this.MajorsGrid;

            PrepareGrid(majorsGrid, this._majorsContext.MajorInfos, true);
            PrepareGrid(this.ToolsGrid, this._majorsContext.ResourceInfos, false);

            var backgroundImagePath = appConfig.GetAppBackgroundImagePath();

            if (!string.IsNullOrWhiteSpace(backgroundImagePath))
            {
                GridUtility.SetBackGround(backgroundImagePath, MainGrid);
            }
            else
            {
                GridUtility.SetBackGround(_majorsContext.TopBackgroundImagePath, TopGrid);
                GridUtility.SetBackGround(_majorsContext.BottomBackgroundImagePath, BottomGrid);
            }


            if (!string.IsNullOrWhiteSpace(_majorsContext.AppTitle))
            {
                this.WindowTitle = _majorsContext.AppTitle;
                this.Title       = _majorsContext.AppTitle;
            }

            BarPageUtility.PrepareBarPage(this, _appConfig);
        }
Exemple #3
0
        public VideosPage(MajorVideoContext majorVideoContext, AppConfig appConfig, Window window)
        {
            _appConfig         = appConfig;
            _majorVideoContext = majorVideoContext;
            _window            = window;
            var listViewItemCommand = new ListViewItemCommand(this);

            InitializeComponent();
            VideoPlayer.UnloadedBehavior = MediaState.Close;
            VideoPlayer.MediaEnded      += VideoPlayer_MediaEnded;
            VideoPlayer.MediaOpened     += VideoPlayer_MediaOpened;

            foreach (var keyValuePair in _majorVideoContext.ResourceInfos)
            {
                var viewBox = new Viewbox();
                var button  = ButtonUtility.CreateButton(keyValuePair.Value.ImagePath, keyValuePair.Key, keyValuePair.Value.MoveEnterImagePath);
                button.Tag    = keyValuePair.Value.Path;
                button.Click += OpenFolderButton_Click;
                viewBox.Child = button;
                this.ToolPanel.Children.Add(viewBox);
            }

            var playButton = PreparePlayControlButton(appConfig);

            PrepareNoneControlVideoButtons(playButton);
            PrepareListView(listViewItemCommand);

            if (!string.IsNullOrWhiteSpace(appConfig.VideoPageTitle) && !string.IsNullOrWhiteSpace(majorVideoContext.MajorName))
            {
                var title = $"{majorVideoContext.MajorName}.{appConfig.VideoPageTitle}";
                Title = title;
            }

            var videoBottomGridBackgroundImagePath = _appConfig.GetVideoBottomGridBackgroundImagePath();

            if (!string.IsNullOrWhiteSpace(videoBottomGridBackgroundImagePath))
            {
                var image = new Image
                {
                    Source = new BitmapImage(new Uri(videoBottomGridBackgroundImagePath))
                };

                BottomGrid.Background = new ImageBrush(image.Source);
            }

            this.Unloaded += VideosPage_Unloaded;
            BarPageUtility.PrepareBarPage(this, _appConfig);
        }