Files
BeWoPlaner/BeWo/Services/BeWoControlFactory.cs

72 lines
2.0 KiB
C#
Raw Normal View History

2025-11-03 10:41:52 +01:00
using BeWo.View.Controls;
using BeWo.View.Detail.AI;
2025-05-14 10:05:15 +02:00
using BeWo.ViewModel;
2025-11-05 11:49:53 +01:00
using BeWo.ViewModel.View.AI;
using BeWo.ViewModel.Light;
2025-04-15 12:44:38 +02:00
using BS.Shared;
using System;
using System.Collections.Generic;
2025-05-27 09:24:12 +02:00
using System.IO;
2025-04-15 12:44:38 +02:00
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2025-04-22 10:11:51 +02:00
using System.Windows;
2025-04-15 12:44:38 +02:00
using System.Windows.Controls;
namespace BeWo.Services
{
2025-11-03 10:41:52 +01:00
public class BeWoControlFactory : IControlFactory
2025-04-15 12:44:38 +02:00
{
2025-05-14 10:05:15 +02:00
public Control GetAiConversationControl(AiConversationChatViewModel vm)
2025-04-15 12:44:38 +02:00
{
2025-05-14 10:05:15 +02:00
var styleString = getStyleString(vm.UIContext);
2025-04-15 12:44:38 +02:00
2025-05-14 10:05:15 +02:00
var control = styleString is object ? new AiConversationChatView(vm, styleString) : new AiConversationChatView(vm);
2025-04-15 12:44:38 +02:00
return control;
2025-05-07 09:52:40 +02:00
}
2025-05-27 09:24:12 +02:00
public PdfViewer GetPdfViewer(byte[] bytes) => GetPdfViewer(new MemoryStream(bytes));
public PdfViewer GetPdfViewer(MemoryStream ms)
{
var control = new PdfViewer();
control.PdfData = ms;
return control;
}
public TextViewer GetTextViewer(string text)
{
var textViewer = new TextViewer();
textViewer.Text = text;
return textViewer;
}
public GkvAbrechnungDetailControl GetGkvAbrechnungDetailControl(GkvAbrechnungLightVM vm)
{
var control = new GkvAbrechnungDetailControl(vm);
return control;
}
2025-07-25 14:27:57 +02:00
private string getStyleString(AiContextType uIContext) {
2025-05-07 09:52:40 +02:00
switch (uIContext)
{
2025-09-08 15:17:51 +02:00
case AiContextType.SupportConceptNavigation: return "ModuleAiControlSupportConceptStyle";
case AiContextType.CustomerNavigation: return "ModuleAiControlCustomerStyle";
case AiContextType.PersonNavigation: return "ModuleAiControlPersonStyle";
case AiContextType.EmployeeNavigation: return "ModuleAiControlEmployeeStyle";
case AiContextType.OrganisationNavigation: return "ModuleAiControlOrganisationStyle";
2025-07-25 14:27:57 +02:00
case AiContextType.ServiceRecord: return "ModuleAiControlZeiterfassungStyle";
2025-09-08 15:17:51 +02:00
case AiContextType.CustomerDetail: return "ModuleAiControlCustomerStyle";
case AiContextType.PersonDetail: return "ModuleAiControlPersonStyle";
case AiContextType.EmployeeDetail: return "ModuleAiControlEmployeeStyle";
2025-05-07 09:52:40 +02:00
}
return null;
}
2025-04-15 12:44:38 +02:00
}
2025-05-07 09:52:40 +02:00
}