public StandardPage() { if (GameObject.GetInstance().PagePerformanceCounterEnabled) { sw = new Stopwatch(); sw.Start(); this.Loaded += new RoutedEventHandler(StandardPage_Loaded); } this.Width = SystemParameters.PrimaryScreenWidth; this.Height = SystemParameters.PrimaryScreenHeight; int sideMargin = 200; int regularMargin = 25; int menuHeight = 25; int bottomMenuHeight = 25; ImageBrush imgBackground = new ImageBrush(); BitmapImage img = (BitmapImage)App.Current.Resources["BackgroundImage"]; imgBackground.ImageSource = (BitmapImage)FindResource("BackgroundImage"); imgBackground.Viewport = new Rect(0, 0, this.Width, this.Height); imgBackground.ViewportUnits = BrushMappingMode.Absolute; imgBackground.TileMode = TileMode.Tile; this.Background = imgBackground; mainPanel = new Canvas(); frameTopMenu = new Frame(); frameTopMenu.Height = menuHeight; frameTopMenu.Width = this.Width; frameTopMenu.NavigationUIVisibility = NavigationUIVisibility.Hidden; frameTopMenu.Navigate(new PageStandardMenuTop()); Canvas.SetTop(frameTopMenu, 0); Canvas.SetLeft(frameTopMenu, 0); mainPanel.Children.Add(frameTopMenu); panelNavigation = new DockPanel(); panelNavigation.Margin = new Thickness(0, 5, 0, 0); btnPrevious = new Button(); btnPrevious.SetResourceReference(Button.StyleProperty, "RoundedButton"); btnPrevious.Height = 24; btnPrevious.Width = 32; btnPrevious.Content = "<-"; btnPrevious.Margin = new Thickness(2, 0, 0, 0); btnPrevious.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); btnPrevious.Click += new RoutedEventHandler(btnPrevious_Click); panelNavigation.Children.Add(btnPrevious); btnPrevious.ToolTip = UICreator.CreateToolTip("1001"); btnNext = new Button(); btnNext.SetResourceReference(Button.StyleProperty, "RoundedButton"); btnNext.Height = 24; btnNext.Margin = new Thickness(2, 0, 0, 0); btnNext.Width = 32; btnNext.Content = "->"; btnNext.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); btnNext.Click += new RoutedEventHandler(btnNext_Click); panelNavigation.Children.Add(btnNext); btnNext.ToolTip = UICreator.CreateToolTip("1002"); btnPause = new Button(); btnPause.SetResourceReference(Button.StyleProperty, "RoundedButton"); btnPause.Height = 24; btnPause.Width = 32; btnPause.Margin = new Thickness(2, 0, 0, 0); btnPause.Content = "||"; btnPause.Visibility = GameTimer.GetInstance().isPaused() ? Visibility.Collapsed : Visibility.Visible; btnPause.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); btnPause.Click += new RoutedEventHandler(btnPause_Click); panelNavigation.Children.Add(btnPause); btnPause.ToolTip = UICreator.CreateToolTip("1003"); btnStart = new Button(); btnStart.SetResourceReference(Button.StyleProperty, "RoundedButton"); btnStart.Height = 24; btnStart.Width = 32; btnStart.Visibility = GameTimer.GetInstance().isPaused() ? Visibility.Visible : System.Windows.Visibility.Collapsed; btnStart.Margin = new Thickness(2, 0, 0, 0); btnStart.Content = ">"; btnStart.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); btnStart.Click += new RoutedEventHandler(btnStart_Click); panelNavigation.Children.Add(btnStart); btnStart.ToolTip = UICreator.CreateToolTip("1004"); Button btnThreadState = new Button(); btnThreadState.Visibility = System.Windows.Visibility.Collapsed; btnThreadState.SetResourceReference(Button.StyleProperty, "RoundedButton"); btnThreadState.Height = Double.NaN; btnThreadState.Width = Double.NaN; btnThreadState.Margin = new Thickness(2, 0, 0, 0); btnThreadState.Content = "Thread state"; btnThreadState.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); btnThreadState.Click += btnThreadState_Click; panelNavigation.Children.Add(btnThreadState); Canvas.SetTop(panelNavigation, frameTopMenu.Height); Canvas.SetLeft(panelNavigation, 0); mainPanel.Children.Add(panelNavigation); Frame frameTop = new Frame(); frameTop.Height = 75; frameTop.Width = this.Width - 2 * sideMargin; frameTop.NavigationUIVisibility = NavigationUIVisibility.Hidden; this.PageHeader = new PageHeader(); frameTop.Navigate(this.PageHeader); Canvas.SetTop(frameTop, frameTopMenu.Height + regularMargin); Canvas.SetRight(frameTop, sideMargin); mainPanel.Children.Add(frameTop); Frame frameContent = new Frame(); frameContent.SizeChanged += new SizeChangedEventHandler(frameContent_SizeChanged); frameContent.Height = this.Height - Canvas.GetTop(frameTop) - 150; frameContent.Width = this.Width - 2 * sideMargin; frameContent.NavigationUIVisibility = NavigationUIVisibility.Hidden; this.PageContent = new PageContent(); frameContent.Navigate(this.PageContent); Canvas.SetTop(frameContent, Canvas.GetTop(frameTop) + frameTop.Height + regularMargin); Canvas.SetLeft(frameContent, sideMargin); mainPanel.Children.Add(frameContent); frameInformation = new Frame(); frameInformation.Height = frameTopMenu.Height; frameInformation.Width = 125; frameInformation.NavigationUIVisibility = NavigationUIVisibility.Hidden; frameInformation.Navigate(new PageInformation()); Canvas.SetTop(frameInformation, 0); Canvas.SetRight(frameInformation, 0); mainPanel.Children.Add(frameInformation); frameBottomMenu = new Frame(); frameBottomMenu.Height = bottomMenuHeight; frameBottomMenu.Width = this.Width; frameBottomMenu.NavigationUIVisibility = NavigationUIVisibility.Hidden; frameBottomMenu.Navigate(new PageBottomMenu()); Canvas.SetBottom(frameBottomMenu, 0); Canvas.SetLeft(frameBottomMenu, 0); mainPanel.Children.Add(frameBottomMenu); this.Content = this.mainPanel; }
public StandardPage() { if (GameObject.GetInstance().PagePerformanceCounterEnabled) { sw = new Stopwatch(); sw.Start(); this.Loaded += new RoutedEventHandler(StandardPage_Loaded); } this.Width = SystemParameters.PrimaryScreenWidth; this.Height = SystemParameters.PrimaryScreenHeight; int sideMargin = 200; int regularMargin = 25; int menuHeight = 25; int bottomMenuHeight = 25; ImageBrush imgBackground = new ImageBrush(); BitmapImage img = (BitmapImage)App.Current.Resources["BackgroundImage"]; imgBackground.ImageSource = (BitmapImage)FindResource("BackgroundImage"); imgBackground.Viewport = new Rect(0, 0, this.Width, this.Height); imgBackground.ViewportUnits = BrushMappingMode.Absolute; imgBackground.TileMode = TileMode.Tile; this.Background = imgBackground; mainPanel = new Canvas(); frameTopMenu = new Frame(); frameTopMenu.Height = menuHeight; frameTopMenu.Width = this.Width; frameTopMenu.NavigationUIVisibility = NavigationUIVisibility.Hidden; frameTopMenu.Navigate(new PageStandardMenuTop()); Canvas.SetTop(frameTopMenu, 0); Canvas.SetLeft(frameTopMenu, 0); mainPanel.Children.Add(frameTopMenu); panelNavigation = new DockPanel(); panelNavigation.Margin = new Thickness(0, 5, 0, 0); btnPrevious = new Button(); btnPrevious.SetResourceReference(Button.StyleProperty, "RoundedButton"); btnPrevious.Height = 24; btnPrevious.Width = 32; btnPrevious.Content = "<-"; btnPrevious.Margin = new Thickness(2, 0, 0, 0); btnPrevious.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); btnPrevious.Click += new RoutedEventHandler(btnPrevious_Click); panelNavigation.Children.Add(btnPrevious); btnPrevious.ToolTip = UICreator.CreateToolTip("1001"); btnNext = new Button(); btnNext.SetResourceReference(Button.StyleProperty, "RoundedButton"); btnNext.Height = 24; btnNext.Margin = new Thickness(2, 0, 0, 0); btnNext.Width = 32; btnNext.Content = "->"; btnNext.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); btnNext.Click += new RoutedEventHandler(btnNext_Click); panelNavigation.Children.Add(btnNext); btnNext.ToolTip = UICreator.CreateToolTip("1002"); btnPause = new Button(); btnPause.SetResourceReference(Button.StyleProperty, "RoundedButton"); btnPause.Height = 24; btnPause.Width = 32; btnPause.Margin = new Thickness(2, 0, 0, 0); btnPause.Content = "||"; btnPause.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); btnPause.Click += new RoutedEventHandler(btnPause_Click); panelNavigation.Children.Add(btnPause); btnPause.ToolTip = UICreator.CreateToolTip("1003"); btnStart = new Button(); btnStart.SetResourceReference(Button.StyleProperty, "RoundedButton"); btnStart.Height = 24; btnStart.Width = 32; btnStart.Margin = new Thickness(2, 0, 0, 0); btnStart.Content = ">"; btnStart.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); btnStart.Click += new RoutedEventHandler(btnStart_Click); panelNavigation.Children.Add(btnStart); btnStart.ToolTip = UICreator.CreateToolTip("1004"); Button btnThreadState = new Button(); btnThreadState.Visibility = System.Windows.Visibility.Collapsed; btnThreadState.SetResourceReference(Button.StyleProperty, "RoundedButton"); btnThreadState.Height = Double.NaN; btnThreadState.Width = Double.NaN; btnThreadState.Margin = new Thickness(2, 0, 0, 0); btnThreadState.Content = "Thread state"; btnThreadState.SetResourceReference(Button.BackgroundProperty, "ButtonBrush"); btnThreadState.Click += btnThreadState_Click; panelNavigation.Children.Add(btnThreadState); Canvas.SetTop(panelNavigation, frameTopMenu.Height); Canvas.SetLeft(panelNavigation, 0); mainPanel.Children.Add(panelNavigation); Frame frameTop = new Frame(); frameTop.Height = 75; frameTop.Width = this.Width - 2 * sideMargin; frameTop.NavigationUIVisibility = NavigationUIVisibility.Hidden; this.PageHeader = new PageHeader(); frameTop.Navigate(this.PageHeader); Canvas.SetTop(frameTop, frameTopMenu.Height + regularMargin); Canvas.SetRight(frameTop, sideMargin); mainPanel.Children.Add(frameTop); Frame frameContent = new Frame(); frameContent.SizeChanged += new SizeChangedEventHandler(frameContent_SizeChanged); frameContent.Height = this.Height - Canvas.GetTop(frameTop) - 150; frameContent.Width = this.Width - 2 * sideMargin; frameContent.NavigationUIVisibility = NavigationUIVisibility.Hidden; this.PageContent = new PageContent(); frameContent.Navigate(this.PageContent); Canvas.SetTop(frameContent, Canvas.GetTop(frameTop) + frameTop.Height + regularMargin); Canvas.SetLeft(frameContent, sideMargin); mainPanel.Children.Add(frameContent); frameInformation = new Frame(); frameInformation.Height = frameTopMenu.Height; frameInformation.Width = 125; frameInformation.NavigationUIVisibility = NavigationUIVisibility.Hidden; frameInformation.Navigate(new PageInformation()); Canvas.SetTop(frameInformation, 0); Canvas.SetRight(frameInformation, 0); mainPanel.Children.Add(frameInformation); frameBottomMenu = new Frame(); frameBottomMenu.Height = bottomMenuHeight; frameBottomMenu.Width = this.Width; frameBottomMenu.NavigationUIVisibility = NavigationUIVisibility.Hidden; frameBottomMenu.Navigate(new PageBottomMenu()); Canvas.SetBottom(frameBottomMenu, 0); Canvas.SetLeft(frameBottomMenu, 0); mainPanel.Children.Add(frameBottomMenu); this.Content = this.mainPanel; }