70 lines
2.3 KiB
C#
70 lines
2.3 KiB
C#
using BeWo.View.Windows;
|
|
using BS.Shared;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Input;
|
|
|
|
namespace BeWo.Services
|
|
{
|
|
internal class BeWoWindowService : IWindowService
|
|
{
|
|
private readonly IWindowFactory _builder;
|
|
private readonly IControlFactory _controlFactory;
|
|
|
|
public BeWoWindowService(IWindowFactory builder, IControlFactory controlFactory)
|
|
{
|
|
_builder = builder;
|
|
_controlFactory = controlFactory;
|
|
}
|
|
|
|
public void ShowAiConversationWindow(UIContext uIContext, Dictionary<TableID, long[]> bewoObjects, long? reference_oid = null)
|
|
{
|
|
//#if !DEBUG
|
|
// BeWoApp.ShowInfoMessage("Diese Funktion befindet sich in der Testphase.");
|
|
// return;
|
|
//#endif
|
|
|
|
ShowWindowDialog(
|
|
cf => cf.GetAiConversationControl(uIContext, bewoObjects, reference_oid),
|
|
(wf, ctrl) => wf.GetAiConversationWindow(uIContext, ctrl));
|
|
}
|
|
public void ShowAiConversationModalViewWindow(UIContext uIContext, Dictionary<TableID, long[]> bewoObjects, long? reference_oid = null)
|
|
{
|
|
//#if !DEBUG
|
|
// BeWoApp.ShowInfoMessage("Diese Funktion befindet sich in der Testphase.");
|
|
// return;
|
|
//#endif
|
|
|
|
ShowModalViewWindow(cf => cf.GetAiConversationControl(uIContext, bewoObjects, reference_oid),
|
|
(wf, ctrl) => wf.GetAiModalViewWindow(uIContext, ctrl));
|
|
}
|
|
|
|
private void ShowWindow(Func<IControlFactory, Control> getControl, Func<IWindowFactory, Control, Window> getWindow)
|
|
{
|
|
var control = getControl(_controlFactory);
|
|
var window = getWindow(_builder, control);
|
|
window.Show();
|
|
}
|
|
|
|
private void ShowWindowDialog(Func<IControlFactory, Control> getControl, Func<IWindowFactory, Control, Window> getWindow)
|
|
{
|
|
var control = getControl(_controlFactory);
|
|
var window = getWindow(_builder, control);
|
|
window.ShowDialog();
|
|
}
|
|
|
|
private void ShowModalViewWindow(Func<IControlFactory, Control> getControl, Func<IWindowFactory, Control, Control> getPopup)
|
|
{
|
|
var control = getControl(_controlFactory);
|
|
var window = getPopup(_builder, control);
|
|
window.CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (s, e) => BeWoApp.MainControl.CloseCurrentPopUp()));
|
|
BeWoApp.MainControl.ShowControlAsModalPopup(window);
|
|
}
|
|
}
|
|
}
|