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);
        }
        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());
        }
Exemple #3
0
        public MachineInformationView()
        {
            InitializeComponent();
            AssignSelectAllForTextBoxes();


            //TODO select only Customer
            //TODO Datetime Validation and format of filed


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

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

            //            frameCustomers.Content = customersView;

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

            //            customersView.expanderCustomers.Collapsed += ExpanderCustomers_Collapsed;
            //            customersView.dgCustomers.SelectionChanged += DgCustomers_SelectionChanged;

            //            locationsView.expanderLocations.Collapsed += ExpanderLocations_Collapsed;
            //            locationsView.dgLocations.SelectionChanged += DgLocations_SelectionChanged;

            //        }));

            //});


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

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

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

                    frameCustomers.Content = customersView;

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

                    NotVisibleColumns.Add(nameof(MachineInformation.ContactPerson));

                    dgMachineInformations.SelectionChanged += DgMachineInformations_SelectionChanged;
                    dgMachineInformations.SelectedIndex     = 0;

                    AssigneValuesToControl();

                    customersView.expanderCustomers.Collapsed  += ExpanderCustomers_Collapsed;
                    customersView.dgCustomers.SelectionChanged += DgCustomers_SelectionChanged;

                    locationsView.expanderLocations.Collapsed  += ExpanderLocations_Collapsed;
                    locationsView.dgLocations.SelectionChanged += DgLocations_SelectionChanged;

                    masterDataInfo = new MasterDataInfoView(Helper.Helper.TTypeMangement.MachineInformation);
                    masterDataInfo.cbLocations.SelectionChanged += CbLocations_SelectionChanged;
                    masterDataInfo.RefreshCustomers();
                    frameMasterDataInfo.Content = masterDataInfo;
                }));
            }).ContinueWith((task) =>
            {
                LoadingIndicatorPanel.Visibility          = Visibility.Collapsed;
                gridResizableMachineInformation.IsEnabled = true;
            }, TaskScheduler.FromCurrentSynchronizationContext());

            EnableContoles(false);
        }