Files
BeWoPlaner/BeWo/Services/BeWoControlFactory.cs
2025-05-27 09:24:12 +02:00

84 lines
2.4 KiB
C#

using BeWo.View.Controls;
using BeWo.View.Detail.AI;
using BS.Shared;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
namespace BeWo.Services
{
internal class BeWoControlFactory : IControlFactory
{
public Control GetAiConversationControl(UIContext uIContext, Dictionary<TableID, long[]> context, long? reference_oid = null)
{
var styleString = getStyleString(uIContext);
var control = styleString is object ? new AiConversationChatView(styleString) : new AiConversationChatView();
control.ViewModel.UIContext = (int)uIContext;
control.ViewModel.ReferenceObjectOid = reference_oid;
control.ViewModel.ContextBeWoObjects = context;
return control;
}
public PdfViewer GetPdfViewer(byte[] bytes) => GetPdfViewer(new MemoryStream(bytes));
public PdfViewer GetPdfViewer(MemoryStream ms)
{
var control = new PdfViewer();
control.PdfData = ms;
return control;
}
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;
}
}
}