Esempio n. 1
0
        private void btn_Add(object sender, RoutedEventArgs e)
        {
            WorkerWindow ww = new WorkerWindow();

            if (ww.ShowDialog() == true)
            {
                lstWorkers.Items.Add(ww.NewWorker);
            }
        }
Esempio n. 2
0
            /// <summary>
            /// Modifies worker instance
            /// </summary>
            /// <param name="worker">Worker instance</param>
            /// <returns>True, if worker is modified and saved; otherwise - false</returns>
            public void Modify(IWorker worker)
            {
                WorkerWindow workerWindow = new WorkerWindow();

                workerWindow.DataContext = new WorkerViewModel(worker);

                var dialogResult = workerWindow.ShowDialog();

                ModificationFinished?.Invoke(
                    this,
                    new ModificationStateEventArgs(dialogResult.HasValue && dialogResult.Value, worker));
            }
Esempio n. 3
0
        private void btn_Modify(object sender, RoutedEventArgs e)
        {
            if (lstWorkers.SelectedItem == null)
            {
                return;
            }
            WorkerWindow ww = new WorkerWindow(lstWorkers.SelectedItem as Worker);

            if (ww.ShowDialog() == true)
            {
                lstWorkers.Items.Refresh();
            }
        }