示例#1
0
 public override ISplitItemContent CreateClone(ISplitItemContent original)
 {
     var viewModel = original as WorkProfilePlanVm;
     var model = WorkProfilePlanDataService.CloneModelById(viewModel.Id);
     return new WorkProfilePlanVm(model, Access, WorkProfilePlanDataService);
 }
示例#2
0
        public override ISplitItemContent CreateClone(ISplitItemContent original)
        {
            var viewModel = original as FpcVm;
			var clone = FpcDataService.CloneModelById(viewModel.Id);
			return new FpcVm(clone, Access, FpcDataService);
        }
示例#3
0
 private void OnTreeLostFocus(object sender, KeyboardFocusChangedEventArgs e)
 {
     var tree = (TreeView)sender;
     _currentContent = (ISplitNodeContent)tree.SelectedItem;
     if (_currentContent == null) return;
     _currentContent.IsDeleting = false;
 }
示例#4
0
 private void TreePreviewKeyDown(object sender, KeyEventArgs e)
 {
     var tree = (TreeView)sender;
     _currentContent = (ISplitNodeContent)tree.SelectedItem;
     var treeVm = (ITreeSplitList) ViewModel;
     var root = treeVm.RootNode;
     if (e.Key == Key.Delete)
     {
         if (ViewModel.CurrentContent.IsDeleting)
         {
             ((IEntityObject)ViewModel.CurrentContent).Delete(null);
             TreeSplitViewModel.Remove(_currentContent.Id,root);
         }
         else
         {
             e.Handled = true;
             ViewModel.CurrentContent.IsDeleting = true;
         }
     }
     else if (e.Key == Key.Escape)
     {
         ViewModel.CurrentContent.IsDeleting = false;
     }
 }
示例#5
0
        void GridPreviewKeyDown(object sender, KeyEventArgs e)
        {
            var grid = (DataGrid)sender;
            _currentContent = (ISplitItemContent)grid.CurrentItem;
            if (e.Key == Key.F2)
            {
                if (_cellEditingMode)
                {
                    grid.CommitEdit(DataGridEditingUnit.Cell, true);
                    _cellEditingMode = false;
                }
                else
                {
                    grid.BeginEdit();
                    _cellEditingMode = true;
                }
            }
            else if (!_cellEditingMode && e.Key == Key.Left && Equals(grid.CurrentCell.Column, grid.Columns[grid.Columns.Count - 1]))
            {
                e.Handled = true;
            }
            else if (!_cellEditingMode && e.Key == Key.Right && Equals(grid.CurrentCell.Column, grid.Columns[0]))
            {
                e.Handled = true;
            }
            else if (!_cellEditingMode && e.Key == Key.Up && Equals(grid.SelectedIndex, 0))
            {
                e.Handled = true;
            }
            else if (!_cellEditingMode && e.Key == Key.Down && Equals(grid.SelectedIndex, grid.Items.Count - 1))
            {
                e.Handled = true;
            }
            else if (_cellEditingMode && e.Key == Key.Left || e.Key == Key.Right)
            {
                 grid.CommitEdit(DataGridEditingUnit.Cell, true);
                _cellEditingMode = false;
            }
            else if (e.Key == Key.Enter)
            {
                grid.CommitEdit(DataGridEditingUnit.Row, true);

                ViewModel.CurrentContent = (ISplitContent) grid.CurrentItem;
                _currentContent = (ISplitItemContent)ViewModel.CurrentContent;


                if (_currentContent.CanSave()) 
                    _currentContent.Save(null);
                else
                    _currentContent.Mode = ModificationStatus.Unsaved;

                if (_currentContent.SelectedGroupVM != null)
                {
                    if (grid.SelectedIndex == grid.Items.Count - 1)
                    {
                        ViewModel.Add(_currentContent.SelectedGroupVM);
                    }
                    else
                    {
                        var nextItem = (ISplitItemContent)grid.Items[grid.SelectedIndex + 1];
                        if (nextItem.SelectedGroupVM.Id != _currentContent.SelectedGroupVM.Id)
                        {
                            ViewModel.Add(_currentContent.SelectedGroupVM);
                        }
                    }
                }
                else if (grid.SelectedIndex == grid.Items.Count - 1)
                {
                    ViewModel.Add(null); 
                }
                _isSaving = true;
            }
            else if (!_cellEditingMode)
            {
                if (e.Key == Key.D && e.KeyboardDevice.Modifiers == ModifierKeys.Control)
                {
                    ViewModel.CreateClone(_currentContent);
                }
                else if (e.Key == Key.Delete)
                {
                    if (ViewModel.CurrentContent.IsDeleting)
                    {
                        ((IEntityObject)ViewModel.Items.CurrentItem).Delete(null);
                    }
                    else
                    {
                        e.Handled = true;
                        ViewModel.CurrentContent.IsDeleting = true;
                    }
                }
                else if (e.Key == Key.Escape)
                {
                    ViewModel.CurrentContent.IsDeleting = false;
                }
            }
        }
示例#6
0
 public virtual ISplitItemContent CreateClone(ISplitItemContent original)
 {
     return null;
 }
示例#7
0
 public override ISplitItemContent CreateClone(ISplitItemContent original)
 {
     var viewModel = original as HolidayVm;
     var model = HolidayDataService.CloneModelById(viewModel.Id);
     return new HolidayVm(model, Access, HolidayDataService);
 }