using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using KanSan.Base; using KanSan.Base.Models; using KanSan.ViewModel; using Microsoft.EntityFrameworkCore; using Syncfusion.Windows.Shared; using Syncfusion.XlsIO; namespace KanSan { /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : ChromelessWindow { UI.UCKundeEdit UCKundeEdit; UI.UCKundeList UCKundeList; UI.UCProjektList UCProjektList; UI.UCBaustelleList UCBaustelleList; UI.UCSewerMainMenu uCSewerMainMenu; UI.UCLeistungsverzeichnisPositionenBaustelle UCLeistungsverzeichnisPositionenBaustelle; UI.UCLeistungsverzeichnisPosList UCLeistungsverzeichnisPosList; public MainWindow() { InitializeComponent(); this.DataContext = new MainWindowViewModel(); (this.DataContext as MainWindowViewModel).GenerateExcelFile(); #if DEBUG System.Diagnostics.PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Critical; #endif } private void UCProjektList_ProjektAdded(object sender, UI.SelectProjektEventArgs e) { if (e.projekt == null) return; UI.UCProjektEdit uCProjektEdit = new UI.UCProjektEdit(e.projekt); ContentController.Content = uCProjektEdit; } private void UCProjektList_ProjektSelected(object sender, UI.SelectProjektEventArgs e) { (DataContext as MainWindowViewModel).SelectedProjekt = e.projekt; } private void UCKundeList_KundeSelect(object sender, UI.KundeAddedKlickEventArgs e) { (DataContext as MainWindowViewModel).SelectedKunde = e.kunde; } private void UCKundeList_KundeAdded(object sender, UI.KundeAddedKlickEventArgs e) { UCKundeEdit = new UI.UCKundeEdit(e.kunde); UCKundeEdit.SpeichernClicked += Edit_SpeichernClicked; ContentController.Content = UCKundeEdit; } private void UCProjektList_ProjektEdited(object sender, UI.SelectProjektEventArgs e) { if (e.projekt == null) return; UI.UCProjektEdit uCProjektEdit = new UI.UCProjektEdit(e.projekt); uCProjektEdit.SpeichernClicked += Edit_SpeichernClicked; ContentController.Content = uCProjektEdit; } private void Edit_SpeichernClicked(object sender, EventArgs e) { ContentController.Content = "MainView"; } private void UCBaustelleList_BaustelleSelected(object sender, UI.SelectBaustelleEventArgs e) { (DataContext as MainWindowViewModel).SelectedBaustelle = e.baustelle; } private void UCBaustelleList_BaustelleEdited(object sender, UI.SelectBaustelleEventArgs e) { if (e.baustelle == null) return; UI.UCBaustelleEdit uCBaustelleEdit = new UI.UCBaustelleEdit(e.baustelle); uCBaustelleEdit.SpeichernClicked += Edit_SpeichernClicked; ContentController.Content = uCBaustelleEdit; } private void UCBaustelleList_BaustelleAdded(object sender, UI.SelectBaustelleEventArgs e) { if (e.baustelle == null) return; UI.UCBaustelleEdit uBaustelleEdit = new UI.UCBaustelleEdit(e.baustelle); uBaustelleEdit.SpeichernClicked += Edit_SpeichernClicked; ContentController.Content = uBaustelleEdit; } private void UCObjekteList_ObjektSelected(object sender, UI.ObjektSelectEventArgs e) { if (e.Objekt == null) return; (DataContext as MainWindowViewModel).SelectedObjekt = e.Objekt; rbObjekte.IsChecked = false; uCSewerMainMenu = new UI.UCSewerMainMenu(e.Objekt); ContentController.Content = uCSewerMainMenu; } private void rbLeistungsverzeichnis_Checked(object sender, RoutedEventArgs e) { rbBaustellen.IsChecked = false; rbKunden.IsChecked = false; rbObjekte.IsChecked = false; rbProjekte.IsChecked = false; UCLeistungsverzeichnisPosList = new UI.UCLeistungsverzeichnisPosList(); UCLeistungsverzeichnisPosList.LeistungsverzeichnisEdited += UCLeistungsverzeichnisPosList_LeistungsverzeichnisEdited; ContentController.Content = UCLeistungsverzeichnisPosList; } private void UCLeistungsverzeichnisPosList_LeistungsverzeichnisEdited(object sender, UI.SelectedLeistungsverzeichnisEventArgs e) { UI.UCLeistungsverzeichnisPosition uCLeistungsverzeichnisPosition = new UI.UCLeistungsverzeichnisPosition(e.LeistungsverzeichnisPosition); uCLeistungsverzeichnisPosition.SpeichernClicked += UCLeistungsverzeichnisPosition_SpeichernClicked; ContentController.Content = uCLeistungsverzeichnisPosition; } private void UCLeistungsverzeichnisPosition_SpeichernClicked(object sender, EventArgs e) { UCLeistungsverzeichnisPosList = new UI.UCLeistungsverzeichnisPosList(); UCLeistungsverzeichnisPosList.LeistungsverzeichnisEdited += UCLeistungsverzeichnisPosList_LeistungsverzeichnisEdited; ContentController.Content = UCLeistungsverzeichnisPosList; } private void rbLeistungsverzeichnisBaustellen_Checked(object sender, RoutedEventArgs e) { rbBaustellen.IsChecked = false; rbKunden.IsChecked = false; rbObjekte.IsChecked = false; rbProjekte.IsChecked = false; UCLeistungsverzeichnisPositionenBaustelle = new UI.UCLeistungsverzeichnisPositionenBaustelle(); ContentController.Content = UCLeistungsverzeichnisPositionenBaustelle; } private void Test_Checked(object sender, RoutedEventArgs e) { NewSanierungWindow newSanierungWindow = new NewSanierungWindow(); newSanierungWindow.ShowDialog(); } } }