diff --git a/dvmconsole/MainWindow.xaml b/dvmconsole/MainWindow.xaml index c1dcaf6..9c22e78 100644 --- a/dvmconsole/MainWindow.xaml +++ b/dvmconsole/MainWindow.xaml @@ -45,9 +45,6 @@ - - - @@ -57,6 +54,9 @@ + + + diff --git a/dvmconsole/MainWindow.xaml.cs b/dvmconsole/MainWindow.xaml.cs index d6f15e7..a004438 100644 --- a/dvmconsole/MainWindow.xaml.cs +++ b/dvmconsole/MainWindow.xaml.cs @@ -1123,51 +1123,6 @@ namespace dvmconsole } } - /// - /// - /// - /// - /// - private void ToggleEditMode_Click(object sender, RoutedEventArgs e) - { - isEditMode = !isEditMode; - var menuItem = (MenuItem)sender; - menuItem.Header = isEditMode ? "Disable Edit Mode" : "Enable Edit Mode"; - UpdateEditModeForWidgets(); - } - - /// - /// - /// - /// - /// - private void ResizeCanvasToWindow_Click(object sender, RoutedEventArgs e) - { - const double widthOffset = 16; - const double heightOffset = 115; - - foreach (UIElement child in channelsCanvas.Children) - { - double childLeft = Canvas.GetLeft(child) + child.RenderSize.Width; - if (childLeft > ActualWidth) - Canvas.SetLeft(child, ActualWidth - (child.RenderSize.Width + widthOffset)); - double childBottom = Canvas.GetTop(child) + child.RenderSize.Height; - if (childBottom > ActualHeight) - Canvas.SetTop(child, ActualHeight - (child.RenderSize.Height + heightOffset)); - } - - channelsCanvas.Width = ActualWidth; - canvasScrollViewer.Width = ActualWidth; - channelsCanvas.Height = ActualHeight; - canvasScrollViewer.Height = ActualHeight; - - settingsManager.CanvasWidth = ActualWidth; - settingsManager.CanvasHeight = ActualHeight; - - settingsManager.WindowWidth = ActualWidth; - settingsManager.WindowHeight = ActualHeight; - } - /// /// /// @@ -1227,6 +1182,30 @@ namespace dvmconsole } } + /// + /// + /// + /// + /// + private void OpenUserBackground_Click(object sender, RoutedEventArgs e) + { + if (!windowLoaded) + return; + + OpenFileDialog openFileDialog = new OpenFileDialog + { + Filter = "JPEG Files (*.jpg)|*.jpg|PNG Files (*.png)|*.png|All Files (*.*)|*.*", + Title = "Open User Background" + }; + + if (openFileDialog.ShowDialog() == true) + { + settingsManager.UserBackgroundImage = openFileDialog.FileName; + settingsManager.SaveSettings(); + UpdateBackground(); + } + } + /// /// /// @@ -1246,23 +1225,44 @@ namespace dvmconsole /// /// /// - private void OpenUserBackground_Click(object sender, RoutedEventArgs e) + private void ToggleEditMode_Click(object sender, RoutedEventArgs e) { - if (!windowLoaded) - return; + isEditMode = !isEditMode; + var menuItem = (MenuItem)sender; + menuItem.Header = isEditMode ? "Disable Edit Mode" : "Enable Edit Mode"; + UpdateEditModeForWidgets(); + } - OpenFileDialog openFileDialog = new OpenFileDialog - { - Filter = "JPEG Files (*.jpg)|*.jpg|PNG Files (*.png)|*.png|All Files (*.*)|*.*", - Title = "Open User Background" - }; + /// + /// + /// + /// + /// + private void ResizeCanvasToWindow_Click(object sender, RoutedEventArgs e) + { + const double widthOffset = 16; + const double heightOffset = 115; - if (openFileDialog.ShowDialog() == true) + foreach (UIElement child in channelsCanvas.Children) { - settingsManager.UserBackgroundImage = openFileDialog.FileName; - settingsManager.SaveSettings(); - UpdateBackground(); + double childLeft = Canvas.GetLeft(child) + child.RenderSize.Width; + if (childLeft > ActualWidth) + Canvas.SetLeft(child, ActualWidth - (child.RenderSize.Width + widthOffset)); + double childBottom = Canvas.GetTop(child) + child.RenderSize.Height; + if (childBottom > ActualHeight) + Canvas.SetTop(child, ActualHeight - (child.RenderSize.Height + heightOffset)); } + + channelsCanvas.Width = ActualWidth; + canvasScrollViewer.Width = ActualWidth; + channelsCanvas.Height = ActualHeight; + canvasScrollViewer.Height = ActualHeight; + + settingsManager.CanvasWidth = ActualWidth; + settingsManager.CanvasHeight = ActualHeight; + + settingsManager.WindowWidth = ActualWidth; + settingsManager.WindowHeight = ActualHeight; } /** Widget Controls */