void Dlg_Closed(object sender, EventArgs e)
 {
     dlg.Apply  -= new EventHandler(Dlg_Apply);
     dlg.Closed -= new EventHandler(Dlg_Closed);
     dlg         = null;
     App.Current.MainWindow.Focus();
 }
Esempio n. 2
0
        void AddNewHandler()
        {
            AddDebtor addDebtor = new AddDebtor(this);

            addDebtor.ShowDialog();
            CurrentIndex = Debtors.Count - 1;
        }
        void Dlg_Apply(object sender, EventArgs e)
        {
            // Pull the dialog out of the event args and apply the new settings
            AddDebtor dlg = (AddDebtor)sender;

            var Debtor = new Debtor();

            Debtor.Name = dlg.DebtorName;

            var debtAndDate = new DebtAndDate(Convert.ToDouble(dlg.InitialValue), DateTime.Now);

            Debtor.DebtAndDate.Add(debtAndDate);

            debtors.Add(Debtor);
            CurrentDebtor = Debtor;
        }
        private void PreviusCommandExecute()
        {
            if (dlg != null)
            {
                dlg.Focus();
            }
            else
            {
                dlg              = new AddDebtor();
                dlg.Owner        = App.Current.MainWindow;
                dlg.DebtorName   = null;
                dlg.InitialValue = null;

                // Listen for the Apply button and show the dialog modelessly
                dlg.Apply  += new EventHandler(Dlg_Apply);
                dlg.Closed += new EventHandler(Dlg_Closed);
                dlg.Show();
            }
        }