Exemple #1
0
        private void BtnDeleteMissionOnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var img = sender as Image;

            if (img != null)
            {
                var row = img.DataContext as TblMissionViewModel;
                _viewModel.DeleteMission(row);
            }
        }
Exemple #2
0
        private void MainGrid_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Down)
            {
                //var currentRowIndex = (_viewModel.SelectedMainRow.SelectedMissions.IndexOf(_viewModel.selectedMission));
                //if (currentRowIndex == (_viewModel.SelectedMainRow.SelectedMissions.Count - 1))
                //{

                //    var newexe = new TblMissionViewModel();

                //    if (_viewModel.SelectedMainRow.EmpId == LoggedUserInfo.Code)
                //    {
                //        newexe.Status = _viewModel.MissionStatusSelfVisibility == Visibility.Visible ? 1 : 0;
                //        newexe.MissionStatusVisibility = _viewModel.MissionStatusSelfVisibility;
                //    }
                //    else
                //    {
                //        newexe.Status = _viewModel.MissionStatusVisibility == Visibility.Visible ? 1 : 0;
                //        newexe.MissionStatusVisibility = _viewModel.MissionStatusVisibility;
                //    }
                //    newexe.Emplid = _viewModel.SelectedMainRow.EmpId;

                //    _viewModel.SelectedMainRow.SelectedMissions.Add(newexe);

                //}
            }
            else if (e.Key == Key.Delete)
            {
                if (_viewModel.selectedMission.Iserial != 0)
                {
                    _viewModel.DeleteMission(_viewModel.selectedMission);
                }
                else
                {
                    if (_viewModel.SelectedMainRow.SelectedMissions.Count(x => x.FromDate == _viewModel.selectedMission.FromDate) > 1)
                    {
                        _viewModel.SelectedMainRow.SelectedMissions.Remove(_viewModel.selectedMission);
                    }
                }
            }
        }