Exemplo n.º 1
0
        public searchCustomer(searchCustomerTypeEnum displayType)
        {
            InitializeComponent();
            dataContext = new searchCustomer_ModelView(displayType);
            this.DataContext = dataContext;

            dataContext.NewCustomerRequested += (s, a) =>
            {
                newCustomerUC = new NewCustomerUC(displayType);
                newCustomerWindow = new Window()
                {
                    Title = "Új ügyfél",
                    Content = newCustomerUC,
                    SizeToContent = SizeToContent.WidthAndHeight
                };
                newCustomerVM = newCustomerUC.DataContext as NewCustomer_ViewModel;
                newCustomerVM.CustomerInserted += (so, ar) =>
                {
                    dataContext.selectedCustomer = (CustomerBaseRepresentation)so;
                    dataContext.OnCustomerSelected(EventArgs.Empty);
                    newCustomerWindow.Close();
                };
                newCustomerWindow.Show();
            };

            DataProxy.Instance.CustomersChanged += (s, a) =>
            {
                dataContext.RefreshCustomerList();
            };
        }
Exemplo n.º 2
0
        public NewCustomerUC(searchCustomerTypeEnum displayType)
        {
            InitializeComponent();

            viewModel = new NewCustomer_ViewModel(displayType);
            DataContext = viewModel;

            viewModel.CityRequested += (s, a) =>
            {
                cityChooserWindow = new SearchCity();
                cityChooserVM = cityChooserWindow.DataContext as SearchCity_ViewModel;
                cityChooserVM.citySelected += (so, ar) =>
                {
                    viewModel.newCustomer.city = (CityRepresentation)so;
                    cityChooserWindow.Close();
                };
                cityChooserWindow.Show();
            };
        }