Files
BeWoPlaner/BeWo/View/Windows/BeWoWindowBuilder.cs
Rene Evertz e2f72fbea0 Merge branch 'master' into feature_rene_17_xrechnung
# Conflicts:
#	BeWo/ServiceProxy/Generated.cs
#	BeWo/Services/BeWoWindowService.cs
#	BeWo/View/Controls/GkvAbrechnungDetailControl.xaml.cs
#	BeWo/View/Windows/BeWoWindowBuilder.cs
#	Data/Data.csproj
#	Host/ServiceRecordPage.aspx.cs
#	Service/Core/ServiceHelper.cs
#	Service/Security/SecurityContextInitializer.cs
#	Service/ServiceBehavior/AdminMultitenancyContextInitializer.cs
2025-06-17 13:07:41 +02:00

67 lines
2.2 KiB
C#

using BeWo.View.Controls;
using BeWo.View.Detail;
using BeWo.View.Detail.AI;
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);
}
}
}