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); }
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); }
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); } }
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); } }
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); } }