예제 #1
0
        private void PrepareGrid()
        {
            var functionInfos = _majorContext.FunctionInfos;
            int columnCount, useRowIndex, useColumnIndex;

            GridUtility.PrepareBuutonGrid(CoreGrid, functionInfos.Count, true, out columnCount, out useRowIndex, out useColumnIndex);

            foreach (var oneFunctionInfo in functionInfos)
            {
                var button = ButtonUtility.CreateButton(oneFunctionInfo.Value.ImagePath, oneFunctionInfo.Key,
                                                        oneFunctionInfo.Value.MouseEnterImagePath);
                if (oneFunctionInfo.Value.Kind == FunctionKind.Video)
                {
                    var majorVideoContext = GetMajorVideoContext();

                    button.Tag    = majorVideoContext;
                    button.Click += NavigateVideoPageButton_Click;
                    if (!_appConfig.ShowVideoButtonToolTip)
                    {
                        button.ToolTip = null;
                    }
                }
                else if (oneFunctionInfo.Value.Kind == FunctionKind.OpenFile)
                {
                    button.Tag    = oneFunctionInfo.Value;
                    button.Click += OpenFileButton_Click;
                    ;
                }

                GridUtility.SetButton(CoreGrid, button, true, columnCount, ref useRowIndex, ref useColumnIndex);
            }
        }
예제 #2
0
        private Button CreateButton(string imagePath, string content)
        {
            var imageMovePath = AppConfig.GetMouseEnterImagePath(imagePath);
            var createdButton = ButtonUtility.CreateButton(imagePath, content, imageMovePath);

            return(createdButton);
        }
예제 #3
0
        private static Button CreateButton(string imagePath, string content)
        {
            Button button;

            if (string.IsNullOrWhiteSpace(imagePath))
            {
                button        = ButtonUtility.CreateButton((Image)null, content, null);
                button.Width  = 10;
                button.Height = 10;
                var viewBox   = new Viewbox();
                var textBlock = new TextBlock {
                    Text = content
                };
                viewBox.Child  = textBlock;
                button.Content = viewBox;
            }
            else
            {
                var image = new Image {
                    Source = new BitmapImage(new Uri(imagePath))
                };
                var imageEnterPath = AppConfig.GetMouseEnterImagePath(imagePath);
                button = ButtonUtility.CreateButton(image, content, imageEnterPath);
            }

            return(button);
        }
예제 #4
0
        private void PrepareGrid(Grid grid, IDictionary <string, FolderInfo> infos)
        {
            int columnCount, useRowIndex, useColumnIndex;

            GridUtility.PrepareBuutonGrid(grid, infos.Count, false, out columnCount, out useRowIndex, out useColumnIndex);

            foreach (var oneInfoPair in infos)
            {
                var button = ButtonUtility.CreateButton(oneInfoPair.Value.ImagePath, oneInfoPair.Key, oneInfoPair.Value.MoveEnterImagePath);
                button.Tag    = oneInfoPair.Value.Path;
                button.Click += OpenFolderButton_Click;
                GridUtility.SetButton(grid, button, false, columnCount, ref useRowIndex, ref useColumnIndex);
            }
        }
예제 #5
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);
        }
예제 #6
0
        private Viewbox PreparePlayControlButton(AppConfig appConfig)
        {
            if (CanCreateVideoImageButton())
            {
                var list     = new List <Image>();
                var pathList = new List <string>()
                {
                    _majorVideoContext.VideoStartButtonImagePath, _majorVideoContext.VideoStartButtonMouseEnterImagePath,
                    _majorVideoContext.VideoPauseButtonImagePath, _majorVideoContext.VideoPauseButtonMouseEnterImagePath
                };
                foreach (var onePath in pathList)
                {
                    list.Add(new Image
                    {
                        Source = new BitmapImage(new Uri(onePath))
                    });
                }

                _videoControlButton         = new VideoImageButton(list.ToArray());
                _videoControlButton.Content = list[0];
            }
            else if (CanCreateImageButton())
            {
                _playButtonImage = new Image
                {
                    Source = new BitmapImage(new Uri(_majorVideoContext.VideoStartButtonImagePath))
                };
                _pauseButtonImage = new Image
                {
                    Source = new BitmapImage(new Uri(_majorVideoContext.VideoPauseButtonImagePath))
                };

                _videoControlButton = ButtonUtility.CreateButton(_playButtonImage, "Play", null);
            }
            else
            {
                _videoControlButton = ButtonUtility.CreateButton((Image)null, "Play", null);
            }

            _videoControlButton.ToolTip = appConfig.VideoPlayToolTip;
            _videoControlButton.Click  += VideoPlayerControl_Click;
            var buttonViewBox = new Viewbox {
                Child = _videoControlButton
            };

            return(buttonViewBox);
        }
예제 #7
0
        private void PrepareGrid(Grid grid, IDictionary <string, FolderInfo> infos, bool isMajorRequest)
        {
            int columnCount, useRowIndex, useColumnIndex;

            GridUtility.PrepareBuutonGrid(grid, infos.Count, isMajorRequest, out columnCount, out useRowIndex, out useColumnIndex);

            foreach (var oneInfoPair in infos)
            {
                var button = ButtonUtility.CreateButton(oneInfoPair.Value.ImagePath, oneInfoPair.Key, oneInfoPair.Value.MoveEnterImagePath);
                if (isMajorRequest)
                {
                    MajorContext majorContext = MajorsContext.PrepareMajorContext(_majorsContext, _appConfig, oneInfoPair);
                    button.Tag    = majorContext;
                    button.Click += NavigateMajorPageButton_Click;
                }
                else
                {
                    button.Tag    = oneInfoPair.Value.Path;
                    button.Click += OpenFolderButton_Click;
                }

                GridUtility.SetButton(grid, button, isMajorRequest, columnCount, ref useRowIndex, ref useColumnIndex);
            }
        }