diff --git a/BeWo/BeWoApp.xaml b/BeWo/BeWoApp.xaml index 1bb13025c..3086c9add 100644 --- a/BeWo/BeWoApp.xaml +++ b/BeWo/BeWoApp.xaml @@ -108,7 +108,7 @@ Reaktivieren - + @@ -295,8 +295,8 @@ - + Style="{DynamicResource MinimizeFullyButtonStyle }" Click="TogglebuttonChat_Minimize_Checked" /> + Style="{DynamicResource MaximizeButtonStyle}" Checked="TogglebuttonChat_maximise_Checked" Unchecked="TogglebuttonChat_maximise_Unchecked" /> public partial class BeWoApp : Application, INotifyPropertyChanged { - private static FrameworkElement _lockedContent; + private static FrameworkElement _lockedContent; public static LoginControl LoginControl; @@ -145,9 +149,9 @@ namespace BeWo internal static UserDC LoggedOnUser { - get { return _LoggedOnUser; } + get => _LoggedOnUser; - set + set { _LoggedOnUser = value; if (_LoggedOnUser != null) @@ -161,11 +165,7 @@ namespace BeWo ServiceFacade.DoEmployeeServiceAsync(s => s.LoadCompactEmployee(value.Employee.EmployeeOid), r2 => { _CompactLoggedOnEmployee = r2; }); - if (MainControl != null) - { - MainControl.Dispatcher.BeginInvoke(DispatcherPriority.Normal, - (Action) (() => MainControl.InitOffeneTermine())); - } + MainControl?.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) (() => MainControl.InitOffeneTermine())); }); } @@ -520,12 +520,13 @@ namespace BeWo { get { - string lockTime = _Mandator.Settings.SplitToKeyValuePairList(";", "=").FirstOrDefault(f => f.Key.Equals("TimeUntilUILock")).Value; + var lockTime = _Mandator.Settings.SplitToKeyValuePairList(";", "=").FirstOrDefault(f => f.Key.Equals("TimeUntilUILock")).Value; - if (_LoggedOnUser != null && lockTime != null) + if(_LoggedOnUser != null && lockTime != null) { return Convert.ToInt32(lockTime); } + return _LockUITime; } @@ -533,9 +534,12 @@ namespace BeWo { _LockUITime = value; - if (_LoggedOnUser == null) return; + if (_LoggedOnUser == null) + { + return; + } - AutoLockUI.LockUITime = value; + AutoLockUI.LockUITime = value; AutoLockUI.StopTimer(); AutoLockUI.StartAutoLockUIOption(); } @@ -724,7 +728,7 @@ namespace BeWo { if (MainControl != null) { - MainControl.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) (() => MainControl.ShowControlAsModalPopUp(new ExceptionMessageBox(message, ex, showDetails)))); + MainControl.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) (() => MainControl.ShowControlAsModalPopup(new ExceptionMessageBox(message, ex, showDetails)))); } else if (LoginControl != null) { @@ -750,12 +754,12 @@ namespace BeWo EventManager.RegisterClassHandler(typeof (Window), UIElement.PreviewMouseDownEvent, new MouseButtonEventHandler(OnPreviewMouseDown)); EventManager.RegisterClassHandler(typeof (Window), UIElement.PreviewKeyDownEvent, new KeyEventHandler(OnPreviewKeyDown)); - IEnumerable> settingsKVPList = _Mandator.Settings.SplitToKeyValuePairList(";", "="); + var settingsKeyValuePairList = _Mandator.Settings.SplitToKeyValuePairList(";", "=").ToList(); - string x = settingsKVPList.FirstOrDefault(f => f.Key.Equals("TimeUntilUILock")).Value ?? "NULL"; - int y = _LockUITime; + var x = settingsKeyValuePairList.FirstOrDefault(f => f.Key.Equals("TimeUntilUILock")).Value ?? "NULL"; + var y = _LockUITime; - AutoLockUI.LockUITime = Convert.ToInt32(settingsKVPList.FirstOrDefault(f => f.Key.Equals("TimeUntilUILock")).Value ?? LockUITime.ToString()); + AutoLockUI.LockUITime = Convert.ToInt32(settingsKeyValuePairList.FirstOrDefault(f => f.Key.Equals("TimeUntilUILock")).Value ?? LockUITime.ToString()); AutoLockUI.DoAutoLockUIEvent += AutoLockUIDoAutoLockUIEvent; @@ -885,7 +889,7 @@ namespace BeWo } - private void btnOpenServiceRecordView_Click(object sender, RoutedEventArgs e) + private void BtnOpenServiceRecordView_Click(object sender, RoutedEventArgs e) { var btn = sender as Button; if (btn == null) return; @@ -898,37 +902,36 @@ namespace BeWo MainControl.NavigateToServiceRecordView(dc.SupportConceptOid); } - private void togglebutton_maximise_Checked(object sender, RoutedEventArgs e) + private void Togglebutton_maximise_Checked(object sender, RoutedEventArgs e) { if (MainControl != null) MainControl.Maximize(); } - private void togglebutton_maximise_Unchecked(object sender, RoutedEventArgs e) + private void Togglebutton_maximise_Unchecked(object sender, RoutedEventArgs e) { if (MainControl != null) MainControl.Minimize(); } - private void togglebuttonChat_maximise_Unchecked(object sender, RoutedEventArgs e) + private void TogglebuttonChat_maximise_Unchecked(object sender, RoutedEventArgs e) { if (MainControl.HomeView.ServiceChatView != null) MainControl.HomeView.ServiceChatView.Normal(); } - private void togglebuttonChat_maximise_Checked(object sender, RoutedEventArgs e) + private void TogglebuttonChat_maximise_Checked(object sender, RoutedEventArgs e) { if (MainControl.HomeView.ServiceChatView != null) MainControl.HomeView.ServiceChatView.Maximize(); } - private void togglebuttonChat_Minimize_Checked(object sender, RoutedEventArgs e) + private void TogglebuttonChat_Minimize_Checked(object sender, RoutedEventArgs e) { if (MainControl.HomeView.ServiceChatView != null) MainControl.HomeView.ServiceChatView.Minimize(); } - private void FrameLeftMouseDown(object sender, MouseButtonEventArgs e) { var border = (Border) sender; @@ -963,13 +966,13 @@ namespace BeWo return; } - if (CurrentBeWo.MainWindow.Content is LockedPage) + if (CurrentBeWo.MainWindow?.Content is LockedPage) { AutoLockUI.StartAutoLockUIOption(); return; } - _lockedContent = CurrentBeWo.MainWindow.Content as FrameworkElement; + _lockedContent = CurrentBeWo.MainWindow?.Content as FrameworkElement; if (_lockedContent is Grid && (_lockedContent as Grid).Children.Contains(LoginControl)) { @@ -977,17 +980,25 @@ namespace BeWo return; } - WindowCollection fenster = CurrentBeWo.Windows; - //OpenDevExpressEditForms = (from Window x in fenster where !x.Title.Equals("BeWoPlaner") || x.GetType() != typeof (MainWindow) select x).ToList(); + var openWindowCollection = Current.Windows; + foreach(var blubb in openWindowCollection) + { + var abc = (Window) blubb; + if(!abc.Title.Equals("BeWoPlaner") && blubb.GetType() == typeof(WindowContentHolder)) + { + abc.Close(); + } + } - //OpenDevExpressEditForms.ForEach(fe => fe.Close()); + MainControl.HideCurrentModalViewWindows(); - var lockedPage = new LockedPage(); + var lockedPage = new LockedPage(); lockedPage.ButtonLogin.Click += UnlockBeWoPlaner; CurrentBeWo.MainWindow.Content = lockedPage; - CurrentBeWo.MainWindow.Focus(); + + Current.Dispatcher.Invoke(new Action(() => CurrentBeWo.MainWindow?.Activate())); AutoLockUI.StartAutoLockUIOption(); } @@ -1010,8 +1021,7 @@ namespace BeWo return; } - - username = String.Format("{0}//Version={1}", username, "Sperrung aufgehoben"); + username = $"{username}//Version=Sperrung aufgehoben"; ServiceFacade.DoUserServiceAsync(u => u.IsUserValid(username, password, ""), r => { @@ -1021,22 +1031,15 @@ namespace BeWo return; } - Current.Dispatch(delegate - { - CurrentBeWo.MainWindow.Content = _lockedContent; - //foreach(Window form in OpenDevExpressEditForms) - //{ - // try - // { - // //form.Show(); - // } - // catch(Exception exception) - // { - // ShowError("Ein Fehler ist beim Entsperren aufgetreten", exception, true); - // } - //} + AutoLockUI.HasJustBeenUnlocked = true; + + Current.Dispatcher.Invoke(delegate + { + CurrentBeWo.MainWindow.Content = _lockedContent; + + MainControl.ShowCurrentModalViewWindowsAgain(); }); - }, true); + }, true); } private static void OnPreviewMouseDown(object sender, MouseButtonEventArgs e) diff --git a/BeWo/Core/AutoLockUI.cs b/BeWo/Core/AutoLockUI.cs index 993dcb8d9..718c28077 100644 --- a/BeWo/Core/AutoLockUI.cs +++ b/BeWo/Core/AutoLockUI.cs @@ -11,33 +11,41 @@ namespace BeWo.Core public delegate void DoAutoLockUI(); public static event DoAutoLockUI DoAutoLockUIEvent; - static public void StartAutoLockUIOption() + public static bool HasJustBeenUnlocked { get; set; } + + public static void StartAutoLockUIOption() { + HasJustBeenUnlocked = false; System.Windows.Interop.ComponentDispatcher.ThreadIdle += DispatcherQueueEmptyHandler; } - static void _timerTick(object sender, EventArgs e) + private static void _timerTick(object sender, EventArgs e) { - if (_Timer == null) return; + if (_Timer == null) + { + return; + } System.Windows.Interop.ComponentDispatcher.ThreadIdle -= DispatcherQueueEmptyHandler; _Timer.Stop(); _Timer = null; - if (DoAutoLockUIEvent != null) - DoAutoLockUIEvent(); + DoAutoLockUIEvent?.Invoke(); } public static void StopTimer() { - if (_Timer == null) return; + if (_Timer == null) + { + return; + } System.Windows.Interop.ComponentDispatcher.ThreadIdle -= DispatcherQueueEmptyHandler; _Timer.Stop(); _Timer = null; } - static void DispatcherQueueEmptyHandler(object sender, EventArgs e) + private static void DispatcherQueueEmptyHandler(object sender, EventArgs e) { if (_Timer == null) { @@ -55,13 +63,18 @@ namespace BeWo.Core else { if (LockUITime == 0) - StopTimer(); + { + StopTimer(); + } } } public static void ResetLockUITimer() { - if (_Timer == null) return; + if (_Timer == null) + { + return; + } _Timer.Enabled = false; _Timer.Enabled = true; diff --git a/BeWo/Core/BeWoUtils.cs b/BeWo/Core/BeWoUtils.cs index 5d289698e..87d2d0cb7 100644 --- a/BeWo/Core/BeWoUtils.cs +++ b/BeWo/Core/BeWoUtils.cs @@ -8,7 +8,6 @@ using System.Linq; using System.Net; using System.Text; using System.Text.RegularExpressions; -using System.Threading; using System.Windows; using System.Windows.Controls; using System.Windows.Forms; @@ -45,19 +44,18 @@ using Image = System.Windows.Controls.Image; using MessageBox = System.Windows.MessageBox; using Panel = System.Windows.Controls.Panel; using System.Windows.Media; -using System.Windows.Threading; using BeWo.ownChat; using BeWo.PasswortSecurity; -using ChatController.HauptKlassen; using DevExpress.Xpf.Bars; using DevExpress.Xpf.DocumentViewer; using DevExpress.Xpf.Printing.PreviewControl.Bars; -using Newtonsoft.Json; namespace BeWo.Core { public static class BeWoUtils { + public static ModalViewWindow CurrentModalViewWindow { get; set; } + public static Dictionary ParseQuery(string query) { try @@ -290,12 +288,12 @@ namespace BeWo.Core else if (tType == typeof (OrganisationVM)) { View = new OrganisationView(viewModel as OrganisationVM) { ParentView = ownerView, MinWidth = 800, IsInWindow = true }; - (View as OrganisationView).OrganisationSavedOrUpdated += organisationSavedOrUpdated; + ((OrganisationView) View).OrganisationSavedOrUpdated += organisationSavedOrUpdated; } else if (tType == typeof (PersonVM)) { View = new PersonView(viewModel as PersonVM) {ParentView = ownerView, MinWidth = 800, IsInWindow = true}; - (View as PersonView).PersonSavedOrUpdated += personSavedOrUpdated; + ((PersonView) View).PersonSavedOrUpdated += personSavedOrUpdated; } else if (tType == typeof (TeamVM)) { @@ -316,24 +314,30 @@ namespace BeWo.Core View.ModalEditViewUpdateCallback = applyChanges; - var modalViewWindow = new ModalViewWindow(View, ownerView, allowSaveIfParentDirty); + CurrentModalViewWindow = new ModalViewWindow(View, ownerView, allowSaveIfParentDirty) {Title = viewModel.ToString()}; - BeWoApp.MainControl.OpenedModalViewWindows.Add(modalViewWindow); + BeWoApp.MainControl.OpenedModalViewWindows.Add(CurrentModalViewWindow); foreach (var window in BeWoApp.MainControl.OpenedModalViewWindows.Where(window => !BeWoApp.MainControl.OpenedModalViewWindows.Last().Equals(window))) { ShowModalBackground(window.RootGrid); } - var dialogResult = modalViewWindow.ShowDialog(); + //var dialogResult = + CurrentModalViewWindow.Show(); + } - if (BeWoApp.MainControl.OpenedModalViewWindows.Count > 1) + public static void RemoveModalViewWindow() + { + if(BeWoApp.MainControl.OpenedModalViewWindows.Count > 1 && CurrentModalViewWindow != null) { - var nextToLastWindow = BeWoApp.MainControl.OpenedModalViewWindows.ElementAt(BeWoApp.MainControl.OpenedModalViewWindows.Count - 2); - nextToLastWindow.RootGrid.Children.RemoveAt(1); + var nextToLastWindowWithModalBackground = BeWoApp.MainControl.OpenedModalViewWindows.ElementAt(BeWoApp.MainControl.OpenedModalViewWindows.Count - 2); + nextToLastWindowWithModalBackground.RootGrid.Children.RemoveAt(1); } - BeWoApp.MainControl.OpenedModalViewWindows.Remove(modalViewWindow); + BeWoApp.MainControl.OpenedModalViewWindows.Remove(CurrentModalViewWindow); + + CurrentModalViewWindow = BeWoApp.MainControl.OpenedModalViewWindows.Count > 0 ? BeWoApp.MainControl.OpenedModalViewWindows.ElementAt(BeWoApp.MainControl.OpenedModalViewWindows.Count - 1) : null; } public static bool CheckViewIsCalledFromWindow(BeWoView view) @@ -341,7 +345,7 @@ namespace BeWo.Core return ((Grid) view.Parent).Parent.GetType() == typeof (Window); } - private static void ShowModalBackground(Grid gridToBlock) + private static void ShowModalBackground(Panel gridToBlock) { var detailViewBackGround = new Grid { @@ -352,11 +356,15 @@ namespace BeWo.Core }; if (gridToBlock.Children.OfType().Any(obj => obj.Name.Equals("DetailViewBackGround"))) + { return; + } Grid.SetColumnSpan(detailViewBackGround, 3); Grid.SetRowSpan(detailViewBackGround, 3); + gridToBlock.Children.Add(detailViewBackGround); + Panel.SetZIndex(detailViewBackGround, int.MaxValue - 1); } @@ -1051,7 +1059,7 @@ namespace BeWo.Core else if (typeof(T) == typeof(CompactOrganisationDC)) { var updatedOrganisation = new CompactOrganisationDC(); - + // TODO: in Endlosschleife gefangen, wenn in modalem Fenster geöffnet ServiceFacade.DoCustomerServiceSync(s => updatedOrganisation = s.LoadOrganisationCompact((updatedObject as CompactOrganisationDC).OrganisationOid)); foreach (var item in ServiceRecordView2.ViewModel.VMList.Where(item => item.CostBearer.Equals(updatedOrganisation))) @@ -1888,7 +1896,6 @@ namespace BeWo.Core BeWoApp.MainControl.EndWaiting(); } - public static PasswortSecurityStrength CheckPasswordSecurity(string paswd) { PasswortSicherheit pwS = new PasswortSicherheit(); @@ -1973,8 +1980,6 @@ namespace BeWo.Core } } - - public static void OwnChatSynchronisationVeranlassen() { diff --git a/BeWo/LockedPage.xaml b/BeWo/LockedPage.xaml index 151255fbe..7dddef8b9 100644 --- a/BeWo/LockedPage.xaml +++ b/BeWo/LockedPage.xaml @@ -4,7 +4,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - mc:Ignorable="d" Width="Auto" Background="{StaticResource LoginBackground}" SnapsToDevicePixels="False"> + mc:Ignorable="d" Width="Auto" Background="{StaticResource LoginBackground}" SnapsToDevicePixels="False" Focusable="True"> diff --git a/BeWo/LockedPage.xaml.cs b/BeWo/LockedPage.xaml.cs index a5ac5ecc3..86ef169ef 100644 --- a/BeWo/LockedPage.xaml.cs +++ b/BeWo/LockedPage.xaml.cs @@ -1,5 +1,4 @@ -using System; -using System.Windows; +using System.Windows; namespace BeWo { @@ -10,10 +9,8 @@ namespace BeWo InitializeComponent(); Loaded += LockedPage_Loaded; - - LblVersion.Content = BeWoApp.Version; - lblGesperrt.Content = String.Format("Gesperrt von Benutzer {0} {1}", BeWoApp.LoggedOnUser.Employee.FirstName, BeWoApp.LoggedOnUser.Employee.LastName); + lblGesperrt.Content = $"Gesperrt von Benutzer {BeWoApp.LoggedOnUser.Employee.FirstName} {BeWoApp.LoggedOnUser.Employee.LastName}"; } private void LockedPage_Loaded(object sender, RoutedEventArgs e) diff --git a/BeWo/MainControl.xaml.cs b/BeWo/MainControl.xaml.cs index 5bb879e8f..24bf0be13 100644 --- a/BeWo/MainControl.xaml.cs +++ b/BeWo/MainControl.xaml.cs @@ -5,7 +5,6 @@ using System.Diagnostics; using System.Linq; using System.Security.Cryptography; using System.Text; -using System.Threading; using System.Windows; using System.Windows.Controls; using System.Windows.Input; @@ -21,7 +20,6 @@ using BeWo.SchulbegleitenderDienst; using BeWo.ServiceProxy; using BeWo.View; using BeWo.View.Detail; -using BeWo.View.Detail.Report; using BeWo.View.Master; using BeWo.View.Navigation; using BeWo.ViewModel; @@ -29,7 +27,6 @@ using BeWo.ViewModel; using BS.Shared; using BS.Shared.DataContracts; using BS.Shared.Extensions; - using DevExpress.Xpf.Editors; using DevExpress.Xpf.Scheduler; using Hyperlink = System.Windows.Documents.Hyperlink; @@ -53,23 +50,18 @@ namespace BeWo CustomerTeam } - /// - /// Interaktionslogik für MainControl.xaml - /// - public partial class MainControl : UserControl + public partial class MainControl { private const string _PINInfoText = "Um Zugriff auf Ihre Daten zu bekommen, benötigen wir eine PIN."; - private readonly Stack _ModalPopUpControls = new Stack(); + private readonly Stack _ModalPopupControls = new Stack(); private BeWoView _CurrentDetailView; - private Control _CurrentModalPopUp; + private Control _CurrentModalPopup; private HomeDragPanelView _HomeView; - private bool _IsMaximized; - - private bool _TermineInitialized; + private bool _TermineInitialized; private Dictionary _Views = new Dictionary(); private WaitLayer2 _WaitLayer; @@ -88,14 +80,13 @@ namespace BeWo OpenedModalViewWindows = new List(); - if (!String.IsNullOrWhiteSpace(BeWoApp.AppSettings.TimeRecordingMenuName)) + if (!string.IsNullOrWhiteSpace(BeWoApp.AppSettings.TimeRecordingMenuName)) { button_serviceRecord.Content = BeWoApp.AppSettings.TimeRecordingMenuName; } + BeWoApp.InitAutoUILocking(); - - #if DEBUG //nix #else @@ -117,9 +108,6 @@ namespace BeWo this.button_SchulbegleitenderDienst.Visibility = Visibility.Collapsed; } #endif - - - } public List OpenedModalViewWindows { get; set; } @@ -129,7 +117,7 @@ namespace BeWo get { return _Views; } } - public Grid ModalPopUpBackGround { get; private set; } + public Grid ModalPopupBackGround { get; private set; } public HomeDragPanelView HomeView { @@ -150,14 +138,9 @@ namespace BeWo } } - public bool IsMaximized - { - get { return _IsMaximized; } + public bool IsMaximized { get; set; } - set { _IsMaximized = value; } - } - - private bool _HatNeueTermine; + private bool _HatNeueTermine; public bool HatNeueTermine { get { return _HatNeueTermine; } @@ -254,7 +237,7 @@ namespace BeWo AnimateOpacity(pOpacitiy, 500); } - public void ChangePopUpOpacityMode(bool isPopUpVisible) + public void ChangePopupOpacityMode(bool isPopUpVisible) { if (isPopUpVisible) { @@ -268,23 +251,24 @@ namespace BeWo public void CloseCurrentPopUp() { - if (ModalPopUpBackGround != null) + if (ModalPopupBackGround != null) { Dispatcher.BeginInvoke( DispatcherPriority.Normal, (Action) delegate { - grid_main.Children.Remove(_CurrentModalPopUp); - _CurrentModalPopUp = null; - if (_ModalPopUpControls.Count == 0) + grid_main.Children.Remove(_CurrentModalPopup); + _CurrentModalPopup = null; + + if(_ModalPopupControls.Count == 0) { - grid_main.Children.Remove(ModalPopUpBackGround); - ModalPopUpBackGround = null; + grid_main.Children.Remove(ModalPopupBackGround); + ModalPopupBackGround = null; } else { - Control control = _ModalPopUpControls.Pop(); - _CurrentModalPopUp = control; + var control = _ModalPopupControls.Pop(); + _CurrentModalPopup = control; grid_main.Children.Add(control); Panel.SetZIndex(control, int.MaxValue); } @@ -292,6 +276,36 @@ namespace BeWo } } + public void HideCurrentModalViewWindows() + { + if(ModalPopupBackGround != null) + { + Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate + { + ModalPopupBackGround.Visibility = Visibility.Collapsed; + + foreach(var modalPopup in OpenedModalViewWindows) + { + modalPopup.Hide(); + } + }); + } + } + + // TODO: öffnet nur ein modales Fenster + public void ShowCurrentModalViewWindowsAgain() + { + if(OpenedModalViewWindows.Count > 0 && ModalPopupBackGround != null) + { + ModalPopupBackGround.Visibility = Visibility.Visible; + + foreach(var modalPopup in OpenedModalViewWindows) + { + modalPopup.Show(); + } + } + } + public void EndWaiting() { Dispatcher.BeginInvoke( @@ -341,30 +355,30 @@ namespace BeWo } } - public void ShowControlAsModalPopUp(Control control) + public void ShowControlAsModalPopup(Control control) { - ShowControlAsModalPopUp(control, HorizontalAlignment.Center, VerticalAlignment.Center); + ShowControlAsModalPopup(control, HorizontalAlignment.Center, VerticalAlignment.Center); } - public void ShowControlAsModalPopUp(Control control, HorizontalAlignment ha, VerticalAlignment va) + public void ShowControlAsModalPopup(Control control, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment) { Dispatcher.BeginInvoke( DispatcherPriority.Normal, (Action) delegate { - if (_CurrentModalPopUp != null) + if (_CurrentModalPopup != null) { - grid_main.Children.Remove(_CurrentModalPopUp); - _ModalPopUpControls.Push(_CurrentModalPopUp); + grid_main.Children.Remove(_CurrentModalPopup); + _ModalPopupControls.Push(_CurrentModalPopup); } else { ShowModalBackground(); } - _CurrentModalPopUp = control; - control.HorizontalAlignment = ha; - control.VerticalAlignment = va; + _CurrentModalPopup = control; + control.HorizontalAlignment = horizontalAlignment; + control.VerticalAlignment = verticalAlignment; Grid.SetColumnSpan(control, 3); Grid.SetRowSpan(control, 3); grid_main.Children.Add(control); @@ -632,7 +646,7 @@ namespace BeWo ApplicationCommands.Save, (s, e) => { - if (_CurrentModalPopUp == null) + if (_CurrentModalPopup == null) { _CurrentDetailView.SaveData(); } @@ -643,13 +657,13 @@ namespace BeWo }, (s, e) => { - if (_CurrentModalPopUp == null) + if (_CurrentModalPopup == null) { e.CanExecute = _CurrentDetailView != null ? _CurrentDetailView.IsDirty : false; } else { - e.CanExecute = _CurrentDetailView != null && (_CurrentModalPopUp is BeWoView && ((BeWoView) _CurrentModalPopUp).IsDirty); + e.CanExecute = _CurrentDetailView != null && (_CurrentModalPopup is BeWoView && ((BeWoView) _CurrentModalPopup).IsDirty); } })); @@ -664,7 +678,7 @@ namespace BeWo ApplicationCommands.Close, (s, e) => { - if (_CurrentModalPopUp == null && DoSaveCheck()) + if (_CurrentModalPopup == null && DoSaveCheck()) { if (_CurrentDetailView.ParentView != null) _CurrentDetailView.ParentView.ChildViewClosed(); @@ -757,14 +771,19 @@ namespace BeWo internal void ShowModalBackground() { - ModalPopUpBackGround = new Grid(); - ModalPopUpBackGround.IsHitTestVisible = true; - ModalPopUpBackGround.Background = Brushes.White; - ModalPopUpBackGround.Opacity = .5; - Grid.SetColumnSpan(ModalPopUpBackGround, 3); - Grid.SetRowSpan(ModalPopUpBackGround, 3); - grid_main.Children.Add(ModalPopUpBackGround); - Panel.SetZIndex(ModalPopUpBackGround, int.MaxValue - 1); + ModalPopupBackGround = new Grid + { + IsHitTestVisible = true, + Background = Brushes.White, + Opacity = .5 + }; + + Grid.SetColumnSpan(ModalPopupBackGround, 3); + Grid.SetRowSpan(ModalPopupBackGround, 3); + + grid_main.Children.Add(ModalPopupBackGround); + + Panel.SetZIndex(ModalPopupBackGround, int.MaxValue); } private void logoutanimation_Completed(object sender, EventArgs e) @@ -1038,17 +1057,17 @@ namespace BeWo private void maximizeAnimation_Completed(object sender, EventArgs e) { - _IsMaximized = true; + IsMaximized = true; } private void minimizeAnimation_Completed(object sender, EventArgs e) { - _IsMaximized = false; + IsMaximized = false; } private void toolbarRoot_MouseEnter(object sender, MouseEventArgs e) { - if (_IsMaximized) + if (IsMaximized) { AnimateToolbarIn(500); } @@ -1056,7 +1075,7 @@ namespace BeWo private void toolbarRoot_MouseLeave(object sender, MouseEventArgs e) { - if (_IsMaximized) + if (IsMaximized) { AnimateToolbarOut(200); } diff --git a/BeWo/Scheduler/View/NewSchedulerView.xaml.cs b/BeWo/Scheduler/View/NewSchedulerView.xaml.cs index 5c9c64b2f..292ac05be 100644 --- a/BeWo/Scheduler/View/NewSchedulerView.xaml.cs +++ b/BeWo/Scheduler/View/NewSchedulerView.xaml.cs @@ -402,7 +402,7 @@ namespace BeWo.Scheduler.View private void ConstructObject() { - WriteToDebugLog("Beginning"); + //WriteToDebugLog("Beginning"); IsEmployeeBrushVisible = true; if (BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderMitarbeitertermineAnsehen)) @@ -471,7 +471,7 @@ namespace BeWo.Scheduler.View break; } - WriteToDebugLog("Done"); + //WriteToDebugLog("Done"); } //private void Synchronize() @@ -497,18 +497,18 @@ namespace BeWo.Scheduler.View #region InitViewModel private void InitViewModel() { - WriteToDebugLog("Beginning"); + //WriteToDebugLog("Beginning"); ViewModel = new NewSchedulerViewModel(); ViewModel.ViewModelChanged += ViewModel_ViewModelChanged; ViewModel.ViewModelChanged += UpdateRequestStringEvent; - WriteToDebugLog("Done"); + //WriteToDebugLog("Done"); } private void ViewModel_ViewModelChanged(object sender, EventArgs e) { this.Dispatch(() => { - WriteToDebugLog("Beginning"); + //WriteToDebugLog("Beginning"); UpdateDataSource(e.Data); @@ -522,13 +522,13 @@ namespace BeWo.Scheduler.View _IstErsterAufruf = false; } - WriteToDebugLog("Done"); + //WriteToDebugLog("Done"); }); } private void InitScheduler() { - WriteToDebugLog("Beginning"); + //WriteToDebugLog("Beginning"); Scheduler.Start = DateTime.Now; _TimelineDayCount = 0; Scheduler.DayView.NavigationButtonVisibility = NavigationButtonVisibility.Always; @@ -549,7 +549,7 @@ namespace BeWo.Scheduler.View Scheduler.TimelineView.NavigationButtonVisibility = NavigationButtonVisibility.Always; Scheduler.TimelineView.ResourcesPerPage = 0; - WriteToDebugLog("Done"); + //WriteToDebugLog("Done"); } private void InitRights() @@ -565,7 +565,7 @@ namespace BeWo.Scheduler.View { try { - WriteToDebugLog("Beginning"); + //WriteToDebugLog("Beginning"); IgnoreChangeEvents = true; Scheduler.Storage.BeginUpdate(); @@ -619,13 +619,13 @@ namespace BeWo.Scheduler.View { Scheduler.Storage.EndUpdate(); IgnoreChangeEvents = false; - WriteToDebugLog("Done"); + //WriteToDebugLog("Done"); } } private void UpdateSchedulerSettings() { - WriteToDebugLog("Beginning"); + //WriteToDebugLog("Beginning"); var settings = ViewModel.GetActiveSettings(); Scheduler.Start = settings.StartDate; @@ -675,15 +675,15 @@ namespace BeWo.Scheduler.View MessageBox.Show("Ein Fehler bei der Darstellung ist aufgetreten.", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error); } - WriteToDebugLog("Done"); + //WriteToDebugLog("Done"); } private void UpdateCustomFieldMappings(ISchedulerViewModel vm) { - WriteToDebugLog("Beginning"); + //WriteToDebugLog("Beginning"); Scheduler.Storage.AppointmentStorage.CustomFieldMappings.Clear(); vm.AddCustomFieldsMapping(Scheduler.Storage); - WriteToDebugLog("Done"); + //WriteToDebugLog("Done"); } #endregion @@ -937,7 +937,7 @@ namespace BeWo.Scheduler.View return; } - WriteToDebugLog("Appointment chaning..."); + //WriteToDebugLog("Appointment changing..."); var appList = e.Objects.Cast().ToList(); @@ -953,7 +953,7 @@ namespace BeWo.Scheduler.View private void NewSchedulerStorage_AppointmentDeleting(object sender, PersistentObjectCancelEventArgs e) { - WriteToDebugLog("Appointment deleting"); + //WriteToDebugLog("Appointment deleting"); if (e.Object is Appointment app && app.Type != AppointmentType.ChangedOccurrence) { @@ -982,7 +982,7 @@ namespace BeWo.Scheduler.View private void NewSchedulerStorage_AppointmentsInserted(object sender, PersistentObjectsEventArgs e) { - WriteToDebugLog("Appointments inserted"); + //WriteToDebugLog("Appointments inserted"); var appList = e.Objects.Cast().ToList(); @@ -1011,7 +1011,7 @@ namespace BeWo.Scheduler.View var form = ViewModel.GetEditAppointmentForm(control, e.Appointment); if (form == null) { - WriteToDebugLog("Appointment edit form is null!"); + //WriteToDebugLog("Appointment edit form is null!"); if(_IsNew) { @@ -1070,7 +1070,7 @@ namespace BeWo.Scheduler.View private bool _IsNew; private void Scheduler_InitNewAppointment(object sender, AppointmentEventArgs e) { - WriteToDebugLog("Initiating new appointment"); + //WriteToDebugLog("Initiating new appointment"); _IsNew = true; ViewModel.InitNewAppointment(e.Appointment); @@ -1145,7 +1145,7 @@ namespace BeWo.Scheduler.View private void AllowAppointmentCreateEvent(object sender, AppointmentOperationEventArgs e) { - WriteToDebugLog("Allowing appointment create event"); + //WriteToDebugLog("Allowing appointment create event"); var darfAnlegen = BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderKliententermineAnlegen) || BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderMitarbeitertermineAnlegen); @@ -1505,20 +1505,20 @@ namespace BeWo.Scheduler.View private void UpdateVM(bool shouldForceUpdate = false) { - WriteToDebugLog(new StackTrace().GetFrame(1).GetMethod().Name); + //WriteToDebugLog(new StackTrace().GetFrame(1).GetMethod().Name); if (_UpdatingViewModel) { - WriteToDebugLog("Already updating. Aborting second try."); + //WriteToDebugLog("Already updating. Aborting second try."); return; } _UpdatingViewModel = true; - WriteToDebugLog("Beginning"); + //WriteToDebugLog("Beginning"); if (ViewModel == null) { - WriteToDebugLog("Aborting"); + //WriteToDebugLog("Aborting"); _UpdatingViewModel = false; return; } @@ -1542,7 +1542,7 @@ namespace BeWo.Scheduler.View if(!shouldForceUpdate && newFetchingInterval.Equals(_LastFetchedInterval)) { _UpdatingViewModel = false; - WriteToDebugLog("Aborting. Redundant call."); + //WriteToDebugLog("Aborting. Redundant call."); return; } @@ -1612,7 +1612,7 @@ namespace BeWo.Scheduler.View _UpdatingViewModel = false; - WriteToDebugLog("Done"); + //WriteToDebugLog("Done"); }); }); }); @@ -1877,7 +1877,7 @@ namespace BeWo.Scheduler.View private void DateNavigator_OnSelectedDatesChanged(object sender, EventArgs e) { - WriteToDebugLog("Selected dates changed"); + //WriteToDebugLog("Selected dates changed"); _CurrentViewType = Scheduler.ActiveViewType; diff --git a/BeWo/SchulbegleitenderDienst/VertretungsMainView.xaml.cs b/BeWo/SchulbegleitenderDienst/VertretungsMainView.xaml.cs index 450932877..4520229e4 100644 --- a/BeWo/SchulbegleitenderDienst/VertretungsMainView.xaml.cs +++ b/BeWo/SchulbegleitenderDienst/VertretungsMainView.xaml.cs @@ -1038,8 +1038,8 @@ namespace BeWo.SchulbegleitenderDienst { var updatedCustomer = new CompactCustomerDC(); - ServiceFacade.DoCustomerServiceSync( - s => updatedCustomer = s.GetCompactCustomerDC(selectedCustomer.CustomerOid)); + ServiceFacade.DoCustomerServiceSync(s => updatedCustomer = s.GetCompactCustomerDC(selectedCustomer.CustomerOid)); + selectedCustomer = new CompactCustomerDC(); selectedCustomer = updatedCustomer; // UpdateControls(); diff --git a/BeWo/View/Detail/Accounting/EquityInvoiceView.xaml.cs b/BeWo/View/Detail/Accounting/EquityInvoiceView.xaml.cs index 98ba858e5..c53ccc168 100644 --- a/BeWo/View/Detail/Accounting/EquityInvoiceView.xaml.cs +++ b/BeWo/View/Detail/Accounting/EquityInvoiceView.xaml.cs @@ -122,7 +122,7 @@ namespace BeWo.View.Detail.Accounting delegate { this._EditView.ViewModel = this.ViewModel.NewVM; - this.MainControl.ShowControlAsModalPopUp(this._EditView); + this.MainControl.ShowControlAsModalPopup(this._EditView); }); }); } @@ -141,7 +141,7 @@ namespace BeWo.View.Detail.Accounting { var vm = BeWoWpfUtils.GetTag(sender); this._EditView.ViewModel = vm; - this.MainControl.ShowControlAsModalPopUp(this._EditView); + this.MainControl.ShowControlAsModalPopup(this._EditView); } private void popupedit_CostBeaerer_PopUpClick(object sender, RoutedEventArgs ev) diff --git a/BeWo/View/Detail/Accounting/GeneralInvoiceView.xaml.cs b/BeWo/View/Detail/Accounting/GeneralInvoiceView.xaml.cs index 55ce46c3a..fd83e630a 100644 --- a/BeWo/View/Detail/Accounting/GeneralInvoiceView.xaml.cs +++ b/BeWo/View/Detail/Accounting/GeneralInvoiceView.xaml.cs @@ -100,7 +100,7 @@ namespace BeWo.View.Detail.Accounting delegate { _EditView.ViewModel = ViewModel.NewVM; - MainControl.ShowControlAsModalPopUp(_EditView); + MainControl.ShowControlAsModalPopup(_EditView); }); } @@ -117,7 +117,7 @@ namespace BeWo.View.Detail.Accounting private void btnEdit_Click(object sender, RoutedEventArgs e) { _EditView.ViewModel = BeWoWpfUtils.GetTag(sender); - MainControl.ShowControlAsModalPopUp(_EditView); + MainControl.ShowControlAsModalPopup(_EditView); } private void button_add_Click(object sender, RoutedEventArgs e) diff --git a/BeWo/View/Detail/Accounting/InvoiceOverview.xaml.cs b/BeWo/View/Detail/Accounting/InvoiceOverview.xaml.cs index ac9be7a43..45a83c143 100644 --- a/BeWo/View/Detail/Accounting/InvoiceOverview.xaml.cs +++ b/BeWo/View/Detail/Accounting/InvoiceOverview.xaml.cs @@ -190,12 +190,12 @@ namespace BeWo.View.Detail.Accounting { case InvoiceType.CustomerEquity: this._EquityInvoiceItemEditView.ViewModel = vm; - this.MainControl.ShowControlAsModalPopUp(this._EquityInvoiceItemEditView); + this.MainControl.ShowControlAsModalPopup(this._EquityInvoiceItemEditView); break; case InvoiceType.General: this._GeneralInvoiceItemEditView.ViewModel = vm; - this.MainControl.ShowControlAsModalPopUp(this._GeneralInvoiceItemEditView); + this.MainControl.ShowControlAsModalPopup(this._GeneralInvoiceItemEditView); break; case InvoiceType.Settlement: @@ -207,12 +207,12 @@ namespace BeWo.View.Detail.Accounting if (cb.InvoiceItems == null || cb.InvoiceItems.Count == 0 || cb.DifferentHourlyRateCount > 0) { this._SettlementInvoiceItemEditView.ViewModel = new SettlementVM(cb); - this.MainControl.ShowControlAsModalPopUp(this._SettlementInvoiceItemEditView); + this.MainControl.ShowControlAsModalPopup(this._SettlementInvoiceItemEditView); } else { this._SettlementInvoiceItemEditView2.ViewModel = new SettlementVM(cb); - this.MainControl.ShowControlAsModalPopUp(this._SettlementInvoiceItemEditView2); + this.MainControl.ShowControlAsModalPopup(this._SettlementInvoiceItemEditView2); } })); break; @@ -224,7 +224,7 @@ namespace BeWo.View.Detail.Accounting delegate { this._ServiceInvoiceItemEditView.ViewModel = new ServiceInvoiceVM(cb); - this.MainControl.ShowControlAsModalPopUp(this._ServiceInvoiceItemEditView); + this.MainControl.ShowControlAsModalPopup(this._ServiceInvoiceItemEditView); })); break; } diff --git a/BeWo/View/Detail/Accounting/ServiceInvoiceView.xaml.cs b/BeWo/View/Detail/Accounting/ServiceInvoiceView.xaml.cs index d6c5bea5c..fe4e06cda 100644 --- a/BeWo/View/Detail/Accounting/ServiceInvoiceView.xaml.cs +++ b/BeWo/View/Detail/Accounting/ServiceInvoiceView.xaml.cs @@ -228,7 +228,7 @@ namespace BeWo.View.Detail.Accounting private void btnEdit_Click(object sender, RoutedEventArgs e) { this._EditView.ViewModel = BeWoWpfUtils.GetTag(sender); - this.MainControl.ShowControlAsModalPopUp(this._EditView); + this.MainControl.ShowControlAsModalPopup(this._EditView); } private void button_createInvoice_Click(object sender, RoutedEventArgs e) @@ -239,7 +239,7 @@ namespace BeWo.View.Detail.Accounting r => this.Dispatch(() => { this._CreatePopUpView.ServiceInvoiceDcs = r; - this.MainControl.ShowControlAsModalPopUp(this._CreatePopUpView); + this.MainControl.ShowControlAsModalPopup(this._CreatePopUpView); })); } diff --git a/BeWo/View/Detail/Accounting/SettlementInvoiceView.xaml.cs b/BeWo/View/Detail/Accounting/SettlementInvoiceView.xaml.cs index d93837bc4..0ff7cd364 100644 --- a/BeWo/View/Detail/Accounting/SettlementInvoiceView.xaml.cs +++ b/BeWo/View/Detail/Accounting/SettlementInvoiceView.xaml.cs @@ -117,12 +117,12 @@ namespace BeWo.View.Detail.Accounting if (ShowOldEditView(vm)) { this._EditView.ViewModel = vm; - this.MainControl.ShowControlAsModalPopUp(this._EditView); + this.MainControl.ShowControlAsModalPopup(this._EditView); } else { this._EditView2.ViewModel = vm; - this.MainControl.ShowControlAsModalPopUp(this._EditView2); + this.MainControl.ShowControlAsModalPopup(this._EditView2); } } } @@ -141,12 +141,12 @@ namespace BeWo.View.Detail.Accounting if (ShowOldEditView(vm)) { this._EditView.ViewModel = new SettlementVM(dc); - this.MainControl.ShowControlAsModalPopUp(this._EditView); + this.MainControl.ShowControlAsModalPopup(this._EditView); } else { this._EditView2.ViewModel = new SettlementVM(dc); - this.MainControl.ShowControlAsModalPopUp(this._EditView2); + this.MainControl.ShowControlAsModalPopup(this._EditView2); } }); }); diff --git a/BeWo/View/Detail/AdditionalServiceView.xaml.cs b/BeWo/View/Detail/AdditionalServiceView.xaml.cs index 7bdd8f8c4..92483db9e 100644 --- a/BeWo/View/Detail/AdditionalServiceView.xaml.cs +++ b/BeWo/View/Detail/AdditionalServiceView.xaml.cs @@ -1342,7 +1342,7 @@ namespace BeWo.View.Detail }; _AdditionalServiceGroupOfPeoplePopUp.GroupOfPeopleSavedOrUpdated += AdditionalServiceGroupOfPeoplePopUp_AdditionalServiceGroupOfPeopleSavedOrUpdated; - BeWoApp.MainControl.ShowControlAsModalPopUp(_AdditionalServiceGroupOfPeoplePopUp); + BeWoApp.MainControl.ShowControlAsModalPopup(_AdditionalServiceGroupOfPeoplePopUp); _AdditionalServiceGroupOfPeoplePopUp.Focus(); }) ); diff --git a/BeWo/View/Detail/AssessmentSheetEntryView.xaml.cs b/BeWo/View/Detail/AssessmentSheetEntryView.xaml.cs index 0b6c9f7ef..d3bda381c 100644 --- a/BeWo/View/Detail/AssessmentSheetEntryView.xaml.cs +++ b/BeWo/View/Detail/AssessmentSheetEntryView.xaml.cs @@ -148,7 +148,7 @@ namespace BeWo.View.Detail var list = this._ViewModel.ServiceRecords.Where(i => i.Date.Value.Day.Equals(day)).ToList(); ServiceRecordPopUp popUp = new ServiceRecordPopUp(list); - BeWoApp.MainControl.ShowControlAsModalPopUp(popUp); + BeWoApp.MainControl.ShowControlAsModalPopup(popUp); } } } diff --git a/BeWo/View/Detail/CustomerView.xaml.cs b/BeWo/View/Detail/CustomerView.xaml.cs index 55fb64727..6627bbae8 100644 --- a/BeWo/View/Detail/CustomerView.xaml.cs +++ b/BeWo/View/Detail/CustomerView.xaml.cs @@ -731,7 +731,7 @@ namespace BeWo.View.Detail (c.View as TableView).FocusedColumn = c.Columns[1]; // var t = c.View.GetCellElementByRowHandleAndColumn(GridControl.AutoFilterRowHandle, c.Columns[1]); - MainControl.ShowControlAsModalPopUp(gb, HorizontalAlignment.Center, VerticalAlignment.Top); + MainControl.ShowControlAsModalPopup(gb, HorizontalAlignment.Center, VerticalAlignment.Top); } private void button_addDisability_Click(object sender, RoutedEventArgs e) diff --git a/BeWo/View/Detail/EnvironmentRoleView.xaml b/BeWo/View/Detail/EnvironmentRoleView.xaml index 2bdcc0357..e27dc3f03 100644 --- a/BeWo/View/Detail/EnvironmentRoleView.xaml +++ b/BeWo/View/Detail/EnvironmentRoleView.xaml @@ -1,7 +1,5 @@ - - - + @@ -10,12 +8,8 @@ - - - + - - - + \ No newline at end of file diff --git a/BeWo/View/Detail/EnvironmentRoleView.xaml.cs b/BeWo/View/Detail/EnvironmentRoleView.xaml.cs index 98fddc953..18f160ac5 100644 --- a/BeWo/View/Detail/EnvironmentRoleView.xaml.cs +++ b/BeWo/View/Detail/EnvironmentRoleView.xaml.cs @@ -1,145 +1,125 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Windows; - -using BeWo.Core; -using BeWo.Core.Service; -using BeWo.ServiceProxy; -using BeWo.ViewModel; +using System.Windows; using BeWo.ViewModel.ListViewModel; - -using BS.Shared; -using BS.Shared.Extensions; using System.Windows.Controls; namespace BeWo.View.Detail { - /// - /// Interaction logic for EmploymentTypeView.xaml - /// - public partial class EnvironmentRoleView : BeWoView + public partial class EnvironmentRoleView { - private ValueListView personView = null; - private ValueListView organisationView = null; - private ValueListView roleInOrganisation = null; - private ValueListView roleInFamily = null; - - //private ValueListView nationality = null; - //private ValueListView aufenthaltsstatus = null; - //private ValueListView migrationshintergrund = null; + private readonly ValueListView _PersonView; + private readonly ValueListView _OrganisationView; + private readonly ValueListView _RoleInOrganisation; + private readonly ValueListView _RoleInFamily; public EnvironmentRoleView(ValueListEntryListVM pViewModelPerson, ValueListEntryListVM pViewModelOrganisation, ValueListEntryListVM pViewModelRoleInOrganisation, ValueListEntryListVM pViewModelRoleInFamily) { - this.InitializeComponent(); - - roleInFamily = new ValueListView(pViewModelRoleInFamily); - personView = new ValueListView(pViewModelPerson); - organisationView = new ValueListView(pViewModelOrganisation); - roleInOrganisation = new ValueListView(pViewModelRoleInOrganisation); - - - - roleInFamily.SetValue(Grid.RowProperty, 0); - personView.SetValue(Grid.RowProperty, 1); - organisationView.SetValue(Grid.RowProperty, 2); - roleInOrganisation.SetValue(Grid.RowProperty, 3); - + InitializeComponent(); + _RoleInFamily = new ValueListView(pViewModelRoleInFamily); + _PersonView = new ValueListView(pViewModelPerson); + _OrganisationView = new ValueListView(pViewModelOrganisation); + _RoleInOrganisation = new ValueListView(pViewModelRoleInOrganisation); - personView.Margin = new Thickness(0, 10, 0, 0); - organisationView.Margin = new Thickness(0, 10, 0, 0); - roleInOrganisation.Margin = new Thickness(0, 10, 0, 0); - - - rootGrid.Children.Add(roleInFamily); - rootGrid.Children.Add(personView); - rootGrid.Children.Add(organisationView); - rootGrid.Children.Add(roleInOrganisation); + _RoleInFamily.SetValue(Grid.RowProperty, 0); + _PersonView.SetValue(Grid.RowProperty, 1); + _OrganisationView.SetValue(Grid.RowProperty, 2); + _RoleInOrganisation.SetValue(Grid.RowProperty, 3); + _PersonView.Margin = new Thickness(0, 10, 0, 0); + _OrganisationView.Margin = new Thickness(0, 10, 0, 0); + _RoleInOrganisation.Margin = new Thickness(0, 10, 0, 0); + rootGrid.Children.Add(_RoleInFamily); + rootGrid.Children.Add(_PersonView); + rootGrid.Children.Add(_OrganisationView); + rootGrid.Children.Add(_RoleInOrganisation); } - //Für Funktionen public EnvironmentRoleView(ValueListEntryListVM personFunktionList, ValueListEntryListVM orgFunktionList) { - this.InitializeComponent(); + InitializeComponent(); - personView = new ValueListView(personFunktionList); - organisationView = new ValueListView(orgFunktionList); + _PersonView = new ValueListView(personFunktionList); + _OrganisationView = new ValueListView(orgFunktionList); - personView.SetValue(Grid.RowProperty, 0); - organisationView.SetValue(Grid.RowProperty, 1); + _PersonView.SetValue(Grid.RowProperty, 0); + _OrganisationView.SetValue(Grid.RowProperty, 1); - organisationView.Margin = new Thickness(0, 10, 0, 0); + _OrganisationView.Margin = new Thickness(0, 10, 0, 0); - rootGrid.Children.Add(personView); - rootGrid.Children.Add(organisationView); + rootGrid.Children.Add(_PersonView); + rootGrid.Children.Add(_OrganisationView); } public override bool IsDirty { get { - bool dirty = false; + var dirty = false; - if (personView != null) - dirty = this.personView.IsDirty; + if (_PersonView != null) + { + dirty = _PersonView.IsDirty; + } - if (!dirty && organisationView != null) - dirty = this.organisationView.IsDirty; + if (!dirty && _OrganisationView != null) + { + dirty = _OrganisationView.IsDirty; + } - if (!dirty && roleInOrganisation != null) - dirty = this.roleInOrganisation.IsDirty; + if (!dirty && _RoleInOrganisation != null) + { + dirty = _RoleInOrganisation.IsDirty; + } - if (!dirty && roleInFamily != null) - dirty = roleInFamily.IsDirty; - + if (!dirty && _RoleInFamily != null) + { + dirty = _RoleInFamily.IsDirty; + } return dirty; } } - public override string Title - { - get - { - return null; - } - } + public override string Title => null; protected override void Save() { - bool valid = true; - if (personView != null){ - if (this.personView.IsDirty) - valid = this.personView.SaveData(); + var valid = true; + + if (_PersonView != null){ + if (_PersonView.IsDirty) + { + valid = _PersonView.SaveData(); + } } - if (organisationView != null) + if(_OrganisationView != null) { - if (valid && this.organisationView.IsDirty) - this.organisationView.SaveData(); + if(valid && _OrganisationView.IsDirty) + { + _OrganisationView.SaveData(); + } } - if (roleInOrganisation != null) + if(_RoleInOrganisation != null) { - if (valid && roleInOrganisation.IsDirty) - this.roleInOrganisation.SaveData(); + if(valid && _RoleInOrganisation.IsDirty) + { + _RoleInOrganisation.SaveData(); + } } - if (roleInFamily != null) + if(_RoleInFamily != null) { - if (valid && roleInFamily.IsDirty) - roleInFamily.SaveData(); + if(valid && _RoleInFamily.IsDirty) + { + _RoleInFamily.SaveData(); + } } } - internal override DependencyObject ValidationOnSaveRootElement - { - get { return this.borderTemp; } - } - + internal override DependencyObject ValidationOnSaveRootElement => BorderTemp; } } \ No newline at end of file diff --git a/BeWo/View/Detail/InvoiceView.xaml.cs b/BeWo/View/Detail/InvoiceView.xaml.cs index 711afe8fb..d2a978385 100644 --- a/BeWo/View/Detail/InvoiceView.xaml.cs +++ b/BeWo/View/Detail/InvoiceView.xaml.cs @@ -90,7 +90,7 @@ namespace BeWo.View.Detail private void CloseEditPopUp() { this.pu_edit.IsOpen = false; - this.MainControl.ChangePopUpOpacityMode(false); + this.MainControl.ChangePopupOpacityMode(false); } private void ReloadViewModel() @@ -117,7 +117,7 @@ namespace BeWo.View.Detail { this.ViewModel.EditVM = BeWoWpfUtils.GetTag(sender); this.pu_edit.IsOpen = true; - this.MainControl.ChangePopUpOpacityMode(true); + this.MainControl.ChangePopupOpacityMode(true); } private void button_add_Click(object sender, RoutedEventArgs e) diff --git a/BeWo/View/Detail/MailMergeWindow.xaml.cs b/BeWo/View/Detail/MailMergeWindow.xaml.cs index 4ec9d6932..c5e5cbdab 100644 --- a/BeWo/View/Detail/MailMergeWindow.xaml.cs +++ b/BeWo/View/Detail/MailMergeWindow.xaml.cs @@ -113,7 +113,7 @@ namespace BeWo.View.Detail Owner = parentView == null ? BeWoApp.CurrentBeWo.MainWindow : GetWindow(parentView); - if (BeWoApp.MainControl.ModalPopUpBackGround == null) + if (BeWoApp.MainControl.ModalPopupBackGround == null) BeWoApp.MainControl.ShowModalBackground(); DataContext = this; diff --git a/BeWo/View/Detail/ModalViewWindow.xaml.cs b/BeWo/View/Detail/ModalViewWindow.xaml.cs index d3bcbf757..c946cb48f 100644 --- a/BeWo/View/Detail/ModalViewWindow.xaml.cs +++ b/BeWo/View/Detail/ModalViewWindow.xaml.cs @@ -1,37 +1,39 @@ -using System.Linq; +using System; +using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using BeWo.Controls; using BeWo.Core; -using Microsoft.Office.Interop.Word; using Style = System.Windows.Style; namespace BeWo.View.Detail { public partial class ModalViewWindow { - private bool savedOrUpdated; + private bool _SavedOrUpdated; - private bool allowSaveIfParentDirty; + private readonly bool _AllowSaveIfParentDirty; public BeWoView DetailView { get; set; } public BeWoView ParentView { get; set; } - public Grid RootGrid { get { return rootGrid; } } + public Grid RootGrid => rootGrid; public ModalViewWindow(BeWoView detailView, BeWoView parentView, bool allowSaveIfParentDirty) { InitializeComponent(); DetailView = detailView; ParentView = parentView; - this.allowSaveIfParentDirty = allowSaveIfParentDirty; + _AllowSaveIfParentDirty = allowSaveIfParentDirty; rootGrid.Children.Add(DetailView); InitCommandBindings(); - if (BeWoApp.MainControl.ModalPopUpBackGround == null) + if (BeWoApp.MainControl.ModalPopupBackGround == null) + { BeWoApp.MainControl.ShowModalBackground(); + } MinWidth = detailView.MinWidth + 16; MinHeight = 555; @@ -42,24 +44,31 @@ namespace BeWo.View.Detail Closing += delegate { - if(BeWoApp.MainControl.OpenedModalViewWindows.First().Equals(this)) + if(BeWoApp.MainControl.OpenedModalViewWindows.Count > 0 && BeWoApp.MainControl.OpenedModalViewWindows.First().Equals(this)) + { BeWoApp.MainControl.CloseCurrentPopUp(); + } }; - ((GroupBox) (((ShadowChrome) ((Grid) detailView.Content).Children[0]).Child)).Style = BeWoApp.CurrentBeWo.Resources["MainContentGroupBoxWithoutMaximizeBtnStyle"] as Style; + Closed += delegate + { + BeWoUtils.RemoveModalViewWindow(); + }; + + ((GroupBox) ((ShadowChrome) ((Grid) detailView.Content).Children[0]).Child).Style = BeWoApp.CurrentBeWo.Resources["MainContentGroupBoxWithoutMaximizeBtnStyle"] as Style; } private void OnLoad(object sender, RoutedEventArgs e) { if (BeWoApp.MainControl.OpenedModalViewWindows.Count > 1) { - Left = (BeWoApp.MainControl.ActualWidth/2) - (ActualWidth/2) + 10*(BeWoApp.MainControl.OpenedModalViewWindows.Count - 1); - Top = (BeWoApp.MainControl.ActualHeight/2) - (ActualHeight/2) + 50*(BeWoApp.MainControl.OpenedModalViewWindows.Count - 1); + Left = BeWoApp.MainControl.ActualWidth/2 - ActualWidth/2 + 10*(BeWoApp.MainControl.OpenedModalViewWindows.Count - 1); + Top = BeWoApp.MainControl.ActualHeight/2 - ActualHeight/2 + 50*(BeWoApp.MainControl.OpenedModalViewWindows.Count - 1); } else { - Left = (BeWoApp.MainControl.ActualWidth / 2) - (ActualWidth / 2); - Top = (BeWoApp.MainControl.ActualHeight / 2) - (ActualHeight / 2); + Left = BeWoApp.MainControl.ActualWidth / 2 - ActualWidth / 2; + Top = BeWoApp.MainControl.ActualHeight / 2 - ActualHeight / 2; } } @@ -67,9 +76,9 @@ namespace BeWo.View.Detail { base.OnClosing(e); - if (!e.Cancel && Owner != null) + if (!e.Cancel) { - Owner.Focus(); + Owner?.Focus(); } } @@ -81,18 +90,22 @@ namespace BeWo.View.Detail (s, e) => { if (ParentView != null) - if (!allowSaveIfParentDirty && ParentView.IsDirty) + { + if (!_AllowSaveIfParentDirty && ParentView.IsDirty) { MessageBox.Show("Bevor Sie an diesem Objekt eine Änderung durchführen können, müssen Sie das vorherige Objekt erst speichern!", "Speichern", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } + } if (!DetailView.SaveData()) + { return; + } - savedOrUpdated = true; + _SavedOrUpdated = true; - DialogResult = savedOrUpdated; + //DialogResult = _SavedOrUpdated; Close(); }, @@ -110,17 +123,21 @@ namespace BeWo.View.Detail (s, e) => { if(ParentView != null) + { if (ParentView.IsDirty) { - DialogResult = false; + //DialogResult = false; Close(); return; } + } - if (!DoSaveCheck()) + if (!DoSaveCheck()) + { return; + } - DialogResult = savedOrUpdated; + //DialogResult = _SavedOrUpdated; Close(); @@ -134,16 +151,16 @@ namespace BeWo.View.Detail private void ModalViewWindow_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) { - if (WindowState == WindowState.Maximized) - { - WindowState = WindowState.Normal; - return; - } + //if (WindowState == WindowState.Maximized) + //{ + // WindowState = WindowState.Normal; + // return; + //} - if (WindowState == WindowState.Normal) - { - WindowState = WindowState.Maximized; - } + //if (WindowState == WindowState.Normal) + //{ + // WindowState = WindowState.Maximized; + //} } } } diff --git a/BeWo/View/Detail/ServiceRecordView2.xaml b/BeWo/View/Detail/ServiceRecordView2.xaml index 2217308ac..1ac323254 100644 --- a/BeWo/View/Detail/ServiceRecordView2.xaml +++ b/BeWo/View/Detail/ServiceRecordView2.xaml @@ -791,10 +791,6 @@ - - - - @@ -805,390 +801,372 @@ - + - - - - - - + - - - - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - + + + + - - - + + - - - - - - - - - - - + + + + + + + + + + + - - - - - + + + + + - - + + - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - + + + - - - + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - + + + + + - - - + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - + + + - - - + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - + + + + + - - - + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - + + + - - - + + + - - - - - - - - - - - + + + + + + + + + + + diff --git a/BeWo/View/Detail/ServiceRecordView2.xaml.cs b/BeWo/View/Detail/ServiceRecordView2.xaml.cs index f626ce0b5..fcbe0d6c7 100644 --- a/BeWo/View/Detail/ServiceRecordView2.xaml.cs +++ b/BeWo/View/Detail/ServiceRecordView2.xaml.cs @@ -1,14 +1,13 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; -using System.Windows.Data; -using System.Windows.Forms.Integration; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; @@ -18,10 +17,8 @@ using System.Windows.Threading; using BeWo.Controls; using BeWo.Core; using BeWo.Core.Service; -using BeWo.MultiLanguage; using BeWo.ServiceProxy; using BeWo.Validation; -using BeWo.View.Controls; using BeWo.View.Search; using BeWo.ViewModel; using BeWo.ViewModel.ListViewModel; @@ -33,13 +30,14 @@ using BS.Shared.DataContracts.Compact; using BS.Shared.Extensions; using BS.Shared.Services; using BS.Shared.Translation; + using DevExpress.Xpf.Bars; using DevExpress.Xpf.Core; using DevExpress.Xpf.Docking; using DevExpress.Xpf.Docking.Platform; using DevExpress.Xpf.Editors; using DevExpress.Xpf.RichEdit; -using DevExpress.XtraRichEdit; + using Microsoft.Win32; using VerticalAlignment = System.Windows.VerticalAlignment; @@ -58,7 +56,7 @@ namespace BeWo.View.Detail } } - private TextBox grosseDokuTextBox; + private TextBox _GrosseDokuTextBox; public List AlleWohnheime { get; private set; } @@ -72,15 +70,15 @@ namespace BeWo.View.Detail private ServiceRecordListVM _ViewModel; - private AssessmentSheetEntryView assessmentSheet; + private readonly AssessmentSheetEntryView _AssessmentSheet; - private ServiceRecordVM lastSelectedVM; + private ServiceRecordVM _LastSelectedVM; - private readonly Dictionary> customerContainsAssessmentCategories = new Dictionary>(); + private readonly Dictionary> _CustomerContainsAssessmentCategories = new Dictionary>(); private bool _IgnoreGroupMultiCheck; - private int lastPosition; + private int _LastPosition; public static double DocumentationTextBoxFontSize => BeWoApp.AppSettings.DocumentationFontSize; @@ -137,8 +135,7 @@ namespace BeWo.View.Detail chkWithClient.Content = Translator.Translate("Zeiterfassung für ausgewählten Klienten"); txtTimeRecording.Text = Translator.Translate("Zeiterfassung"); } - numerictb_distance.Visibility = - BeWoApp.AppSettings.ShowDistanceFields ? Visibility.Visible : Visibility.Collapsed; + numerictb_distance.Visibility = BeWoApp.AppSettings.ShowDistanceFields ? Visibility.Visible : Visibility.Collapsed; lblDistance.Visibility = BeWoApp.AppSettings.ShowDistanceFields ? Visibility.Visible : Visibility.Collapsed; DistanceGridColumn.Visible = BeWoApp.AppSettings.ShowDistanceFields; @@ -171,14 +168,14 @@ namespace BeWo.View.Detail Loaded += ServiceRecordView2_Loaded; - supportConceptSelectionControl.ControlInitialized += supportConceptSelectionControl_ControlInitialized; + supportConceptSelectionControl.ControlInitialized += SupportConceptSelectionControl_ControlInitialized; if (BeWoApp.LoggedOnUser.HasRight(UserRightType.AssessmentSheet_View)) { - assessmentSheet = new AssessmentSheetEntryView(); + _AssessmentSheet = new AssessmentSheetEntryView(); punktebogenRootGrid.Children.Clear(); - punktebogenRootGrid.Children.Add(assessmentSheet); - assessmentSheet.Visibility = Visibility.Collapsed; + punktebogenRootGrid.Children.Add(_AssessmentSheet); + _AssessmentSheet.Visibility = Visibility.Collapsed; } else { @@ -322,7 +319,7 @@ namespace BeWo.View.Detail } - private void SetRTFFontSizeFromApp() + private static void SetRTFFontSizeFromApp() { //var size = BeWoApp.AppSettings.DocumentationFontSize; //if (size > 0) @@ -796,7 +793,7 @@ namespace BeWo.View.Detail } } - private void supportConceptSelectionControl_ControlInitialized(object sender, EventArgs e) + private void SupportConceptSelectionControl_ControlInitialized(object sender, EventArgs e) { InitCustomerSelectedItem(); multiSupportConceptControl.SupportConceptList = supportConceptSelectionControl.SupportConceptList; @@ -962,9 +959,9 @@ namespace BeWo.View.Detail { if (serviceRecordVm.Id == vm.Id) { - if (ViewModel.VMList.Count > 0 && lastPosition > 0) + if (ViewModel.VMList.Count > 0 && _LastPosition > 0) { - var a = ViewModel.VMList[lastPosition - 1]; + var a = ViewModel.VMList[_LastPosition - 1]; existingVm = a; } @@ -1171,7 +1168,7 @@ namespace BeWo.View.Detail } ViewModel.BuildServiceRecordsForSelectedTreeNode(true, RefreshFinished); - lastSelectedVM = vm; + _LastSelectedVM = vm; })); } @@ -1200,7 +1197,7 @@ namespace BeWo.View.Detail private void RefreshFinished() { - SetSelectedServiceRecordVM(lastSelectedVM, false); + SetSelectedServiceRecordVM(_LastSelectedVM, false); } private void ShowHistory(ServiceRecordVM vm) @@ -1822,7 +1819,14 @@ namespace BeWo.View.Detail private void ServiceRecordView2_Loaded(object sender, RoutedEventArgs e) { - ReloadViewModel(); + if(!AutoLockUI.HasJustBeenUnlocked) + { + ReloadViewModel(); + } + else + { + AutoLockUI.HasJustBeenUnlocked = false; + } if (ActualHeight > 0) { @@ -1924,7 +1928,6 @@ namespace BeWo.View.Detail }); } - private void ViewModel_ServiceRecordListChanged(object sender, EventArgs e) { var list = _ViewModel.ServiceRecordsForSelectedCustomer.OrderByDescending(srVM => srVM.DateAndTime) @@ -1978,8 +1981,8 @@ namespace BeWo.View.Detail srGridControl.ItemsSource = list; //this.serviceRecordScheduler.ServiceRecordList = list; - if (assessmentSheet != null) - assessmentSheet.ServiceRecords = list; + if (_AssessmentSheet != null) + _AssessmentSheet.ServiceRecords = list; } private void BtnDelete_Click(object sender, RoutedEventArgs e) @@ -2376,8 +2379,7 @@ namespace BeWo.View.Detail // btnSaveWohnheimbuchung.Visibility = Visibility.Collapsed; //} - private void SupportConceptSelectionControl_ItemSelected(object sender, - EventArgs e) + private void SupportConceptSelectionControl_ItemSelected(object sender, EventArgs e) { if (chkGroupBooking.IsChecked.Value || chkMultiBooking.IsChecked.Value) { @@ -2543,7 +2545,7 @@ namespace BeWo.View.Detail private void UpdateAssessmentSheet(FlatSupportConceptTreeNodeDC selectedNode) { - if (assessmentSheet == null) + if (_AssessmentSheet == null) return; if (selectedNode != null && selectedNode.SupportConceptTreeNodeDC != null) @@ -2551,7 +2553,7 @@ namespace BeWo.View.Detail var customer = selectedNode.SupportConceptTreeNodeDC.Customer; if (customer != null) { - if (!customerContainsAssessmentCategories.ContainsKey(customer)) + if (!_CustomerContainsAssessmentCategories.ContainsKey(customer)) { ServiceFacade.DoCustomerServiceAsync( s1 => s1.LoadCustomerAssessmentSheetCategoryList(customer.Oid.Value), @@ -2559,14 +2561,14 @@ namespace BeWo.View.Detail cb => this.Dispatch( delegate { - customerContainsAssessmentCategories.Add(customer, cb); + _CustomerContainsAssessmentCategories.Add(customer, cb); UpdateAssessmentSheet(selectedNode.SupportConceptTreeNodeDC.Customer, cb); }), false); } else { - var cats = customerContainsAssessmentCategories[customer]; + var cats = _CustomerContainsAssessmentCategories[customer]; UpdateAssessmentSheet(selectedNode.SupportConceptTreeNodeDC.Customer, cats); } } @@ -2594,7 +2596,7 @@ namespace BeWo.View.Detail dockLayoutManager.SetValue(ThemeManager.ThemeNameProperty, "LightGray"); dockLayoutManager.Background = Brushes.Transparent; dockLayoutManager.Visibility = Visibility.Hidden; - dockLayoutManager.ShowingDockHints += dockLayoutManager_ShowingDockHints; + dockLayoutManager.ShowingDockHints += DockLayoutManager_ShowingDockHints; var group = new LayoutGroup(); dockLayoutManager.LayoutRoot = group; @@ -2681,11 +2683,10 @@ namespace BeWo.View.Detail InitDockPanel(); - assessmentSheet.LayoutManager = dockLayoutManager; + _AssessmentSheet.LayoutManager = dockLayoutManager; } - static void dockLayoutManager_ShowingDockHints(object sender, - DevExpress.Xpf.Docking.Base.ShowingDockHintsEventArgs e) + private static void DockLayoutManager_ShowingDockHints(object sender, DevExpress.Xpf.Docking.Base.ShowingDockHintsEventArgs e) { e.DisableAll(); e.HideAll(); @@ -2694,8 +2695,8 @@ namespace BeWo.View.Detail private void HideAssessmentSheet() { - assessmentSheet.SetCustomer(null, null); - assessmentSheet.Visibility = Visibility.Collapsed; + _AssessmentSheet.SetCustomer(null, null); + _AssessmentSheet.Visibility = Visibility.Collapsed; customerDetailGrid.Visibility = Visibility.Visible; @@ -2725,12 +2726,12 @@ namespace BeWo.View.Detail if (dockLayoutManager == null) CreateLayoutManager(); - assessmentSheet.SetCustomer(customer, cats); + _AssessmentSheet.SetCustomer(customer, cats); - if (assessmentSheet.Visibility == Visibility.Visible) + if (_AssessmentSheet.Visibility == Visibility.Visible) return; - assessmentSheet.Visibility = Visibility.Visible; + _AssessmentSheet.Visibility = Visibility.Visible; customerDetailGrid.Visibility = Visibility.Collapsed; dockLayoutManager.Visibility = Visibility.Visible; @@ -2766,7 +2767,7 @@ namespace BeWo.View.Detail private void InitDockPanel() { - if (assessmentSheet == null) + if (_AssessmentSheet == null) { return; } @@ -2826,7 +2827,7 @@ namespace BeWo.View.Detail } else if (Equals(item, layoutPanel3)) { - assessmentSheet.Focus(); + _AssessmentSheet.Focus(); } } else @@ -3069,8 +3070,6 @@ namespace BeWo.View.Detail BeWoApp.SaveAppSettings(); } - - private void SrTableView_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) { //###Bars @@ -3083,7 +3082,7 @@ namespace BeWo.View.Detail StartEdit(vm); - lastPosition = ViewModel.VMList.IndexOf(vm); + _LastPosition = ViewModel.VMList.IndexOf(vm); } private ServiceRecordVM GetSelectedServiceRecordFromGrid() @@ -3110,7 +3109,7 @@ namespace BeWo.View.Detail { ServiceRecordVM vm = GetSelectedServiceRecordFromGrid(); - lastPosition = ViewModel.VMList.IndexOf(vm); + _LastPosition = ViewModel.VMList.IndexOf(vm); if (vm != null && vm.DeleteAllowed) Delete(vm); @@ -3160,13 +3159,12 @@ namespace BeWo.View.Detail })); _GroupOfPeopleModalPopUp.GroupOfPeopleSavedOrUpdated += GroupOfPeopleModalPopUp_GroupOfPeopleSavedOrUpdated; - BeWoApp.MainControl.ShowControlAsModalPopUp(_GroupOfPeopleModalPopUp); + BeWoApp.MainControl.ShowControlAsModalPopup(_GroupOfPeopleModalPopUp); _GroupOfPeopleModalPopUp.Focus(); })); } - private static void GroupOfPeopleModalPopUp_GroupOfPeopleSavedOrUpdated(object sender, - EventArgs e) + private static void GroupOfPeopleModalPopUp_GroupOfPeopleSavedOrUpdated(object sender, EventArgs e) { //ServiceFacade.DoCustomerServiceAsync( // s => s.LoadPersonCompact(e.Data.DataContract.PersonOid.Value), @@ -3254,19 +3252,14 @@ namespace BeWo.View.Detail private void Popupedit_employee_OnPreviewMouseDoubleClick(object sender, MouseButtonEventArgs e) { - if (!BeWoUtils.CheckPopupEditClickableSpace((PopUpEdit) sender, e) || - !BeWoApp.LoggedOnUser.HasRight(UserRightType.EmployeeView_View)) + if (!BeWoUtils.CheckPopupEditClickableSpace((PopUpEdit) sender, e) || !BeWoApp.LoggedOnUser.HasRight(UserRightType.EmployeeView_View)) { return; } var employeeCompact = ViewModel.SelectedEmployee ?? BeWoApp.LoggedOnUser.Employee; - VMFactory.CreateEmployeeVMAsync(employeeCompact.EmployeeOid, - cb => this.Dispatch( - () => BeWoUtils.OpenModalViewWindow(cb, this, () => - this.Dispatch( - () => BeWoUtils.UpdateAllViews(employeeCompact))))); + VMFactory.CreateEmployeeVMAsync(employeeCompact.EmployeeOid, cb => this.Dispatch(() => BeWoUtils.OpenModalViewWindow(cb, this, () => this.Dispatch(() => BeWoUtils.UpdateAllViews(employeeCompact))))); } private void ReloadButton_OnClick(object sender, RoutedEventArgs e) @@ -3316,13 +3309,13 @@ namespace BeWo.View.Detail documentationTextBox.CaretIndex = caretIndex + textToAdd.Length; } - if (grosseDokuTextBox == null) + if (_GrosseDokuTextBox == null) { documentationTextBox.Focus(); } else { - grosseDokuTextBox.Text = documentationTextBox.Text; + _GrosseDokuTextBox.Text = documentationTextBox.Text; } } } @@ -3889,52 +3882,52 @@ namespace BeWo.View.Detail if (TabItem1_Notice.IsSelected) { - grosseDokuTextBox = InitMaximizedDocumentationTextBox(dokumentationsTextBox); + _GrosseDokuTextBox = InitMaximizedDocumentationTextBox(dokumentationsTextBox); header = TabItem1_Notice.Header.ToString(); } else if (TabItem2_Notice.IsSelected) { - grosseDokuTextBox = InitMaximizedDocumentationTextBox(dokumentationsTextBox2); + _GrosseDokuTextBox = InitMaximizedDocumentationTextBox(dokumentationsTextBox2); header = TabItem2_Notice.Header.ToString(); } else if (TabItem3_Notice.IsSelected) { - grosseDokuTextBox = InitMaximizedDocumentationTextBox(dokumentationsTextBox3); + _GrosseDokuTextBox = InitMaximizedDocumentationTextBox(dokumentationsTextBox3); header = TabItem3_Notice.Header.ToString(); } else if (TabItem4_Notice.IsSelected) { - grosseDokuTextBox = InitMaximizedDocumentationTextBox(dokumentationsTextBox4); + _GrosseDokuTextBox = InitMaximizedDocumentationTextBox(dokumentationsTextBox4); header = TabItem4_Notice.Header.ToString(); } else if (TabItem5_Notice.IsSelected) { - grosseDokuTextBox = InitMaximizedDocumentationTextBox(dokumentationsTextBox5); + _GrosseDokuTextBox = InitMaximizedDocumentationTextBox(dokumentationsTextBox5); header = TabItem5_Notice.Header.ToString(); } schriftVergroessern.Click += delegate(object o, RoutedEventArgs args) { IncreaseFontSizeBtn_Click(o, args); - grosseDokuTextBox.FontSize = dokumentationsTextBox.FontSize; + _GrosseDokuTextBox.FontSize = dokumentationsTextBox.FontSize; }; schriftVerkleinern.Click += delegate(object o, RoutedEventArgs args) { DecreaseFontSizeBtn_Click(o, args); - grosseDokuTextBox.FontSize = dokumentationsTextBox.FontSize; + _GrosseDokuTextBox.FontSize = dokumentationsTextBox.FontSize; }; Grid.SetRow(stackPanel, 0); - Grid.SetRow(grosseDokuTextBox, 1); + Grid.SetRow(_GrosseDokuTextBox, 1); - grosseDokuTextBox.SpellCheck.IsEnabled = true; + _GrosseDokuTextBox.SpellCheck.IsEnabled = true; var rootGrid2 = new Grid(); rootGrid2.RowDefinitions.Add(new RowDefinition {Height = GridLength.Auto}); rootGrid2.RowDefinitions.Add(new RowDefinition {Height = new GridLength(1, GridUnitType.Star)}); rootGrid2.Children.Add(stackPanel); - rootGrid2.Children.Add(grosseDokuTextBox); + rootGrid2.Children.Add(_GrosseDokuTextBox); var neunzigProzentHoehe = MainControl.ActualHeight * .9; var neunzigProzentBreite = MainControl.ActualWidth * .9; @@ -3949,7 +3942,7 @@ namespace BeWo.View.Detail beWoWindow.Closed += delegate { - grosseDokuTextBox = null; + _GrosseDokuTextBox = null; }; beWoWindow.ShowDialog(); @@ -3957,7 +3950,7 @@ namespace BeWo.View.Detail private TextBox InitMaximizedDocumentationTextBox(TextBox smallDocumentationTextBox) { - grosseDokuTextBox = new TextBox + _GrosseDokuTextBox = new TextBox { AcceptsReturn = true, VerticalScrollBarVisibility = ScrollBarVisibility.Auto, @@ -3969,9 +3962,9 @@ namespace BeWo.View.Detail Text = smallDocumentationTextBox.Text }; - grosseDokuTextBox.TextChanged += delegate { smallDocumentationTextBox.Text = grosseDokuTextBox.Text; }; + _GrosseDokuTextBox.TextChanged += delegate { smallDocumentationTextBox.Text = _GrosseDokuTextBox.Text; }; - return grosseDokuTextBox; + return _GrosseDokuTextBox; } private ServiceRecordRTFWindowView _rtfWindowView; @@ -4117,8 +4110,7 @@ namespace BeWo.View.Detail ViewModel.BedarfsMedViewModel = medRecords; ViewModel.BedarfsMedViewModel.NewVM.Customer = e.Data; - ViewModel.BedarfsMedViewModel.NewVM.SetInitialDosageForm(ServiceRecordListVM.AllDosageForms - .FirstOrDefault()); + ViewModel.BedarfsMedViewModel.NewVM.SetInitialDosageForm(ServiceRecordListVM.AllDosageForms.FirstOrDefault()); })); }