using BeWo.ViewModel; using BeWo.ViewModel.Light; using BS.Shared.Extensions; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; namespace BeWo.View.Windows { public static class BeWoWindowBuilder { public static BeWoWindow GetBeWoWindow(String title, Control control, double height = 600, double width = 1200) { var beWoWindow = GetGenericBeWoWindow(title, 100, height, 1000, 100, width, 1600); beWoWindow.GroupBoxContent = control; return beWoWindow; } private static BeWoWindow GetGenericBeWoWindow(string title, double min_height, double height, double max_height, double min_width, double width, double max_width) { var beWoWindow = new BeWoWindow(); if (min_height > height || height > max_height) throw new InvalidOperationException($"Window Height: {min_height} < {height} < {max_height}"); if (min_width > width || width > max_width) throw new InvalidOperationException($"Window Width: {min_width} < {width} < {max_width}"); beWoWindow.Height = height; beWoWindow.MinHeight = min_height; beWoWindow.MaxHeight = max_height; beWoWindow.Width = width; beWoWindow.MinWidth = min_width; beWoWindow.MaxHeight = max_width; beWoWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; beWoWindow.Owner = BeWoApp.CurrentBeWo.MainWindow; beWoWindow.Title = "Popup"; beWoWindow.rootGroupBox.Header = title; return beWoWindow; } public static void ShowErrorMessageBox(string text) { MessageBox.Show(text, "Fehler", MessageBoxButton.OK, MessageBoxImage.Asterisk); } public static void ShowTitleErrorMessageBox(string text, string title) { if (title.IsNullOrWhiteSpace()) ShowErrorMessageBox(text); else MessageBox.Show(text, "Fehler", MessageBoxButton.OK, MessageBoxImage.Asterisk); } } }