Files
BeWoPlaner/BeWo/Services/BeWoControlFactory.cs

104 lines
2.7 KiB
C#
Raw Normal View History

2025-05-27 09:24:12 +02:00
using BeWo.View.Controls;
using BeWo.View.Detail.AI;
using BeWo.ViewModel;
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
{
internal class BeWoControlFactory : IControlFactory
{
2025-05-05 13:08:09 +02:00
public Control GetAiConversationControl(UIContext uIContext, Dictionary<TableID, long[]> context, long? reference_oid = null)
2025-04-15 12:44:38 +02:00
{
2025-05-07 09:52:40 +02:00
var styleString = getStyleString(uIContext);
var control = styleString is object ? new AiConversationChatView(styleString) : new AiConversationChatView();
2025-04-15 12:44:38 +02:00
control.ViewModel.UIContext = (int)uIContext;
2025-05-05 13:08:09 +02:00
control.ViewModel.ReferenceObjectOid = reference_oid;
2025-04-15 12:44:38 +02:00
control.ViewModel.ContextBeWoObjects = context;
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-05-07 09:52:40 +02:00
private string getStyleString(UIContext uIContext) {
switch (uIContext)
{
case UIContext.SupportConcept: return "ModuleAiControlSupportConceptStyle";
case UIContext.Customer: return "ModuleAiControlCustomerStyle";
case UIContext.Person: return "ModuleAiControlPersonStyle";
case UIContext.Employee: return "ModuleAiControlEmployeeStyle";
case UIContext.Organisation: return "ModuleAiControlOrganisationStyle";
case UIContext.Team:
break;
case UIContext.Dokumente:
break;
case UIContext.User:
break;
case UIContext.UserGroup:
break;
case UIContext.Report:
break;
case UIContext.Scheduler:
break;
case UIContext.Wohnheim:
break;
case UIContext.Vertretungen:
break;
case UIContext.CustomerTeam:
break;
case UIContext.Scheduling:
break;
case UIContext.Finance:
break;
case UIContext.Administration:
break;
case UIContext.AiConversation:
break;
case UIContext.AiConversationPopup:
break;
case UIContext.ServiceRecord: return "ModuleAiControlZeiterfassungStyle";
case UIContext.CustomerSingle: return "ModuleAiControlCustomerStyle";
case UIContext.PersonSingle: return "ModuleAiControlPersonStyle";
case UIContext.EmployeeSingle: return "ModuleAiControlEmployeeStyle";
}
return null;
}
2025-04-15 12:44:38 +02:00
}
2025-05-07 09:52:40 +02:00
}