Ejemplo n.º 1
0
        private void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            DataGrid dg = sender as DataGrid;

            if (dg == null)
            {
                return;
            }

            Darlehen dar = (Darlehen)dg.SelectedItem;
            if (dar == null)
            {
                return;
            }

            var viewModel = new EigenschaftenDarlehenViewModel(dar);

            var window = new EigenschaftenDarlehenView();
            window.Owner = this;
            window.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;

            EventHandler handler = null;
            handler = delegate
            {
                viewModel.RequestClose -= handler;
                window.Close();
            };

            viewModel.RequestClose += handler;
            window.DataContext = viewModel;
            window.ShowDialog();
        }
Ejemplo n.º 2
0
        public void AddFinaQuelle(Finanzierung fina, double finanzierungsluecke)
        {
            Darlehen dar = new Darlehen();

            dar.Summe = finanzierungsluecke;

            int naechstePrio = 0;

            ////Nächst höhere Priorität ermitteln
            if (fina.Quellen.Count > 0)
            {
                naechstePrio = fina.Quellen.Max(da => da.Prioritaet);
                naechstePrio++;
                dar.Prioritaet = naechstePrio;
            }

            var viewModel = new EigenschaftenDarlehenViewModel(dar);

            var window = new EigenschaftenDarlehenView();
            window.Owner = App.window;
            window.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;

            EventHandler handler = null;
            handler = delegate
            {
                viewModel.RequestClose -= handler;
                window.Close();
            };

            viewModel.RequestClose += handler;
            window.DataContext = viewModel;
            window.ShowDialog();

            if (viewModel.DialogResult == true)
            {
                fina.Quellen.Add(dar);
            }
        }