public EmergencyAgreementView()
        {
            InitializeComponent();
            AssignSelectAllForTextBoxes();

            LoadingIndicatorPanel.Visibility           = Visibility.Visible;
            gridResizableEmergencyAgreements.IsEnabled = false;

            Task.Factory.StartNew(() =>
            {
                var customersVM = new CustomersViewModel();
                customersVM.RefreshOnlyCustomers();

                var result = Application.Current.Dispatcher.BeginInvoke(
                    DispatcherPriority.Background,
                    new Action(() =>
                {
                    customersView             = new CustomersView();
                    customersView.CustomersVM = customersVM;
                    frameCustomers.Content    = customersView;

                    locationsView          = new LocationsView();
                    frameLocations.Content = locationsView;

                    var machineInformationsView = new MachineInformationsView();
                    machineInformationsView.NotVisibleColumns.Add(nameof(MachineInformation.GoogleDriveFolderName));
                    machineInformationsView.NotVisibleColumns.Add(nameof(MachineInformation.ContactPerson));
                    machineInformationsView.NotVisibleColumns.Add(nameof(MachineInformation.Description));
                    machineInformationsView.NotVisibleColumns.Add(nameof(MachineInformation.Payload));
                    machineInformationsView.NotVisibleColumns.Add(nameof(MachineInformation.Entrances));
                    machineInformationsView.NotVisibleColumns.Add(nameof(MachineInformation.HoldingPositions));
                    machineInformationsView.NotVisibleColumns.Add(nameof(MachineInformation.HoldingPositions));
                    frameMachineInformations.Content = machineInformationsView;

                    masterDataInfo = new MasterDataInfoView(Helper.Helper.TTypeMangement.EmergencyAgreement);
                    masterDataInfo.cbMachineInformations.SelectionChanged += CbMachineInformations_SelectionChanged;

                    masterDataInfo.RefreshCustomers();
                    frameMasterDataInfo.Content = masterDataInfo;

                    customersView.dgCustomers.SelectionChanged += DgCustomers_SelectionChanged;

                    locationsView.dgLocations.SelectionChanged += DgLocations_SelectionChanged;

                    machineInformationsView.dgMachineInformations.SelectionChanged += DgMachineInformations_SelectionChanged;

                    NotVisibleColumns.Add(nameof(EmergencyAgreement.GoogleCalendarEventId));
                    dgEmergencyAgreements.Tag = NotVisibleColumns;

                    dgEmergencyAgreements.SelectionChanged += DgEmergencyAgreements_SelectionChanged;
                    dgEmergencyAgreements.SelectedIndex     = 0;

                    EmergencyAgreementVM.LoadComboboxes();
                    AssigneValuesToControl();

                    cbNoticeOfPeriodMonth.ItemsSource   = GetMonths();
                    cbNoticeOfPeriodMonth.SelectedIndex = 2;

                    txtNoticeOfPeriod.Text = "Monate";

                    EnableContoles(false);
                }));
            }).ContinueWith((task) =>
            {
                LoadingIndicatorPanel.Visibility           = Visibility.Collapsed;
                gridResizableEmergencyAgreements.IsEnabled = true;
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }
        public ReportView()
        {
            InitializeComponent();

            var customersVM = new CustomersViewModel();

            customersVM.RefreshOnlyCustomers();
            customersView             = new CustomersView();
            customersView.CustomersVM = customersVM;
            frameCustomers.Content    = customersView;

            locationsView          = new LocationsView();
            frameLocations.Content = locationsView;

            var machineInformationsView = new MachineInformationsView();

            machineInformationsView.NotVisibleColumns.Add(nameof(MachineInformation.GoogleDriveFolderName));
            machineInformationsView.NotVisibleColumns.Add(nameof(MachineInformation.ContactPerson));
            machineInformationsView.NotVisibleColumns.Add(nameof(MachineInformation.Description));
            machineInformationsView.NotVisibleColumns.Add(nameof(MachineInformation.Payload));
            machineInformationsView.NotVisibleColumns.Add(nameof(MachineInformation.Entrances));
            machineInformationsView.NotVisibleColumns.Add(nameof(MachineInformation.HoldingPositions));
            machineInformationsView.NotVisibleColumns.Add(nameof(MachineInformation.HoldingPositions));
            frameMachineInformations.Content = machineInformationsView;

            masterDataInfo = new MasterDataInfoView(Helper.Helper.TTypeMangement.MaintenanceAgreement);
            masterDataInfo.cbMachineInformations.SelectionChanged += CbMachineInformations_SelectionChanged;

            masterDataInfo.RefreshCustomers();
            frameMasterDataInfo.Content = masterDataInfo;

            customersView.dgCustomers.SelectionChanged += DgCustomers_SelectionChanged;

            locationsView.dgLocations.SelectionChanged += DgLocations_SelectionChanged;

            machineInformationsView.dgMachineInformations.SelectionChanged += DgMachineInformations_SelectionChanged;

            BindingControl(dgReports, () => ReportVM.Records);
            BindingTextBlock(txtOfferPrice, () => ReportVM.OfferPriceSum, null, "c");
            BindingTextBlock(txtBillingAmountCorrect, () => ReportVM.BillingAmountCorrecteSum, null, "c");
            BindingTextBlock(txtSavingCost, () => ReportVM.SavingCostSum, null, "c");

            var binding = new Binding(GetPropertyPath(() => ReportVM.SavingCostSum))
            {
                Source = this,
            };

            binding.Mode      = BindingMode.TwoWay;
            binding.Converter = new ValueToForegroundColorConverter();

            txtSavingCost.SetBinding(TextBlock.ForegroundProperty, binding);

            BindingComboBoxBindingModeOneWay(cbYears, () => ReportVM.Years);
            BindingComboBoxSelectedValue(cbYears, () => ReportVM.YearSelected);

            var rbbinding = new Binding(GetPropertyPath(() => ReportVM.YearChecked))
            {
                Source = this,
            };

            rbbinding.Mode = BindingMode.TwoWay;

            rbYear.SetBinding(RadioButton.IsCheckedProperty, rbbinding);

            BindingDatePicker(datePickerDurationStart, () => ReportVM.ReportStart);
            BindingDatePicker(datePickerDurationEnd, () => ReportVM.ReportEnd);
        }