2016-06-27 01:45:38 +02:00
using System ;
using System.Collections.Generic ;
using System.ComponentModel ;
using System.Diagnostics ;
2025-04-15 13:21:03 +02:00
using System.IO.Ports ;
2016-06-27 01:45:38 +02:00
using System.Linq ;
2025-04-15 12:44:38 +02:00
using System.Runtime.Remoting.Contexts ;
2016-06-27 01:45:38 +02:00
using System.Security.Cryptography ;
using System.Text ;
using System.Windows ;
using System.Windows.Controls ;
using System.Windows.Input ;
using System.Windows.Media ;
using System.Windows.Media.Animation ;
using System.Windows.Navigation ;
using System.Windows.Threading ;
using BeWo.Core ;
using BeWo.Core.Config ;
using BeWo.Core.Service ;
2019-02-28 12:38:29 +01:00
using BeWo.Scheduler.View ;
2017-11-23 10:58:07 +01:00
using BeWo.SchulbegleitenderDienst ;
2016-06-27 01:45:38 +02:00
using BeWo.ServiceProxy ;
2025-04-15 12:44:38 +02:00
using BeWo.Services ;
2016-06-27 01:45:38 +02:00
using BeWo.View ;
using BeWo.View.Detail ;
2022-04-25 15:45:02 +02:00
using BeWo.View.Detail.Zeiterfassung ;
2024-12-13 00:27:31 +01:00
using BeWo.View.Document ;
2016-06-27 01:45:38 +02:00
using BeWo.View.Master ;
using BeWo.View.Navigation ;
2025-04-10 13:46:58 +02:00
using BeWo.View.Windows ;
2016-06-27 01:45:38 +02:00
using BeWo.ViewModel ;
using BS.Shared ;
2024-12-03 14:43:26 +01:00
using BS.Shared.Core ;
2016-06-27 01:45:38 +02:00
using BS.Shared.DataContracts ;
using BS.Shared.Extensions ;
2020-11-10 02:25:15 +01:00
using BS.Shared.Translation ;
2025-04-15 12:44:38 +02:00
using DevExpress.XtraEditors ;
2025-09-12 14:25:54 +02:00
using DevExpress.XtraReports.Design ;
2016-06-27 01:45:38 +02:00
using Hyperlink = System . Windows . Documents . Hyperlink ;
namespace BeWo
{
public enum UIContext
{
2025-04-02 16:01:21 +02:00
SupportConcept = 0 ,
Customer = 1 ,
Person = 2 ,
Employee = 3 ,
Organisation = 4 ,
Team = 5 ,
Dokumente = 6 ,
User = 7 ,
UserGroup = 8 ,
Report = 9 ,
Scheduler = 10 ,
Wohnheim = 11 ,
Vertretungen = 12 ,
CustomerTeam = 13 ,
Scheduling = 14 ,
Finance = 15 ,
Administration = 16 ,
2025-04-14 10:15:45 +02:00
ServiceRecord = 19 ,
2022-10-11 16:48:36 +02:00
}
2016-06-27 01:45:38 +02:00
2018-02-19 10:52:48 +01:00
public partial class MainControl
2016-06-27 01:45:38 +02:00
{
private const string _PINInfoText = "Um Zugriff auf Ihre Daten zu bekommen, benötigen wir eine PIN." ;
2018-02-19 10:52:48 +01:00
private readonly Stack < Control > _ModalPopupControls = new Stack < Control > ( ) ;
2016-06-27 01:45:38 +02:00
private BeWoView _CurrentDetailView ;
2018-02-19 10:52:48 +01:00
private Control _CurrentModalPopup ;
2016-06-27 01:45:38 +02:00
2019-08-09 17:10:17 +02:00
private HomeView _HomeView ;
2016-06-27 01:45:38 +02:00
2025-03-28 10:28:19 +01:00
private bool _TermineInitialized ;
2016-06-27 01:45:38 +02:00
private Dictionary < UIContext , BeWoView > _Views = new Dictionary < UIContext , BeWoView > ( ) ;
private WaitLayer2 _WaitLayer ;
public MainControl ( )
{
InitializeComponent ( ) ;
BeWoApp . MainControl = this ;
InitCommandBindings ( ) ;
KeyDown + = MainControl_KeyDown ;
NavigateToHomeView ( ) ;
2024-09-04 13:54:23 +02:00
#if DEBUG
if ( DebugConfig . CurrentConfig is object & & DebugConfig . CurrentConfig . SelectView is UIContext context )
{
2025-09-12 14:25:54 +02:00
if ( context = = UIContext . ServiceRecord )
NavigateToServiceRecordView ( null ) ;
else
NavigateTo ( GetViewForUIContext ( context ) ) ;
2024-09-04 13:54:23 +02:00
}
#endif
2024-06-05 14:45:33 +02:00
// ToDo: Neuer Kalender nur im Debug-Modus!
#if DEBUG
2024-09-04 13:54:23 +02:00
ButtonScheduling . Visibility = Visibility . Visible ;
2024-06-05 14:45:33 +02:00
#else
2024-06-12 16:46:46 +02:00
ButtonScheduling . Visibility = Visibility . Collapsed ;
2024-06-05 14:45:33 +02:00
#endif
2020-08-17 15:50:00 +02:00
//EditorLocalizer.Active = new CustomDXEditorLocalizer();
//SchedulerControlLocalizer.Active = new CustomSchedulerLocalizer();
2023-06-18 17:11:35 +02:00
//GridControlLocalizer.Active = new CustomGridLocalizer();
// ToDo: Testen!
2024-06-05 14:45:33 +02:00
// var bewoClientType = BeWoApp.Mandator.BeWoClientType;
2023-06-22 09:35:51 +02:00
//var hasKilometerauswertung = BeWoApp.AppSettings.ShowDistanceFields && (BeWoApp.LoggedOnUser.HasRight(UserRightType.Kilometerauswertung_View) || BeWoApp.LoggedOnUser.HasRight(UserRightType.KilometerauswertungEigene_View));
//var hideAuswertungen = !BeWoApp.LoggedOnUser.HasRight(UserRightType.Auswertungen_BerichteAnsehen) &&
2024-06-05 14:45:33 +02:00
// !BeWoApp.LoggedOnUser.HasRight(UserRightType.Auswertungen_StundenuebersichtAnsehen) &&
// !BeWoApp.LoggedOnUser.HasRight(UserRightType.Auswertungen_HilfeplanuebersichtAnsehen) &&
// !BeWoApp.LoggedOnUser.HasRight(UserRightType.Analysis_ServiceOverview_View) &&
// !BeWoApp.LoggedOnUser.HasRight(UserRightType.Analysis_Auslastung_View) &&
// (bewoClientType != 3 || !BeWoApp.LoggedOnUser.HasRight(UserRightType.Analysis_EmployeeOverviewAll_View)) &&
// (BeWoApp.Tenant == "3010479871" || (!BeWoApp.LoggedOnUser.HasRight(UserRightType.Mitarbeiterstundenkonto_ViewAll) && !BeWoApp.LoggedOnUser.HasRight(UserRightType.Mitarbeiterstundenkonto_ViewSelf) && !BeWoApp.LoggedOnUser.HasRight(UserRightType.Mitarbeiterstundenkonto_ViewTeams))) &&
// !BeWoApp.LoggedOnUser.HasRight(UserRightType.Jahresbericht) &&
// !BeWoApp.Mandator.AllowSbd &&
// !(BeWoApp.AppSettings.ShowPivotGrid && BeWoApp.LoggedOnUser.HasRight(UserRightType.PivotTabelleAnsehen)) &&
// !(BeWoApp.AppSettings.ShowDienstplanung && BeWoApp.LoggedOnUser.HasRight(UserRightType.DienstplanungAnsehen)) &&
// !(BeWoApp.AppSettings.ShowUrlaubsplanung && BeWoApp.LoggedOnUser.HasRight(UserRightType.AbwesenheitsPlanungAnsehen)) &&
// !BeWoApp.LoggedOnUser.HasRight(UserRightType.BewertungAuswertung_View) &&
// !BeWoApp.LoggedOnUser.HasRight(UserRightType.Analysis_ServiceOverview_View) &&
// !hasKilometerauswertung;
2023-06-18 17:11:35 +02:00
2023-06-22 09:35:51 +02:00
//if(hideAuswertungen)
2024-06-05 14:45:33 +02:00
// {
// button_Reports.Visibility = Visibility.Collapsed;
// }
2016-06-27 01:45:38 +02:00
OpenedModalViewWindows = new List < ModalViewWindow > ( ) ;
2025-03-28 10:28:19 +01:00
if ( ! string . IsNullOrWhiteSpace ( BeWoApp . AppSettings . TimeRecordingMenuName ) )
{
button_serviceRecord . Content = BeWoApp . AppSettings . TimeRecordingMenuName ;
}
2017-11-23 10:58:07 +01:00
2025-03-28 10:28:19 +01:00
BeWoApp . InitAutoUILocking ( ) ;
2017-11-23 10:58:07 +01:00
2020-12-16 21:49:47 +01:00
AufOffeneTerminePruefen ( ) ;
2026-05-03 23:57:29 +02:00
//BeWoApp.InitBlubb();
2019-02-28 12:38:29 +01:00
2018-02-26 17:34:55 +01:00
#if ! DEBUG
2017-11-23 10:58:07 +01:00
if ( this . button_Scheduler . Visibility = = Visibility . Visible & & ! BeWoApp . AppSettings . IsSchedulerAllowed )
{
this . button_Scheduler . Visibility = Visibility . Collapsed ;
}
2017-11-07 13:46:55 +01:00
if ( this . button_Wohnheim . Visibility = = Visibility . Visible & & ! BeWoApp . AppSettings . IsWohnheimAllowed )
{
this . button_Wohnheim . Visibility = Visibility . Collapsed ;
}
2016-06-27 01:45:38 +02:00
2017-11-23 10:58:07 +01:00
if ( this . button_ResourceBooking . Visibility = = Visibility . Visible & & ! BeWoApp . AppSettings . ShowRessources )
{
this . button_ResourceBooking . Visibility = Visibility . Collapsed ;
}
if ( BeWoApp . Mandator = = null | | ! BeWoApp . Mandator . AllowSbd )
2017-05-22 11:14:48 +02:00
{
this . button_SchulbegleitenderDienst . Visibility = Visibility . Collapsed ;
}
2025-05-26 14:52:32 +02:00
2026-05-15 11:46:23 +02:00
if ( BeWoApp . LoggedOnUser ! = null & & BeWoApp . LoggedOnUser . HasRight ( UserRightType . DocumentsAllowViewAll ) & & BeWoApp . AppSettings . ShowVorlagen & & ( BeWoApp . LoggedOnUser . HasRight ( UserRightType . VorlagenViewAll ) | | BeWoApp . LoggedOnUser . HasRight ( UserRightType . VorlagenViewOwnTeams ) ) )
2025-05-26 14:52:32 +02:00
{
this . button_Dokumente . Visibility = Visibility . Visible ;
}
else
{
this . button_Dokumente . Visibility = Visibility . Collapsed ;
}
2017-11-23 10:58:07 +01:00
#endif
2022-10-11 16:48:36 +02:00
2024-09-04 13:54:23 +02:00
#if DEBUG
2026-05-03 23:57:29 +02:00
//DebugHelperViewButton.Visibility = Visibility.Visible;
2022-10-11 16:48:36 +02:00
#endif
2024-12-03 14:43:26 +01:00
2026-05-03 23:57:29 +02:00
UpdateMandator ( ) ;
2025-04-15 12:44:38 +02:00
2026-06-10 15:41:31 +02:00
#if DEBUG
if ( DebugConfig . CurrentConfig is DebugConfig config & & config . EnableDeveloperView )
{
WindowService . ShowDeveloper ( ) ;
}
#endif
2025-04-15 12:44:38 +02:00
}
2026-06-10 15:41:31 +02:00
public IBeWoWindowService WindowService = > BeWoApp . WindowService ;
2025-04-15 12:44:38 +02:00
private AnimatedBeWoWindow _CurrentAnimatedBeWoWindow ;
public AnimatedBeWoWindow CurrentAnimatedBeWoWindow
{
get = > _CurrentAnimatedBeWoWindow ;
set
{
if ( value = = _CurrentAnimatedBeWoWindow )
return ;
_CurrentAnimatedBeWoWindow = value ;
if ( value is null )
2025-04-15 13:21:03 +02:00
HideModalBackgroundFade ( . 5 ) ;
2025-04-15 12:44:38 +02:00
else
{
2025-04-15 13:21:03 +02:00
ShowModalBackgroundFade ( . 5 ) ;
2025-04-15 12:44:38 +02:00
}
}
2024-09-04 13:54:23 +02:00
}
2016-06-27 01:45:38 +02:00
2025-03-28 10:28:19 +01:00
public List < ModalViewWindow > OpenedModalViewWindows { get ; set ; }
2016-06-27 01:45:38 +02:00
internal Dictionary < UIContext , BeWoView > Views
{
get { return _Views ; }
}
2018-02-19 10:52:48 +01:00
public Grid ModalPopupBackGround { get ; private set ; }
2016-06-27 01:45:38 +02:00
2019-08-09 17:10:17 +02:00
public HomeView HomeView
2016-06-27 01:45:38 +02:00
{
get { return _HomeView ; }
set { _HomeView = value ; }
}
public BeWoView ActiveView
{
get
{
if ( DetailFrame . Children . Count > 0 )
{
return DetailFrame . Children [ 0 ] as BeWoView ;
}
return null ;
}
}
2018-02-19 10:52:48 +01:00
public bool IsMaximized { get ; set ; }
2016-06-27 01:45:38 +02:00
2024-08-26 13:02:39 +02:00
public bool IsModalPopupOpen = > _CurrentModalPopup is object ;
2025-03-28 10:28:19 +01:00
private bool _HatNeueTermine ;
2016-06-27 01:45:38 +02:00
public bool HatNeueTermine
{
2019-02-28 12:38:29 +01:00
get = > _HatNeueTermine ;
2025-03-28 10:28:19 +01:00
set
2016-06-27 01:45:38 +02:00
{
_HatNeueTermine = value ;
NewAppointmentsOutlinedTextBlock . Visibility = value & & BeWoApp . LoggedOnUser ! = null & & BeWoApp . LoggedOnUser . HasRight ( UserRightType . KalenderAnsehen ) ? Visibility . Visible : Visibility . Collapsed ;
2019-02-28 12:38:29 +01:00
2025-03-28 10:28:19 +01:00
if ( ActiveView ? . GetType ( ) = = typeof ( SchedulerMasterView ) )
{
var schedulerMasterView = ( SchedulerMasterView ) ActiveView ;
2019-02-28 12:38:29 +01:00
2025-03-28 10:28:19 +01:00
if ( schedulerMasterView . grid_root . Children . Count > 0 )
{
var child0 = schedulerMasterView . grid_root . Children [ 0 ] ;
2019-02-28 12:38:29 +01:00
2025-03-28 10:28:19 +01:00
if ( child0 ? . GetType ( ) = = typeof ( NewSchedulerView ) )
{
var scheduler = ( NewSchedulerView ) schedulerMasterView . grid_root . Children [ 0 ] ;
scheduler . UpdateRequestString ( ) ;
}
}
}
else if ( ActiveView ? . GetType ( ) = = typeof ( HomeView ) )
{
var homeDragPanelView = ( HomeView ) ActiveView ;
homeDragPanelView . UpdateRequestsHyperLink ( ) ;
}
2016-06-27 01:45:38 +02:00
}
}
public event EventHandler LogoutClicked ;
public void ResetView ( UIContext uiContext )
{
if ( _Views . ContainsKey ( uiContext ) )
{
_Views . Remove ( uiContext ) ;
}
}
private BeWoView GetViewForUIContext ( UIContext uiContext )
{
2024-11-26 13:57:50 +01:00
if ( uiContext = = UIContext . Administration )
return new AdministrationView ( ) ;
2025-03-28 10:28:19 +01:00
if ( _Views . ContainsKey ( uiContext ) )
return _Views [ uiContext ] ;
BeWoView view = null ;
switch ( uiContext )
{
case UIContext . Person :
view = new PersonNavigationView ( ) ;
break ;
case UIContext . Customer :
view = new CustomerNavigationView ( ) ;
break ;
case UIContext . Organisation :
view = new OrganisationNavigationView ( ) ;
break ;
case UIContext . SupportConcept :
view = new SupportConceptNavigationView ( ) ;
break ;
case UIContext . Team :
view = new TeamNavigationView ( ) ;
break ;
case UIContext . Dokumente :
view = new DokumenteView ( ) ;
break ;
case UIContext . User :
view = new UserNavigationView ( ) ;
break ;
case UIContext . UserGroup :
view = new UserGroupNavigationView ( ) ;
break ;
case UIContext . Employee :
view = new EmployeeNavigationView ( ) ;
break ;
case UIContext . Report :
view = new ReportView ( ) ;
break ;
case UIContext . Scheduler :
view = new SchedulerMasterView ( ) ;
break ;
case UIContext . Wohnheim :
view = new WohnheimNavigationView ( ) ;
break ;
case UIContext . Vertretungen :
view = new VertretungsMainView2 ( ) ;
break ;
case UIContext . CustomerTeam :
view = new CustomerTeamNavigationView ( ) ;
break ;
case UIContext . Scheduling :
view = new SchedulingMasterView ( ) ;
break ;
case UIContext . Finance :
view = new FinanceView ( ) ;
break ;
2016-06-27 01:45:38 +02:00
}
2025-03-28 10:28:19 +01:00
_Views [ uiContext ] = view ;
return view ;
2016-06-27 01:45:38 +02:00
}
public event PropertyChangedEventHandler PropertyChanged ;
public void AnimateOpacity ( double pOpacitiy , double pDuration )
{
// System.Windows.Media.TransformGroup group = this.DetailFrame.RenderTransform as System.Windows.Media.TransformGroup;
// System.Windows.Media.ScaleTransform scale = group.Children[0] as System.Windows.Media.ScaleTransform;
var lAnimation = new DoubleAnimation ( ) ;
// lAnimation.From = scale.ScaleX;
// lAnimation.To = pOpacitiy;
lAnimation . From = DetailFrame . Opacity ;
lAnimation . To = pOpacitiy ;
lAnimation . Duration = TimeSpan . FromMilliseconds ( pDuration ) ;
DetailFrame . BeginAnimation ( OpacityProperty , lAnimation ) ;
// scale.BeginAnimation(System.Windows.Media.ScaleTransform.ScaleXProperty, lAnimation);
// scale.BeginAnimation(System.Windows.Media.ScaleTransform.ScaleYProperty, lAnimation);
}
public void AnimateOpacity ( double pOpacitiy )
{
AnimateOpacity ( pOpacitiy , 500 ) ;
}
2018-02-19 10:52:48 +01:00
public void ChangePopupOpacityMode ( bool isPopUpVisible )
2016-06-27 01:45:38 +02:00
{
if ( isPopUpVisible )
{
AnimateOpacity ( 0.5 , 200 ) ;
}
else
{
AnimateOpacity ( 1 , 100 ) ;
}
}
public void CloseCurrentPopUp ( )
{
2018-02-19 10:52:48 +01:00
if ( ModalPopupBackGround ! = null )
2016-06-27 01:45:38 +02:00
{
Dispatcher . BeginInvoke (
DispatcherPriority . Normal ,
2025-03-28 10:28:19 +01:00
( Action ) delegate
2016-06-27 01:45:38 +02:00
{
2025-03-28 10:28:19 +01:00
grid_main . Children . Remove ( _CurrentModalPopup ) ;
2018-02-19 10:52:48 +01:00
_CurrentModalPopup = null ;
2025-03-28 10:28:19 +01:00
if ( _ModalPopupControls . Count = = 0 )
2016-06-27 01:45:38 +02:00
{
2025-04-15 12:44:38 +02:00
HideModalBackground ( ) ;
2016-06-27 01:45:38 +02:00
}
else
{
2018-02-19 10:52:48 +01:00
var control = _ModalPopupControls . Pop ( ) ;
_CurrentModalPopup = control ;
2016-06-27 01:45:38 +02:00
grid_main . Children . Add ( control ) ;
Panel . SetZIndex ( control , int . MaxValue ) ;
}
} ) ;
}
}
2025-03-28 10:28:19 +01:00
public void HideCurrentModalViewWindows ( )
{
if ( ModalPopupBackGround ! = null )
{
Dispatcher . BeginInvoke ( DispatcherPriority . Normal , ( Action ) delegate
{
ModalPopupBackGround . Visibility = Visibility . Collapsed ;
foreach ( var modalPopup in OpenedModalViewWindows )
{
modalPopup . Hide ( ) ;
}
} ) ;
}
}
public void ShowCurrentModalViewWindowsAgain ( )
{
if ( OpenedModalViewWindows . Count > 0 & & ModalPopupBackGround ! = null )
{
ModalPopupBackGround . Visibility = Visibility . Visible ;
foreach ( var modalPopup in OpenedModalViewWindows )
{
modalPopup . Show ( ) ;
}
}
}
2018-02-19 10:52:48 +01:00
2016-06-27 01:45:38 +02:00
public void EndWaiting ( )
{
Dispatcher . BeginInvoke (
DispatcherPriority . Normal ,
2025-03-28 10:28:19 +01:00
( Action ) delegate
2016-06-27 01:45:38 +02:00
{
if ( _WaitLayer ! = null )
{
grid_main . Children . Remove ( _WaitLayer ) ;
_WaitLayer = null ;
}
} ) ;
}
public void NavigateToServiceRecordView ( long? supportConceptOid )
{
if ( DoSaveCheck ( ) )
{
VMFactory . CreateServiceRecordVMAsync (
BeWoApp . LoggedOnUser . Employee . EmployeeOid ,
vm = > this . Dispatch (
delegate
{
vm . DispatcherObject = this ;
NavigateTo ( new ServiceRecordView2 ( vm , supportConceptOid ) ) ;
} ) ) ;
}
}
public void NavigateToAdditionalServiceView ( long? supportConceptOid )
{
if ( DoSaveCheck ( ) )
{
VMFactory . CreateServiceRecordVMAsync (
BeWoApp . LoggedOnUser . Employee . EmployeeOid ,
vm = > Cache . GetInstance ( ) . GetAllActiveAndArchivedCustomerCompact (
c = > this . Dispatch (
delegate
{
vm . DispatcherObject = this ;
if ( vm . NewVM ! = null )
vm . NewVM . ServiceRecordType = ServiceRecordTypeId . AdditionalService ;
NavigateTo ( new AdditionalServiceView ( vm , c ) ) ;
} ) ) ) ;
2025-03-28 10:28:19 +01:00
}
2016-06-27 01:45:38 +02:00
}
2018-02-19 10:52:48 +01:00
public void ShowControlAsModalPopup ( Control control )
2016-06-27 01:45:38 +02:00
{
2018-02-19 10:52:48 +01:00
ShowControlAsModalPopup ( control , HorizontalAlignment . Center , VerticalAlignment . Center ) ;
2016-06-27 01:45:38 +02:00
}
2018-02-19 10:52:48 +01:00
public void ShowControlAsModalPopup ( Control control , HorizontalAlignment horizontalAlignment , VerticalAlignment verticalAlignment )
2016-06-27 01:45:38 +02:00
{
Dispatcher . BeginInvoke (
DispatcherPriority . Normal ,
2025-03-28 10:28:19 +01:00
( Action ) delegate
2016-06-27 01:45:38 +02:00
{
2018-02-19 10:52:48 +01:00
if ( _CurrentModalPopup ! = null )
2016-06-27 01:45:38 +02:00
{
2018-02-19 10:52:48 +01:00
grid_main . Children . Remove ( _CurrentModalPopup ) ;
_ModalPopupControls . Push ( _CurrentModalPopup ) ;
2016-06-27 01:45:38 +02:00
}
else
{
ShowModalBackground ( ) ;
}
2018-02-19 10:52:48 +01:00
_CurrentModalPopup = control ;
control . HorizontalAlignment = horizontalAlignment ;
control . VerticalAlignment = verticalAlignment ;
2016-06-27 01:45:38 +02:00
Grid . SetColumnSpan ( control , 3 ) ;
Grid . SetRowSpan ( control , 3 ) ;
grid_main . Children . Add ( control ) ;
2025-04-10 13:46:58 +02:00
Panel . SetZIndex ( control , 1000 ) ;
2016-06-27 01:45:38 +02:00
} ) ;
}
public void StartWaiting ( )
{
2025-03-28 10:28:19 +01:00
Dispatcher . BeginInvoke ( DispatcherPriority . Normal , ( Action ) StartWaitingImmediately ) ;
2016-06-27 01:45:38 +02:00
}
public void StartWaitingImmediately ( )
{
if ( _WaitLayer = = null )
{
_WaitLayer = new WaitLayer2 ( ) ;
Grid . SetColumnSpan ( _WaitLayer , 3 ) ;
Grid . SetRowSpan ( _WaitLayer , 3 ) ;
grid_main . Children . Add ( _WaitLayer ) ;
Panel . SetZIndex ( _WaitLayer , int . MaxValue ) ;
2024-10-21 16:09:52 +02:00
//_WaitLayer.RefreshUI();
2016-06-27 01:45:38 +02:00
}
}
internal void ClearDetailFrame ( )
{
foreach ( var window in BeWoApp . CurrentBeWo . MainWindow . OwnedWindows )
{
( ( System . Windows . Window ) window ) . Close ( ) ;
}
BeWoView lOld = null ;
if ( DetailFrame . Children . Count = = 1 )
{
lOld = DetailFrame . Children [ 0 ] as BeWoView ;
}
_CurrentDetailView = null ;
if ( lOld ! = null )
{
2019-08-09 17:10:17 +02:00
if ( lOld is HomeView )
2016-06-27 01:45:38 +02:00
{
2019-08-09 17:10:17 +02:00
var hdpv = lOld as HomeView ;
2016-06-27 01:45:38 +02:00
hdpv . SaveState ( ) ;
BeWoApp . SaveAppSettings ( ) ;
}
lOld . BlendOutComplete + = ( s , e ) = > DetailFrame . Children . Remove ( lOld ) ;
lOld . BlendOut ( ) ;
}
DetailFrame . Children . Clear ( ) ;
}
internal void Maximize ( )
{
var animation = new ThicknessAnimationUsingKeyFrames ( ) ;
var t = new Thickness ( - 5 , 0 , - 5 , 0 ) ;
animation . KeyFrames . Add ( new SplineThicknessKeyFrame ( t , KeyTime . FromTimeSpan ( new TimeSpan ( 0 , 0 , 0 , 0 , 500 ) ) , new KeySpline ( 1 , 0 , 1 , 1 ) ) ) ;
animation . Completed + = maximizeAnimation_Completed ;
AnimateToolbarOut ( 0 ) ;
DetailFrame . BeginAnimation ( MarginProperty , animation ) ;
BeWoApp . AppSettings . WindowState = AppSettings . WindowStateType . Maximised ;
BeWoApp . SaveAppSettings ( ) ;
// toolbarButtonPanel.Visibility = Visibility.Hidden;
// toolbarBord.Visibility = Visibility.Hidden;
// LogoutButtonPanel.Visibility = Visibility.Hidden;
////###HOMEVIEW HomeButtonPanel.Visibility = Visibility.Hidden;
// toolbarScrollViewer.Visibility = Visibility.Hidden;
}
internal void Minimize ( )
{
var animation = new ThicknessAnimationUsingKeyFrames ( ) ;
var t = new Thickness ( 140 , 35 , 140 , 85 ) ;
animation . KeyFrames . Add ( new SplineThicknessKeyFrame ( t , KeyTime . FromTimeSpan ( new TimeSpan ( 0 , 0 , 0 , 0 , 500 ) ) , new KeySpline ( 0 , 1 , 1 , 1 ) ) ) ;
animation . Completed + = minimizeAnimation_Completed ;
AnimateToolbarIn ( 0 ) ;
DetailFrame . BeginAnimation ( MarginProperty , animation ) ;
BeWoApp . AppSettings . WindowState = AppSettings . WindowStateType . Default ;
BeWoApp . SaveAppSettings ( ) ;
// toolbarButtonPanel.Visibility = Visibility.Visible;
// toolbarBord.Visibility = Visibility.Visible;
// LogoutButtonPanel.Visibility = Visibility.Visible;
////###HOMEVIEW HomeButtonPanel.Visibility = Visibility.Visible;
// toolbarScrollViewer.Visibility = Visibility.Visible;
}
internal void NavigateTo ( BeWoView pElement )
{
if ( BeWoApp . RenderTier < 2 )
NavigateToWithoutFade ( pElement ) ;
else
NavigateToWithFade ( pElement ) ;
}
internal void NavigateToWithoutFade ( BeWoView pElement )
{
if ( pElement = = null )
{
NavigateToHomeView ( ) ;
}
else
{
if ( DetailFrame . Children . Count = = 1 )
{
var lOld = DetailFrame . Children [ 0 ] as BeWoView ;
if ( lOld ! = null )
{
2019-08-09 17:10:17 +02:00
if ( lOld is HomeView )
2016-06-27 01:45:38 +02:00
{
2019-08-09 17:10:17 +02:00
var hdpv = lOld as HomeView ;
2016-06-27 01:45:38 +02:00
hdpv . SaveState ( ) ;
BeWoApp . SaveAppSettings ( ) ;
}
}
DetailFrame . Children . Clear ( ) ;
}
if ( pElement ! = null )
{
DetailFrame . Children . Add ( pElement ) ;
}
_CurrentDetailView = pElement ;
DetailFrame . Children . RemoveRange ( 2 ) ;
}
}
internal void NavigateToWithFade ( BeWoView pElement )
{
if ( pElement = = null )
{
NavigateToHomeView ( ) ;
}
else
{
BeWoView lOld = null ;
if ( DetailFrame . Children . Count > 0 )
{
lOld = DetailFrame . Children [ 0 ] as BeWoView ;
if ( DetailFrame . Children . Count > 1 )
{
DetailFrame . Children . RemoveRange ( 1 ) ;
}
if ( lOld ! = null & & lOld . Equals ( pElement ) )
return ;
}
if ( pElement ! = null )
{
pElement . Opacity = 0 ;
DetailFrame . Children . Add ( pElement ) ;
pElement . Focus ( ) ;
pElement . BlendIn ( ) ;
// Object obj = pElement.Template.FindName("togglebutton_maximise", pElement);
// obj = pElement.FindName("togglebutton_maximise");
// if (maximizeButton != null)
// {
// maximizeButton.IsChecked = IsMaximized;
// }
}
_CurrentDetailView = pElement ;
if ( lOld ! = null )
{
2019-08-09 17:10:17 +02:00
if ( lOld is HomeView )
2016-06-27 01:45:38 +02:00
{
2019-08-09 17:10:17 +02:00
var hdpv = lOld as HomeView ;
2016-06-27 01:45:38 +02:00
hdpv . SaveState ( ) ;
BeWoApp . SaveAppSettings ( ) ;
}
lOld . BlendOutComplete + = ( s , e ) = >
{
if ( DetailFrame . Children . Count > 1 )
DetailFrame . Children . Remove ( lOld ) ;
} ;
lOld . BlendOut ( ) ;
}
DetailFrame . Children . RemoveRange ( 2 ) ;
}
}
protected virtual void FirePropertyChanged ( string pPropertyName )
{
if ( PropertyChanged ! = null )
{
PropertyChanged ( this , new PropertyChangedEventArgs ( pPropertyName ) ) ;
}
}
private void AnimateToolbarIn ( int delay )
{
var animation = new DoubleAnimationUsingKeyFrames ( ) ;
animation . BeginTime = new TimeSpan ( 0 , 0 , 0 , 0 , delay ) ;
animation . KeyFrames . Add ( new SplineDoubleKeyFrame ( - 5 , KeyTime . FromTimeSpan ( new TimeSpan ( 0 , 0 , 0 , 0 , 500 ) ) , new KeySpline ( 0 , 1 , 1 , 1 ) ) ) ;
animation . KeyFrames . Add ( new SplineDoubleKeyFrame ( 0 , KeyTime . FromTimeSpan ( new TimeSpan ( 0 , 0 , 0 , 0 , 1000 ) ) , new KeySpline ( 0.35 , 0.5 , 0.5 , 0.9 ) ) ) ;
2025-03-28 10:28:19 +01:00
var group = ( TransformGroup ) toolbarRoot . RenderTransform ;
var trans = ( TranslateTransform ) group . Children [ 3 ] ;
2016-06-27 01:45:38 +02:00
var animationButtons = new DoubleAnimationUsingKeyFrames ( ) ;
animationButtons . BeginTime = new TimeSpan ( 0 , 0 , 0 , 0 , delay ) ;
animationButtons . KeyFrames . Add ( new SplineDoubleKeyFrame ( 0 , KeyTime . FromTimeSpan ( new TimeSpan ( 0 , 0 , 0 , 0 , 500 ) ) , new KeySpline ( 0 , 1 , 1 , 1 ) ) ) ;
2025-03-28 10:28:19 +01:00
var groupButtons = ( TransformGroup ) toolbarContent . RenderTransform ;
var transButtons = ( TranslateTransform ) groupButtons . Children [ 3 ] ;
2016-06-27 01:45:38 +02:00
transButtons . BeginAnimation ( TranslateTransform . YProperty , animationButtons ) ;
trans . BeginAnimation ( TranslateTransform . YProperty , animation ) ;
}
private void AnimateToolbarOut ( int delay )
{
var animation = new DoubleAnimationUsingKeyFrames ( ) ;
animation . BeginTime = new TimeSpan ( 0 , 0 , 0 , 0 , delay ) ;
animation . KeyFrames . Add ( new SplineDoubleKeyFrame ( 45 , KeyTime . FromTimeSpan ( new TimeSpan ( 0 , 0 , 0 , 0 , 500 ) ) , new KeySpline ( 1 , 0 , 1 , 1 ) ) ) ;
2025-03-28 10:28:19 +01:00
var group = ( TransformGroup ) toolbarRoot . RenderTransform ;
var trans = ( TranslateTransform ) group . Children [ 3 ] ;
2016-06-27 01:45:38 +02:00
var animationButtons = new DoubleAnimationUsingKeyFrames ( ) ;
animationButtons . BeginTime = new TimeSpan ( 0 , 0 , 0 , 0 , delay ) ;
animationButtons . KeyFrames . Add ( new SplineDoubleKeyFrame ( 100 , KeyTime . FromTimeSpan ( new TimeSpan ( 0 , 0 , 0 , 0 , 500 ) ) , new KeySpline ( 1 , 0 , 1 , 1 ) ) ) ;
2025-03-28 10:28:19 +01:00
var groupButtons = ( TransformGroup ) toolbarContent . RenderTransform ;
var transButtons = ( TranslateTransform ) groupButtons . Children [ 3 ] ;
2016-06-27 01:45:38 +02:00
transButtons . BeginAnimation ( TranslateTransform . YProperty , animationButtons ) ;
trans . BeginAnimation ( TranslateTransform . YProperty , animation ) ;
}
public bool DoSaveCheck ( )
{
2023-07-31 15:29:16 +02:00
return _CurrentDetailView is null | | _CurrentDetailView . DoSaveCheck ( ) ;
2016-06-27 01:45:38 +02:00
}
private void InitCommandBindings ( )
{
CommandBindings . Add (
new CommandBinding (
ApplicationCommands . Save ,
( s , e ) = >
{
2023-07-31 15:29:16 +02:00
if ( _CurrentModalPopup is null )
2016-06-27 01:45:38 +02:00
{
_CurrentDetailView . SaveData ( ) ;
}
else
{
_CurrentDetailView . ModalPopUpSaveInvoked ( ) ;
}
} ,
( s , e ) = >
{
2023-07-31 15:29:16 +02:00
if ( _CurrentModalPopup is null )
2016-06-27 01:45:38 +02:00
{
2023-07-31 15:29:16 +02:00
e . CanExecute = _CurrentDetailView ? . IsDirty ? ? false ;
2016-06-27 01:45:38 +02:00
}
else
{
2023-07-31 15:29:16 +02:00
e . CanExecute = _CurrentDetailView ! = null & & ( _CurrentModalPopup is BeWoView view & & view . IsDirty ) ;
2016-06-27 01:45:38 +02:00
}
} ) ) ;
CommandBindings . Add ( new CommandBinding ( BeWoCommands . Excel , ( s , e ) = > _CurrentDetailView . ExportToExcel ( e . Parameter as string ) , ( s , e ) = > e . CanExecute = _CurrentDetailView ! = null ? _CurrentDetailView . CanExcelExport : false ) ) ;
CommandBindings . Add ( new CommandBinding ( ApplicationCommands . Delete , ( s , e ) = > _CurrentDetailView . Delete ( ) , ( s , e ) = > e . CanExecute = _CurrentDetailView ! = null ? _CurrentDetailView . CanDelete : false ) ) ;
CommandBindings . Add ( new CommandBinding ( BeWoCommands . Word , ( s , e ) = > _CurrentDetailView . ExportToWord ( e . Parameter as string ) , ( s , e ) = > e . CanExecute = _CurrentDetailView ! = null ? _CurrentDetailView . CanWordExport : false ) ) ;
CommandBindings . Add (
new CommandBinding (
ApplicationCommands . Close ,
( s , e ) = >
{
2018-02-19 10:52:48 +01:00
if ( _CurrentModalPopup = = null & & DoSaveCheck ( ) )
2016-06-27 01:45:38 +02:00
{
if ( _CurrentDetailView . ParentView ! = null )
_CurrentDetailView . ParentView . ChildViewClosed ( ) ;
NavigateToParentView ( _CurrentDetailView . ParentView ) ;
}
else
{
_CurrentDetailView . ModalPopUpCloseInvoked ( ) ;
}
} , ( s , e ) = > e . CanExecute = _CurrentDetailView ! = null ) ) ;
}
2024-12-03 14:43:26 +01:00
internal void UpdateMandator ( )
{
if ( BeWoApp . Mandator is null )
return ;
var url = BeWoApp . Mandator . Website . ToNullIfEmpty ( ) ;
var haslogo = BeWoApp . Mandator . Logo ? . Original is object ;
if ( haslogo )
{
2025-03-28 10:28:19 +01:00
image2 . Source = Utils . CreateBitmapImageFromByteArray ( BeWoApp . Mandator . Logo . Original ) ;
2024-12-03 14:43:26 +01:00
Grid . SetColumn ( txt_logo , 2 ) ;
txt_logo2 . Visibility = Visibility . Visible ;
2025-03-28 10:28:19 +01:00
if ( Uri . TryCreate ( url , UriKind . RelativeOrAbsolute , out Uri res ) )
2024-12-03 14:43:26 +01:00
{
hyperlink_2 . NavigateUri = res ;
}
else
{
hyperlink_2 . NavigateUri = null ;
}
column2 . Width = new GridLength ( 1 , GridUnitType . Auto ) ;
}
else
{
Grid . SetColumn ( txt_logo , 0 ) ;
txt_logo2 . Visibility = Visibility . Collapsed ;
column2 . Width = new GridLength ( 150 ) ;
}
}
2016-06-27 01:45:38 +02:00
private void NavigateToParentView ( BeWoView beWoView )
{
if ( beWoView is CustomerNavigationView & & ! _Views . ContainsKey ( UIContext . Customer ) )
{
_Views . Add ( UIContext . Customer , beWoView ) ;
}
else if ( beWoView is EmployeeNavigationView & & ! _Views . ContainsKey ( UIContext . Employee ) )
{
_Views . Add ( UIContext . Employee , beWoView ) ;
}
else if ( beWoView is OrganisationNavigationView & & ! _Views . ContainsKey ( UIContext . Organisation ) )
{
_Views . Add ( UIContext . Organisation , beWoView ) ;
}
else if ( beWoView is PersonNavigationView & & ! _Views . ContainsKey ( UIContext . Person ) )
{
_Views . Add ( UIContext . Person , beWoView ) ;
}
else if ( beWoView is SupportConceptNavigationView & & ! _Views . ContainsKey ( UIContext . SupportConcept ) )
{
_Views . Add ( UIContext . SupportConcept , beWoView ) ;
}
else if ( beWoView is TeamNavigationView & & ! _Views . ContainsKey ( UIContext . Team ) )
{
_Views . Add ( UIContext . Team , beWoView ) ;
}
else if ( beWoView is UserNavigationView & & ! _Views . ContainsKey ( UIContext . User ) )
{
_Views . Add ( UIContext . User , beWoView ) ;
}
else if ( beWoView is UserGroupNavigationView & & ! _Views . ContainsKey ( UIContext . UserGroup ) )
{
_Views . Add ( UIContext . UserGroup , beWoView ) ;
2025-03-28 10:28:19 +01:00
}
else if ( beWoView is WohnheimNavigationView & & ! _Views . ContainsKey ( UIContext . Wohnheim ) )
{
_Views . Add ( UIContext . Wohnheim , beWoView ) ;
}
2016-06-27 01:45:38 +02:00
NavigateTo ( beWoView ) ;
}
private void MainControl_KeyDown ( object sender , KeyEventArgs e )
{
if ( e . Key = = Key . Back )
{
e . Handled = true ;
}
}
private void NavigateToHomeView ( )
{
if ( _HomeView = = null )
{
2019-08-09 17:10:17 +02:00
_HomeView = new HomeView ( ) ;
2016-06-27 01:45:38 +02:00
}
else
{
2019-08-29 15:43:23 +02:00
//_HomeView.ReorderPanels();
2016-06-27 01:45:38 +02:00
}
NavigateTo ( _HomeView ) ;
// VarFieldListVM v = new VarFieldListVM(l);
// NavigateTo(new VarFieldView(v));
}
private void OnLoadedStoryboard_Completed ( object sender , EventArgs e )
{
if ( BeWoApp . AppSettings . WindowState = = AppSettings . WindowStateType . Maximised )
{
Maximize ( ) ;
IsMaximized = true ;
FirePropertyChanged ( "IsMaximized" ) ;
}
}
2025-04-15 13:21:03 +02:00
internal void ShowModalBackgroundFade ( double duration = 0.3 , double opacity = 0.5 )
{
if ( ModalPopupBackGround is Grid & & grid_main . Children . Contains ( ModalPopupBackGround ) )
return ;
ShowModalBackground ( 0 ) ;
DoubleAnimation lAnim = new DoubleAnimation ( opacity , new Duration ( TimeSpan . FromSeconds ( duration ) ) ) ;
ModalPopupBackGround . BeginAnimation ( OpacityProperty , lAnim ) ;
}
internal void ShowModalBackground ( double start_opacity = . 5 )
2016-06-27 01:45:38 +02:00
{
2025-04-15 12:44:38 +02:00
if ( ModalPopupBackGround is Grid & & grid_main . Children . Contains ( ModalPopupBackGround ) )
return ;
2025-03-28 10:28:19 +01:00
ModalPopupBackGround = new Grid
{
IsHitTestVisible = true ,
Background = Brushes . White ,
2025-04-15 13:21:03 +02:00
Opacity = start_opacity
2025-03-28 10:28:19 +01:00
} ;
2018-02-19 10:52:48 +01:00
2025-03-28 10:28:19 +01:00
Grid . SetColumnSpan ( ModalPopupBackGround , 3 ) ;
2018-02-19 10:52:48 +01:00
Grid . SetRowSpan ( ModalPopupBackGround , 3 ) ;
grid_main . Children . Add ( ModalPopupBackGround ) ;
2025-04-10 13:46:58 +02:00
Panel . SetZIndex ( ModalPopupBackGround , 500 ) ;
2016-06-27 01:45:38 +02:00
}
2025-04-15 13:21:03 +02:00
internal void HideModalBackgroundFade ( double duration = 0.3 )
2025-04-15 12:44:38 +02:00
{
if ( ModalPopupBackGround is null | | ! grid_main . Children . Contains ( ModalPopupBackGround ) )
2025-04-15 13:21:03 +02:00
return ;
DoubleAnimation lAnim = new DoubleAnimation ( 0 , new Duration ( TimeSpan . FromSeconds ( duration ) ) ) ;
lAnim . Completed + = ( s , e ) = >
2025-04-15 12:44:38 +02:00
{
2025-04-15 13:21:03 +02:00
HideModalBackground ( ) ;
} ;
ModalPopupBackGround . BeginAnimation ( OpacityProperty , lAnim ) ;
}
internal void HideModalBackground ( )
{
if ( ModalPopupBackGround is null | | ! grid_main . Children . Contains ( ModalPopupBackGround ) )
2025-04-15 12:44:38 +02:00
return ;
grid_main . Children . Remove ( ModalPopupBackGround ) ;
ModalPopupBackGround = null ;
}
2016-06-27 01:45:38 +02:00
private void logoutanimation_Completed ( object sender , EventArgs e )
{
//var navigationService = NavigationService.GetNavigationService(this);
//if (navigationService != null)
//{
// navigationService.Navigate(new LoginPage());
BeWoApp . UserName = string . Empty ;
BeWoApp . UserPassword = string . Empty ;
// BeWoApp.Tenant = "";
BeWoApp . LoggedOnUser = null ;
//}
if ( LogoutClicked ! = null )
LogoutClicked ( null , new EventArgs ( ) ) ;
}
private void btn_home_Click ( object sender , RoutedEventArgs e )
{
2019-08-09 17:10:17 +02:00
if ( ! ( _CurrentDetailView is HomeView ) & & DoSaveCheck ( ) )
2016-06-27 01:45:38 +02:00
{
NavigateToHomeView ( ) ;
}
}
private void button_AccountingTransacation_Click ( object sender , RoutedEventArgs e )
{
if ( DoSaveCheck ( ) )
{
2024-09-12 11:58:29 +02:00
NavigateTo ( GetViewForUIContext ( UIContext . Finance ) ) ;
2016-06-27 01:45:38 +02:00
}
}
private void button_Administration_Click ( object sender , RoutedEventArgs e )
{
if ( DoSaveCheck ( ) )
{
2024-11-26 13:57:50 +01:00
NavigateTo ( GetViewForUIContext ( UIContext . Administration ) ) ;
2016-06-27 01:45:38 +02:00
}
}
// private void ExcelExport_RequestNavigate(object sender, RequestNavigateEventArgs e)
// {
// BeWoCommands.Excel.Execute(LinkEngine.ExcelFileId, ExcelExport);
// LinkEngine.GenerateNewExcelLink();
// }
// private void WordExport_RequestNavigate(object sender, RequestNavigateEventArgs e)
// {
// BeWoCommands.Word.Execute(LinkEngine.WordFileId, WordExport);
// LinkEngine.GenerateNewWordLink();
// }
private void button_Customer_Click ( object sender , RoutedEventArgs e )
{
if ( DoSaveCheck ( ) )
{
NavigateTo ( GetViewForUIContext ( UIContext . Customer ) ) ;
}
}
2016-07-25 09:26:56 +02:00
2025-03-28 10:28:19 +01:00
private void button_Wohnheim_Click ( object sender , RoutedEventArgs e )
{
if ( DoSaveCheck ( ) )
{
NavigateTo ( GetViewForUIContext ( UIContext . Wohnheim ) ) ;
}
}
2016-06-27 01:45:38 +02:00
private void button_Employee_Click ( object sender , RoutedEventArgs e )
{
if ( DoSaveCheck ( ) )
{
NavigateTo ( GetViewForUIContext ( UIContext . Employee ) ) ;
}
}
private void button_Home ( object sender , RoutedEventArgs e )
{
if ( DoSaveCheck ( ) )
{
// NavigateTo(new HomeView());
2019-08-09 17:10:17 +02:00
NavigateTo ( new HomeView ( ) ) ;
2016-06-27 01:45:38 +02:00
}
}
private void button_Logout ( object sender , RoutedEventArgs e )
{
if ( DoSaveCheck ( ) )
{
Cache . GetInstance ( ) . ClearAll ( ) ;
_Views = new Dictionary < UIContext , BeWoView > ( ) ;
2025-03-28 10:28:19 +01:00
2016-06-27 01:45:38 +02:00
var animation = new DoubleAnimationUsingKeyFrames ( ) ;
animation . KeyFrames . Add ( new SplineDoubleKeyFrame ( 100 , KeyTime . FromTimeSpan ( new TimeSpan ( 0 , 0 , 0 , 0 , 500 ) ) , new KeySpline ( 1 , 0 , 1 , 1 ) ) ) ;
2025-03-28 10:28:19 +01:00
var group = ( TransformGroup ) toolbarRoot . RenderTransform ;
var trans = ( TranslateTransform ) group . Children [ 3 ] ;
2016-06-27 01:45:38 +02:00
trans . BeginAnimation ( TranslateTransform . YProperty , animation ) ;
animation = new DoubleAnimationUsingKeyFrames ( ) ;
animation . Completed + = logoutanimation_Completed ;
animation . KeyFrames . Add ( new SplineDoubleKeyFrame ( - 200 , KeyTime . FromTimeSpan ( new TimeSpan ( 0 , 0 , 0 , 0 , 500 ) ) , new KeySpline ( 1 , 0 , 1 , 1 ) ) ) ;
2025-03-28 10:28:19 +01:00
group = ( TransformGroup ) image . RenderTransform ;
trans = ( TranslateTransform ) group . Children [ 3 ] ;
2016-06-27 01:45:38 +02:00
trans . BeginAnimation ( TranslateTransform . XProperty , animation ) ;
ClearDetailFrame ( ) ;
}
2017-09-08 15:09:48 +02:00
2025-03-28 10:28:19 +01:00
//Hier das mit Chat Refreshen
if ( BeWoApp . MainControl ! = null & & BeWoApp . MainControl . HomeView . ServiceChatView ! = null )
{
if ( BeWoApp . MainControl . HomeView . ServiceChatView . ChatMainControl ! = null & &
BeWoApp . MainControl . HomeView . ServiceChatView . ChatMainControl . GlobalListeningThreadtimer ! = null )
{
BeWoApp . MainControl . HomeView . ServiceChatView . ChatMainControl . GlobalListeningThreadtimer . Stop ( ) ;
BeWoApp . MainControl . HomeView . ServiceChatView . ChatMainControl . GlobalListeningThreadtimer = null ;
BeWoApp . MainControl . HomeView . ServiceChatView . ChatMainControl . ShouldInterruptContactsThread = true ;
}
if ( BeWoApp . MainControl . HomeView . ServiceChatView . ServiceChat . EmojiView ! = null )
{
BeWoApp . MainControl . HomeView . ServiceChatView . ServiceChat . EmojiView . Close ( ) ;
BeWoApp . MainControl . HomeView . ServiceChatView . ServiceChat . EmojiView = null ;
}
if ( BeWoApp . MainControl . HomeView . ServiceChatView . ChatMainControl ! = null )
{
BeWoApp . MainControl . HomeView . ServiceChatView . ChatMainControl . DeleteTempFiles ( ) ;
}
BeWoApp . MainControl . HomeView . ServiceChatView . Close ( ) ;
BeWoApp . MainControl . HomeView . ServiceChatView = null ;
}
BeWoApp . Cleanup ( ) ;
//Ende
}
2016-06-27 01:45:38 +02:00
private void button_Organisation_Click ( object sender , RoutedEventArgs e )
{
if ( DoSaveCheck ( ) )
{
NavigateTo ( GetViewForUIContext ( UIContext . Organisation ) ) ;
}
}
private void button_Person_Click ( object sender , RoutedEventArgs e )
{
if ( DoSaveCheck ( ) )
{
NavigateTo ( GetViewForUIContext ( UIContext . Person ) ) ;
}
}
private void button_Reports_Click ( object sender , RoutedEventArgs e )
{
if ( DoSaveCheck ( ) )
{
NavigateTo ( GetViewForUIContext ( UIContext . Report ) ) ;
}
}
private void button_ResourceBooking_Click ( object sender , RoutedEventArgs e )
{
if ( DoSaveCheck ( ) )
{
ServiceFacade . DoResourceServiceAsync (
s1 = > s1 . GetAllResources ( ) ,
r1 = > ServiceFacade . DoEmployeeServiceAsync (
s2 = > s2 . GetAllActiveEmployeesCompact ( ) ,
r2 = >
{
if ( r1 . Count > 0 & & r2 . Count > 0 )
{
try
{
2025-03-28 10:28:19 +01:00
Dictionary < ValueListEntryDC , List < ResourceDC > > lCategoriesToResources = r1 . Select ( res = > res . ResourceCategory ) . Distinct ( ) . OrderBy ( cat = > cat . TypeDescription ) . Select ( cat = > new { Key = cat , Value = r1 . Where ( res = > res . ResourceCategory . Equals ( cat ) ) . OrderBy ( res = > res . Name ) . ToList ( ) } ) . ToDictionary ( a = > a . Key , a = > a . Value ) ;
2016-06-27 01:45:38 +02:00
this . Dispatch ( delegate { NavigateTo ( new BookingView ( lCategoriesToResources , r2 , BeWoApp . LoggedOnUser . Employee ) ) ; } ) ;
}
catch ( Exception )
{
MessageBox . Show ( "Bitte legen Sie zunächst unter Verwaltung Resourcen und Resourcenkategorien an." ) ;
}
}
} ) ) ;
}
}
private void button_Scheduler_Click ( object sender , RoutedEventArgs e )
{
if ( DoSaveCheck ( ) )
{
NavigateTo ( GetViewForUIContext ( UIContext . Scheduler ) ) ;
}
}
private void button_SupportConcept_Click ( object sender , RoutedEventArgs e )
{
if ( DoSaveCheck ( ) )
{
NavigateTo ( GetViewForUIContext ( UIContext . SupportConcept ) ) ;
}
}
private void button_Team_Click ( object sender , RoutedEventArgs e )
{
if ( DoSaveCheck ( ) )
{
NavigateTo ( GetViewForUIContext ( UIContext . Team ) ) ;
}
}
2020-11-20 10:20:02 +01:00
private void button_Dokumente_Click ( object sender , RoutedEventArgs e )
{
if ( DoSaveCheck ( ) )
{
NavigateTo ( GetViewForUIContext ( UIContext . Dokumente ) ) ;
}
}
private void button_CustomerTeam_Click ( object sender , RoutedEventArgs e )
2025-03-28 10:28:19 +01:00
{
if ( DoSaveCheck ( ) )
{
NavigateTo ( GetViewForUIContext ( UIContext . CustomerTeam ) ) ;
}
}
2017-08-18 14:43:33 +02:00
2025-03-28 10:28:19 +01:00
private void button_UserGroup_Click ( object sender , RoutedEventArgs e )
2016-06-27 01:45:38 +02:00
{
if ( DoSaveCheck ( ) )
{
NavigateTo ( GetViewForUIContext ( UIContext . UserGroup ) ) ;
}
}
private void button_User_Click ( object sender , RoutedEventArgs e )
{
if ( DoSaveCheck ( ) )
{
NavigateTo ( GetViewForUIContext ( UIContext . User ) ) ;
}
}
//private void button_assessmentSheetEntry_Click(object sender, RoutedEventArgs e)
//{
// if (this.DoSaveCheck())
// {
// this.NavigateTo(new AssessmentSheetEntryView());
// }
//}
2025-03-14 14:04:46 +01:00
2016-06-27 01:45:38 +02:00
private void button_resources_Click ( object sender , RoutedEventArgs e )
{
if ( DoSaveCheck ( ) )
{
VMFactory . CreateResourceListVMAsync ( cb = > this . Dispatch ( delegate { NavigateTo ( new RessourceView ( cb ) ) ; } ) ) ;
}
}
private void button_serviceRecord_Click ( object sender , RoutedEventArgs e )
{
NavigateToServiceRecordView ( null ) ;
}
private void button_additionalService_Click ( object sender , RoutedEventArgs e )
{
NavigateToAdditionalServiceView ( null ) ;
}
private void maximizeAnimation_Completed ( object sender , EventArgs e )
{
2018-02-19 10:52:48 +01:00
IsMaximized = true ;
2016-06-27 01:45:38 +02:00
}
private void minimizeAnimation_Completed ( object sender , EventArgs e )
{
2018-02-19 10:52:48 +01:00
IsMaximized = false ;
2016-06-27 01:45:38 +02:00
}
private void toolbarRoot_MouseEnter ( object sender , MouseEventArgs e )
{
2018-02-19 10:52:48 +01:00
if ( IsMaximized )
2016-06-27 01:45:38 +02:00
{
AnimateToolbarIn ( 500 ) ;
}
}
private void toolbarRoot_MouseLeave ( object sender , MouseEventArgs e )
{
2018-02-19 10:52:48 +01:00
if ( IsMaximized )
2016-06-27 01:45:38 +02:00
{
AnimateToolbarOut ( 200 ) ;
}
}
private void toolbarScrollViewer_ScrollChanged ( object sender , ScrollChangedEventArgs e )
{
e . Handled = true ;
}
private void Hyperlink_OnRequestNavigate ( object sender , RequestNavigateEventArgs e )
{
// Hier Token anfordern; Hier nicht notwendig -> Link auf www.beyondsoft.de
2024-12-03 14:43:26 +01:00
var url = ( sender as Hyperlink ) . NavigateUri . ToString ( ) ;
if ( string . IsNullOrWhiteSpace ( url ) )
return ;
Process . Start ( new ProcessStartInfo ( url ) ) ;
2016-06-27 01:45:38 +02:00
}
private void button_Support_Click ( object sender , RoutedEventArgs e )
{
2026-01-09 17:47:05 +01:00
var handbuchButton = new Button
{
Content = "&" , // Buch
FontFamily = new FontFamily ( "Wingdings" ) ,
FontSize = 16 ,
Width = 25 ,
Margin = new Thickness ( 5 ) ,
HorizontalContentAlignment = HorizontalAlignment . Center ,
VerticalContentAlignment = VerticalAlignment . Center
} ;
2025-03-28 10:28:19 +01:00
var mailButton = new Button
2016-06-27 01:45:38 +02:00
{
Content = "*" ,
FontFamily = new FontFamily ( "Wingdings" ) ,
FontSize = 16 ,
Width = 25 ,
Margin = new Thickness ( 5 ) ,
HorizontalContentAlignment = HorizontalAlignment . Center ,
VerticalContentAlignment = VerticalAlignment . Center
} ;
var phoneButton = new Button
{
Content = ")" ,
FontFamily = new FontFamily ( "Wingdings" ) ,
FontSize = 16 ,
Width = 25 ,
Margin = new Thickness ( 5 ) ,
HorizontalContentAlignment = HorizontalAlignment . Center ,
VerticalContentAlignment = VerticalAlignment . Center
} ;
2025-03-28 10:28:19 +01:00
var cancelButton = new Button { Content = "Schließen" } ;
2016-06-27 01:45:38 +02:00
cancelButton . Margin = new Thickness ( 5 ) ;
2023-12-20 00:51:44 +01:00
cancelButton . Width = 100 ;
cancelButton . HorizontalAlignment = HorizontalAlignment . Right ;
2026-01-09 17:47:05 +01:00
var handbuchLabel = new Label
{
Content = "Handbuch öffnen" ,
FontWeight = FontWeights . Bold ,
Margin = new Thickness ( 5 ) ,
HorizontalContentAlignment = HorizontalAlignment . Center ,
VerticalContentAlignment = VerticalAlignment . Center
} ;
2016-06-27 01:45:38 +02:00
var mailLabel = new Label
{
Content = "Support-Mail schreiben" ,
FontWeight = FontWeights . Bold ,
Margin = new Thickness ( 5 ) ,
HorizontalContentAlignment = HorizontalAlignment . Center ,
VerticalContentAlignment = VerticalAlignment . Center
} ;
//var mailButtonLabel = new Button
//{
// Content = "Support-Mail schreiben",
// FontWeight = FontWeights.Bold,
// Margin = new Thickness(5),
// HorizontalContentAlignment = HorizontalAlignment.Center,
// VerticalContentAlignment = VerticalAlignment.Center,
// Style = null,
// Background = Brushes.Transparent
//};
//mailButtonLabel.Content = mailLabel;
2026-01-09 17:47:05 +01:00
var textBlockHandbuch = new TextBlock
{
Foreground = Brushes . Black ,
Margin = new Thickness ( 45 , 5 , 5 , 5 ) ,
Text = "Wenn Sie auf das Buch-Symbol klicken, öffnet sich unser Handbuch in Ihrem Browser.\n" +
"Dort finden Sie Erklärungen zu Modulen, Menüs und auch detaillierte Schulungsvideos.\n"
} ;
2016-06-27 01:45:38 +02:00
var textBlockMail = new TextBlock
{
Foreground = Brushes . Black ,
Margin = new Thickness ( 45 , 5 , 5 , 5 ) ,
Text = "Wenn Sie auf das Brief-Symbol klicken öffnet sich ein Fenster,\nin dem Sie eine E-Mail an den BeWoPlaner-Support formulieren können"
} ;
var phoneLabel = new Label
{
2022-05-12 12:08:52 +02:00
Content = "PIN für Support erhalten" ,
2016-06-27 01:45:38 +02:00
FontWeight = FontWeights . Bold ,
Margin = new Thickness ( 5 ) ,
HorizontalContentAlignment = HorizontalAlignment . Center ,
VerticalContentAlignment = VerticalAlignment . Center
} ;
var textBlockPhone = new TextBlock
{
Foreground = Brushes . Black ,
Margin = new Thickness ( 45 , 5 , 5 , 5 ) ,
Text = "Wenn Sie auf das PIN-Symbol klicken, wird Ihnen eine zufällige Support-PIN angezeigt.\n\n" +
2025-03-28 10:28:19 +01:00
"Benötigen wir zur Lösung einer Support-Anfrage den Zugriff auf Ihre Datenbank,\n" +
"werden Sie " + Translator . Translate ( "vom Support-Mitarbeiter" ) + " gebeten, ihm eine solche Support-PIN zu übermitteln.\n" +
"Diese PIN ist nur einmalig nutzbar/gültig. Sie wird nicht automatisch an den Support übermittelt.\n" +
"Dies stellt sicher, dass " + Translator . Translate ( "ein Support-Mitarbeiter" ) + " nicht ohne Ihre Einwilligung auf Ihre Datenbank zugreifen kann.\n" +
"Jeder Support-Zugriff auf Ihre Datenbank wird zudem mit Hilfe der PIN protokolliert."
2016-06-27 01:45:38 +02:00
} ;
2025-03-28 10:28:19 +01:00
/ *
2019-07-25 15:59:20 +02:00
* < TextBlock Grid . Row = "7" Grid . Column = "3" HorizontalAlignment = "Right" VerticalAlignment = "Bottom" FontSize = "10" Margin = "0,5,12,5" >
2022-04-13 17:40:15 +02:00
< Hyperlink x : Name = "hyperlink" TargetName = "newWindow" Foreground = "#FF818181" NavigateUri = "https://www.ownsoft.de" RequestNavigate = "Hyperlink_OnRequestNavigate" > www . ownsoft . de < / Hyperlink >
2019-07-25 15:59:20 +02:00
< / TextBlock >
* /
2025-03-28 10:28:19 +01:00
var tvLabel = new Label
{
Content = "Support per Fernwartung" ,
FontWeight = FontWeights . Bold ,
Margin = new Thickness ( 40 , 5 , 5 , 5 )
} ;
2020-11-10 02:25:15 +01:00
2025-03-28 10:28:19 +01:00
var textBlockTeamViewer = new TextBlock
{
Foreground = Brushes . Black ,
Margin = new Thickness ( 45 , 5 , 5 , 5 ) ,
Text = "Wenn Sie in einem Telefonat mit " + Translator . Translate ( "einem unserer Support-Mitarbeiter" ) + " aufgefordert werden\nden Teamviewer zu installieren, so können Sie ihn hier herunterladen."
} ;
2020-11-10 02:25:15 +01:00
2025-03-28 10:28:19 +01:00
var supportToolLink = new TextBlock
{
Foreground = Brushes . Black ,
Margin = new Thickness ( 45 , 5 , 5 , 5 ) ,
FontSize = 12
2019-08-01 11:27:28 +02:00
2025-03-28 10:28:19 +01:00
} ;
2019-08-01 11:27:28 +02:00
2025-03-28 10:28:19 +01:00
String linkText = "Teamviewer herunterladen" ;
String url = "https://get.teamviewer.com/dj5y4zy" ;
2019-08-01 11:27:28 +02:00
2025-03-28 10:28:19 +01:00
if ( ! String . IsNullOrWhiteSpace ( BeWoApp . Mandator . SupportToolUrl ) )
{
url = BeWoApp . Mandator . SupportToolUrl ;
if ( BeWoApp . Mandator . SupportToolUrl . Contains ( "<" ) & & BeWoApp . Mandator . SupportToolUrl . Contains ( ">" ) & & BeWoApp . Mandator . SupportToolUrl . IndexOf ( "<" ) > 0 )
{
linkText = BeWoApp . Mandator . SupportToolUrl . Substring ( 0 , BeWoApp . Mandator . SupportToolUrl . IndexOf ( "<" ) ) ;
url = BeWoApp . Mandator . SupportToolUrl . Substring ( BeWoApp . Mandator . SupportToolUrl . IndexOf ( "<" ) ) ;
url = url . Replace ( "<" , "" ) . Replace ( ">" , "" ) ;
}
2019-08-01 11:27:28 +02:00
2025-03-28 10:28:19 +01:00
}
Hyperlink link = new Hyperlink ( ) ;
link . NavigateUri = new Uri ( url ) ;
link . TargetName = "newWindow" ;
link . Inlines . Add ( linkText ) ;
supportToolLink . Inlines . Add ( link ) ;
link . RequestNavigate + = ( s , e2 ) = >
{
System . Diagnostics . Process . Start (
new System . Diagnostics . ProcessStartInfo ( ( s as Hyperlink ) . NavigateUri . ToString ( ) ) ) ;
} ;
2019-07-25 15:59:20 +02:00
2025-03-28 10:28:19 +01:00
BeWoWindow bewoWindow = BeWoWpfUtils . CreateBeWoPopupWindow ( 300 , 1000 , true ) ;
2016-06-27 01:45:38 +02:00
cancelButton . Click + = delegate { bewoWindow . Close ( ) ; } ;
2025-03-28 10:28:19 +01:00
2026-01-09 17:47:05 +01:00
handbuchButton . Click + = delegate
{
bewoWindow . Close ( ) ;
OpenHandbuchWindow ( ) ;
} ;
2016-06-27 01:45:38 +02:00
mailButton . Click + = delegate
{
bewoWindow . Close ( ) ;
CreateSupportMailWindow ( ) ;
} ;
phoneButton . Click + = delegate
{
bewoWindow . Close ( ) ;
CreateSupportRequestWindow ( ) ;
} ;
//var mailHelpButton = new Button
//{
// Content = "?",
// Width = 25,
// Margin = new Thickness(5),
// HorizontalContentAlignment = HorizontalAlignment.Center,
// VerticalContentAlignment = VerticalAlignment.Center,
// ToolTip = "Wenn Sie auf das Brief-Symbol klicken öffnet sich ein Fenster,\nin dem Sie eine E-Mail an den BeWoPlaner-Support formulieren können"
//};
//var phoneHelpButton = new Button
//{
// Content = "?",
// Width = 25,
// Margin = new Thickness(5),
// HorizontalContentAlignment = HorizontalAlignment.Center,
// VerticalContentAlignment = VerticalAlignment.Center,
// ToolTip = "Wenn Sie auf das PIN-Symbol klicken, wird Ihnen eine zufällige Support-PIN angezeigt.\n\n" +
// "Benötigen wir zur Lösung einer Support-Anfrage den Zugriff auf Ihre Datenbank,\n" +
// "werden Sie vom Support-Mitarbeiter gebeten, ihm eine solche Support-PIN zu übermitteln.\n" +
// "Diese PIN ist nur einmalig nutzbar/gültig. Sie wird nicht automatisch an den Support übermittelt.\n" +
// "Dies stellt sicher, dass ein Support-Mitarbeiter nicht ohne Ihre Einwilligung auf Ihre Datenbank zugreifen kann.\n"+
// "Jeder Support-Zugriff auf Ihre Datenbank wird zudem mit Hilfe der PIN protokolliert."
//};
2025-03-28 10:28:19 +01:00
var centeredStackPanel = new StackPanel { Orientation = Orientation . Vertical , VerticalAlignment = VerticalAlignment . Center , HorizontalAlignment = HorizontalAlignment . Center } ;
2026-01-09 17:47:05 +01:00
var handbuchStackPanel = new StackPanel { Orientation = Orientation . Horizontal } ;
2025-03-28 10:28:19 +01:00
var mailStackPanel = new StackPanel { Orientation = Orientation . Horizontal } ;
var phoneStackPanel = new StackPanel { Orientation = Orientation . Horizontal } ;
var tvStackPanel = new StackPanel { Orientation = Orientation . Horizontal } ;
2016-06-27 01:45:38 +02:00
2026-01-09 17:47:05 +01:00
handbuchStackPanel . Children . Add ( handbuchButton ) ;
handbuchStackPanel . Children . Add ( handbuchLabel ) ;
2016-06-27 01:45:38 +02:00
2025-03-28 10:28:19 +01:00
mailStackPanel . Children . Add ( mailButton ) ;
2016-06-27 01:45:38 +02:00
mailStackPanel . Children . Add ( mailLabel ) ;
phoneStackPanel . Children . Add ( phoneButton ) ;
phoneStackPanel . Children . Add ( phoneLabel ) ;
2026-01-09 17:47:05 +01:00
centeredStackPanel . Children . Add ( handbuchStackPanel ) ;
centeredStackPanel . Children . Add ( textBlockHandbuch ) ;
2016-06-27 01:45:38 +02:00
centeredStackPanel . Children . Add ( mailStackPanel ) ;
centeredStackPanel . Children . Add ( textBlockMail ) ;
centeredStackPanel . Children . Add ( phoneStackPanel ) ;
centeredStackPanel . Children . Add ( textBlockPhone ) ;
2025-03-28 10:28:19 +01:00
centeredStackPanel . Children . Add ( tvLabel ) ;
centeredStackPanel . Children . Add ( textBlockTeamViewer ) ;
centeredStackPanel . Children . Add ( supportToolLink ) ;
centeredStackPanel . Children . Add ( cancelButton ) ;
2016-06-27 01:45:38 +02:00
var grid = new Grid
{
2025-03-28 10:28:19 +01:00
Background = ( LinearGradientBrush ) FindResource ( "ObjectEditBackgroundBrush" )
2016-06-27 01:45:38 +02:00
} ;
grid . Children . Add ( centeredStackPanel ) ;
bewoWindow . GroupBoxContent = grid ;
bewoWindow . rootGroupBox . Header = "Support" ;
bewoWindow . Owner = BeWoApp . CurrentBeWo . MainWindow ;
bewoWindow . Show ( ) ;
}
2026-01-09 17:47:05 +01:00
private void OpenHandbuchWindow ( )
{
2026-01-12 11:01:31 +01:00
var handbuch = "https://apps.ownsoft.de/h/5/4368658435" ;
2026-01-12 10:53:22 +01:00
Process . Start ( handbuch ) ;
}
2025-03-28 10:28:19 +01:00
private void CreateSupportMailWindow ( )
2016-06-27 01:45:38 +02:00
{
BeWoWindow bewoWindow = BeWoWpfUtils . CreateBeWoPopupWindow ( 600 , 800 ) ;
bewoWindow . SizeChanged + = delegate
{
2025-03-28 10:28:19 +01:00
bewoWindow . Left = ActualWidth / 2 - bewoWindow . Width / 2 ;
bewoWindow . Top = ActualHeight / 2 - bewoWindow . Height / 2 ;
2016-06-27 01:45:38 +02:00
} ;
//var grid = new Grid
//{
// Background = (LinearGradientBrush) FindResource("ObjectEditBackgroundBrush")
//};
//var infoGrid = new Grid
//{
// Background = (LinearGradientBrush) FindResource("ObjectEditBackgroundBrush")
//};
//var beschreibungLabel = new Label {Content = "Hier können Sie eine E-Mail an den BeWoPlaner-Support formulieren.", Margin = new Thickness(3)};
//var betreffLabel = new Label {Content = "Betreff:", Margin = new Thickness(3)};
//var betreffTextBox = new TextBox {Margin = new Thickness(3, 3, 3, 0)};
//var nachrichtsTextBox = new TextBox
//{
// Margin = new Thickness(3),
// AcceptsReturn = true,
// VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
// HorizontalScrollBarVisibility = ScrollBarVisibility.Auto
//};
//var pinCheckBox = new CheckBox
//{
// Margin = new Thickness(3),
// Content = "PIN anfügen",
// ToolTip = "Nur mit dieser PIN erhält ein Servicemitarbeiter Zugang zu Ihren Daten"
//};
//var abbrechenButton = new Button {Margin = new Thickness(3), Content = "Abbrechen"};
//var schliessenButton = new Button {Margin = new Thickness(3), Content = "Schließen"};
//var sendenButton = new Button
//{
// Margin = new Thickness(3),
// Content = "Senden",
// HorizontalAlignment = HorizontalAlignment.Left
//};
//var zurueckButton = new Button
//{
// Margin = new Thickness(3),
// Content = "Zurück"
//};
//var weiterButton = new Button
//{
// Margin = new Thickness(3),
// Content = "Weiter",
// HorizontalAlignment = HorizontalAlignment.Left
//};
//weiterButton.Click += delegate { bewoWindow.GroupBoxContent = infoGrid; };
//zurueckButton.Click += delegate
//{
// bewoWindow.GroupBoxContent = grid;
// bewoWindow.Left = ActualWidth/2 - bewoWindow.Width/2;
// bewoWindow.Top = ActualHeight/2 - bewoWindow.Height/2;
//};
//grid.ColumnDefinitions.Add(new ColumnDefinition {Width = GridLength.Auto});
//grid.ColumnDefinitions.Add(new ColumnDefinition {Width = GridLength.Auto});
//grid.ColumnDefinitions.Add(new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)});
//grid.ColumnDefinitions.Add(new ColumnDefinition {Width = GridLength.Auto});
//grid.RowDefinitions.Add(new RowDefinition {Height = GridLength.Auto});
//grid.RowDefinitions.Add(new RowDefinition {Height = GridLength.Auto});
//grid.RowDefinitions.Add(new RowDefinition {Height = new GridLength(1, GridUnitType.Star)});
//grid.RowDefinitions.Add(new RowDefinition {Height = GridLength.Auto});
//grid.RowDefinitions.Add(new RowDefinition {Height = GridLength.Auto});
//Grid.SetRow(beschreibungLabel, 0);
//Grid.SetRow(betreffLabel, 1);
//Grid.SetRow(betreffTextBox, 1);
//Grid.SetRow(nachrichtsTextBox, 2);
//Grid.SetRow(abbrechenButton, 3);
//Grid.SetRow(weiterButton, 3);
//Grid.SetColumn(betreffLabel, 0);
//Grid.SetColumn(betreffTextBox, 1);
//Grid.SetColumn(nachrichtsTextBox, 0);
//Grid.SetColumn(abbrechenButton, 3);
//Grid.SetColumn(weiterButton, 0);
//Grid.SetColumnSpan(beschreibungLabel, 4);
//Grid.SetColumnSpan(betreffTextBox, 3);
//Grid.SetColumnSpan(nachrichtsTextBox, 4);
//Grid.SetColumnSpan(weiterButton, 2);
//grid.Children.Add(beschreibungLabel);
//grid.Children.Add(betreffLabel);
//grid.Children.Add(betreffTextBox);
//grid.Children.Add(nachrichtsTextBox);
//grid.Children.Add(abbrechenButton);
//grid.Children.Add(weiterButton);
//abbrechenButton.Click += delegate { bewoWindow.Close(); };
//schliessenButton.Click += delegate { bewoWindow.Close(); };
//sendenButton.Click += delegate
//{
// if (betreffTextBox.Text.IsNullOrEmpty())
// {
// MessageBox.Show("Bitte geben Sie einen Betreff an.", "Senden nicht möglich",
// MessageBoxButton.OK, MessageBoxImage.Warning);
// return;
// }
// if (nachrichtsTextBox.Text.IsNullOrEmpty())
// {
// MessageBox.Show("Bitte tragen Sie eine Nachricht ein.", "Senden nicht möglich",
// MessageBoxButton.OK, MessageBoxImage.Warning);
// return;
// }
// string nachricht = nachrichtsTextBox.Text;
// if (pinCheckBox.IsChecked.HasValue && pinCheckBox.IsChecked.Value)
// {
// nachricht += string.Format("\r\rPIN: {0}", GeneratePIN());
// }
// EMailVersenden(betreffTextBox.Text, nachricht);
//};
//var infoTextBlock = new TextBlock
//{
// Text = _PINInfoText,
// Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 0)),
// Margin = new Thickness(3),
// TextWrapping = TextWrapping.Wrap,
// TextAlignment = TextAlignment.Center,
// VerticalAlignment = VerticalAlignment.Center
//};
//var naviStackPanel = new StackPanel {Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Right};
//naviStackPanel.Children.Add(zurueckButton);
//naviStackPanel.Children.Add(schliessenButton);
//infoGrid.RowDefinitions.Add(new RowDefinition {Height = new GridLength(1, GridUnitType.Star)});
//infoGrid.RowDefinitions.Add(new RowDefinition {Height = GridLength.Auto});
//infoGrid.RowDefinitions.Add(new RowDefinition {Height = GridLength.Auto});
//infoGrid.ColumnDefinitions.Add(new ColumnDefinition());
//infoGrid.ColumnDefinitions.Add(new ColumnDefinition());
//Grid.SetRow(infoTextBlock, 0);
//Grid.SetRow(pinCheckBox, 1);
//Grid.SetRow(naviStackPanel, 2);
//Grid.SetRow(sendenButton, 2);
//Grid.SetColumn(naviStackPanel, 1);
//Grid.SetColumnSpan(infoTextBlock, 2);
//infoGrid.Children.Add(infoTextBlock);
//infoGrid.Children.Add(pinCheckBox);
//infoGrid.Children.Add(sendenButton);
//infoGrid.Children.Add(naviStackPanel);
SupportEMailControl ctrl = new SupportEMailControl ( ) ;
2025-03-28 10:28:19 +01:00
ctrl . SenderName = String . Format ( "{0} {1}" , BeWoApp . LoggedOnEmployee . FirstName , BeWoApp . LoggedOnEmployee . LastName ) ;
if ( BeWoApp . LoggedOnEmployee . ContactInformations ! = null )
{
foreach ( var contact in BeWoApp . LoggedOnEmployee . ContactInformations )
{
if ( contact . ContactType = = ContactType . business_Mail )
{
ctrl . SenderEMail = contact . ContactValue ;
}
}
2016-06-27 01:45:38 +02:00
2025-03-28 10:28:19 +01:00
}
ctrl . CancelButtonClicked + = delegate
{
bewoWindow . Close ( ) ;
} ;
2016-06-27 01:45:38 +02:00
ctrl . OkButtonClicked + = delegate
{
string nachricht = ctrl . Message ;
nachricht = String . Format ( "Supportanfrage von {0} <{1}>:\n\n{2}" , ctrl . SenderName , ctrl . SenderEMail , nachricht ) ;
if ( ctrl . CheckBoxSupportPin . IsChecked . HasValue & & ctrl . CheckBoxSupportPin . IsChecked . Value )
{
nachricht + = string . Format ( "\n\nPIN: {0}" , GeneratePIN ( ) ) ;
}
EMailVersenden ( ctrl . SenderName , ctrl . SenderEMail , ctrl . Subject , nachricht , bewoWindow ) ;
} ;
2025-03-28 10:28:19 +01:00
bewoWindow . GroupBoxContent = ctrl ;
2016-06-27 01:45:38 +02:00
bewoWindow . rootGroupBox . Header = "E-Mail versenden" ;
bewoWindow . Owner = BeWoApp . CurrentBeWo . MainWindow ;
bewoWindow . Show ( ) ;
}
private void EMailVersenden ( string senderName , string senderEMail , string betreff , string nachricht , BeWoWindow window )
{
var result = ServiceFacade . DoMailServiceSync ( m = > m . SendEMailWithSender ( senderName , senderEMail , betreff , nachricht ) ) ;
2025-03-28 10:28:19 +01:00
2016-06-27 01:45:38 +02:00
if ( result )
{
window . Close ( ) ;
MessageBox . Show ( "Die E-Mail wurde erfolgreich versendet." , "E-Mail senden" , MessageBoxButton . OK ,
MessageBoxImage . Information ) ;
}
else
{
MessageBox . Show ( "Die E-Mail konnte leider nicht gesendet werden" , "E-Mail senden" , MessageBoxButton . OK ,
MessageBoxImage . Error ) ;
}
2025-03-28 10:28:19 +01:00
2016-06-27 01:45:38 +02:00
}
private void CreateSupportRequestWindow ( )
{
BeWoWindow bewoWindow = BeWoWpfUtils . CreateBeWoPopupWindow ( withDynamicSize : true ) ;
#region PIN Erzeugen
var grid = new Grid
{
Width = 300d ,
2025-03-28 10:28:19 +01:00
Background = ( LinearGradientBrush ) FindResource ( "ObjectEditBackgroundBrush" )
2016-06-27 01:45:38 +02:00
} ;
2025-03-28 10:28:19 +01:00
var label1 = new Label { Content = "Ihre PIN lautet:" , HorizontalAlignment = HorizontalAlignment . Center } ;
2016-06-27 01:45:38 +02:00
var boldLabel = new Label
{
Content = "" ,
FontWeight = FontWeights . Bold ,
HorizontalAlignment = HorizontalAlignment . Center
} ;
var label3 = new Label
{
Content = "Bitte geben Sie diese PIN beim Support-Anruf an" ,
HorizontalAlignment = HorizontalAlignment . Center
} ;
2025-03-28 10:28:19 +01:00
var cancelButton = new Button { Content = "Schließen" } ;
2016-06-27 01:45:38 +02:00
cancelButton . Click + = delegate { bewoWindow . Close ( ) ; } ;
var centeredStackPanel = new StackPanel
{
Orientation = Orientation . Vertical ,
VerticalAlignment = VerticalAlignment . Center ,
HorizontalAlignment = HorizontalAlignment . Center
} ;
centeredStackPanel . Children . Add ( label1 ) ;
centeredStackPanel . Children . Add ( boldLabel ) ;
centeredStackPanel . Children . Add ( label3 ) ;
centeredStackPanel . Children . Add ( cancelButton ) ;
grid . Children . Add ( centeredStackPanel ) ;
#endregion
#region InfoText
var infoTextBlock = new TextBlock
{
Text = _PINInfoText ,
Foreground = new SolidColorBrush ( Color . FromRgb ( 0 , 0 , 0 ) ) ,
Margin = new Thickness ( 3 ) ,
TextWrapping = TextWrapping . Wrap ,
TextAlignment = TextAlignment . Center ,
VerticalAlignment = VerticalAlignment . Center
} ;
var infoGrid = new Grid
{
2025-03-28 10:28:19 +01:00
Background = ( LinearGradientBrush ) FindResource ( "ObjectEditBackgroundBrush" )
2016-06-27 01:45:38 +02:00
} ;
2025-03-28 10:28:19 +01:00
var pinErzeugenButton = new Button { Content = "PIN erzeugen" , Margin = new Thickness ( 3 ) } ;
2016-06-27 01:45:38 +02:00
2025-03-28 10:28:19 +01:00
infoGrid . RowDefinitions . Add ( new RowDefinition { Height = new GridLength ( 1 , GridUnitType . Star ) } ) ;
infoGrid . RowDefinitions . Add ( new RowDefinition { Height = GridLength . Auto } ) ;
2016-06-27 01:45:38 +02:00
Grid . SetRow ( infoTextBlock , 0 ) ;
Grid . SetRow ( pinErzeugenButton , 1 ) ;
infoGrid . Children . Add ( infoTextBlock ) ;
infoGrid . Children . Add ( pinErzeugenButton ) ;
pinErzeugenButton . Click + = delegate
{
bewoWindow . GroupBoxContent = grid ;
boldLabel . Content = GeneratePIN ( ) ;
} ;
#endregion
bewoWindow . GroupBoxContent = infoGrid ;
bewoWindow . rootGroupBox . Header = "Support" ;
bewoWindow . Owner = BeWoApp . CurrentBeWo . MainWindow ;
bewoWindow . Show ( ) ;
}
private static string GeneratePIN ( int maxSize = 5 )
{
var data = new byte [ 1 ] ;
var crypto = new RNGCryptoServiceProvider ( ) ;
var result = new StringBuilder ( maxSize ) ;
char [ ] chars = "ABCDEFGHJKLMNPQRSTUVWXYZ123456789" . ToCharArray ( ) ;
crypto . GetBytes ( data ) ;
data = new byte [ maxSize ] ;
crypto . GetBytes ( data ) ;
foreach ( byte b in data )
2025-03-28 10:28:19 +01:00
result . Append ( chars [ b % ( chars . Length ) ] ) ;
2016-06-27 01:45:38 +02:00
var pin = new SupportPinDC
{
Pin = result . ToString ( ) ,
IsUsed = false ,
CreationDate = DateTime . Now
} ;
pin . ExpirationDate = pin . CreationDate . Value . AddDays ( 3 ) ;
ServiceFacade . DoUserServiceAsync ( p = >
{
long res = - 1 ;
while ( res = = - 1L )
{
pin = new SupportPinDC
{
Pin = result . ToString ( ) ,
IsUsed = false ,
CreationDate = DateTime . Now
} ;
pin . ExpirationDate = pin . CreationDate . Value . AddDays ( 3 ) ;
res = p . InsertNewSupportPin ( pin ) ;
}
} , false ) ;
return result . ToString ( ) ;
}
private void button_Template_Click ( object sender , RoutedEventArgs e )
{
if ( DoSaveCheck ( ) )
{
NavigateTo ( new WordDocumentTemplateView ( TableID . Mandator , 1 ) ) ;
}
}
2020-12-05 15:47:00 +01:00
//private void UIElement_OnMouseEnter(object sender, MouseEventArgs e)
//{
// AufOffeneTerminePruefen();
//}
2016-06-27 01:45:38 +02:00
public void InitOffeneTermine ( )
{
2020-12-16 21:49:47 +01:00
//if (!_TermineInitialized && BeWoApp.LoggedOnEmployee != null)
//{
// AufOffeneTerminePruefen();
// _TermineInitialized = true;
//}
2016-06-27 01:45:38 +02:00
}
public void AufOffeneTerminePruefen ( )
{
if ( BeWoApp . LoggedOnEmployee ! = null & & BeWoApp . LoggedOnEmployee . EmployeeOid ! = null & & BeWoApp . AppSettings . IsSchedulerAllowed )
ServiceFacade . DoResourceServiceAsync ( rs = > rs . GetAllOpenAppointmentsForEmployee ( BeWoApp . LoggedOnEmployee . EmployeeOid . Value ) , r = > this . Dispatch ( delegate
2025-03-28 10:28:19 +01:00
{
HatNeueTermine = r . Count > 0 ;
} ) , false ) ;
2016-06-27 01:45:38 +02:00
}
private void ToolbarContent_OnLoaded ( object sender , RoutedEventArgs e )
{
InitOffeneTermine ( ) ;
}
2017-03-24 10:42:23 +01:00
2025-03-28 10:28:19 +01:00
private void Button_Vertretungen_OnClick ( object sender , RoutedEventArgs e )
{
if ( DoSaveCheck ( ) )
{
NavigateTo ( GetViewForUIContext ( UIContext . Vertretungen ) ) ;
}
}
private void Button_Scheduling_Click ( object sender , RoutedEventArgs e )
{
if ( DoSaveCheck ( ) )
{
NavigateTo ( GetViewForUIContext ( UIContext . Scheduling ) ) ;
}
}
2024-12-03 14:43:26 +01:00
}
2016-06-27 01:45:38 +02:00
}