Files
BeWoPlaner/BeWo/Services/BeWoWindowFactory.cs
2025-07-25 14:27:57 +02:00

83 lines
2.5 KiB
C#

using BeWo.View.Detail.AI;
using BeWo.View.Windows;
using BeWo.ViewModel.View;
using BS.Shared;
using DevExpress.Mvvm.Native;
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.Services
{
internal class BeWoWindowFactory : IWindowFactory
{
public Dictionary<AiContextType, string> UIContext2Header { get; set; } = new Dictionary<AiContextType, string>()
{
{AiContextType.ServiceRecord, "KI Chat: Zeiterfassung" },
{AiContextType.Customer, "KI Chat: Klienten Übersicht" },
{AiContextType.Person, "KI Chat: Personen Übersicht" },
{AiContextType.Employee, "KI Chat: Mitarbeiter Übersicht" },
{AiContextType.Organisation, "KI Chat: Organisation Übersicht" },
{AiContextType.SupportConcept, "KI Chat: Hilfeplan Übersicht" },
{AiContextType.CustomerSingle, "KI Chat: Klient" },
};
public AnimatedBeWoWindow GetAiConversationWindow(AiConversationChatViewModel viewModel, Control control, double height = 600, double width = 1200)
{
UIContext2Header.TryGetValue(viewModel.UIContext, out string title);
if (string.IsNullOrEmpty(title))
title = "default";
var window = GetAnimatedBeWoWindow(title, control,height, width);
return window;
}
private AnimatedBeWoWindow GetAnimatedBeWoWindow(string title, Control control, double height = 600, double width = 600)
{
var beWoWindow = new AnimatedBeWoWindow();
beWoWindow.Height = height;
beWoWindow.Width = width;
beWoWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
beWoWindow.Owner = BeWoApp.CurrentBeWo.MainWindow;
beWoWindow.Title = title + " Fenster";
beWoWindow.rootGroupBox.Header = title;
beWoWindow.GroupBoxContent = control;
return beWoWindow;
}
public Control GetAiModalViewWindow(AiConversationChatViewModel viewModel, Control control, double height = 600, double width = 1200)
{
UIContext2Header.TryGetValue(viewModel.UIContext, out string title);
if (string.IsNullOrEmpty(title))
title = "default";
var popup = GetAiModalViewWindow(title, control, height, width);
return popup;
}
private Control GetAiModalViewWindow(string title, Control control, double height = 600, double width = 600)
{
var popup = new GroupBox();
popup.Style = Application.Current.FindResource("PopUpWindowStyle") as Style;
popup.Header = title;
popup.Content = control;
popup.Height = height;
popup.Width = width;
return popup;
}
}
}