Files
BeWoPlaner/BeWo/View/BeWoWindowBuilder.cs

82 lines
3.0 KiB
C#

using BeWo.View.Controls;
using BeWo.ViewModel;
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
{
public static class BeWoWindowBuilder
{
public static BeWoWindow GetTextViewer(string title, string text, bool fixed_size = false, double height = 600, double width = 400)
{
if (fixed_size)
return GetTextViewer(title, text, height, height, height, width, width, width);
var min_height = Math.Min(height, 300);
var max_height = Math.Max(height, 1000);
var min_width = Math.Min(width, 200);
var max_width = Math.Max(width, 1900);
return GetTextViewer(title, text, min_height, height, max_height, min_width, width, max_width);
}
public static BeWoWindow GetTextViewer(string title, string text, double min_height, double height, double max_height, double min_width, double width, double max_width)
{
var control = new TextViewer();
control.Text = text;
var beWoWindow = GetGenericBeWoWindow(title, min_height, height, max_height, min_width, width, max_width);
beWoWindow.GroupBoxContent = control;
return beWoWindow;
}
public static BeWoWindow GetGkvAbrechnungDetailWindow(GkvAbrechnungVM vM, double height = 800, double width = 600)
{
var detail = new GkvAbrechnungDetailControl(vM);
var beWoWindow = GetGenericBeWoWindow("GKV-Abrechnung Nr. " + vM.GkvAbrechnungOid + ": Details", 100, height, 1000, 400, width, 1600);
beWoWindow.GroupBoxContent = detail;
return beWoWindow;
}
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;
}
public static void ShowErrorMessageBox(string text)
{
MessageBox.Show(text, "Fehler", MessageBoxButton.OK, MessageBoxImage.Asterisk);
}
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();
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;
}
}
}