コード例 #1
0
 public CopyActionViewModel(CopyActionModel copyAction)
 {
     this.Action = copyAction;
     this.CopyAction = copyAction;
     this.ActionSourcesViewModel = new ActionSourcesViewModel(copyAction.Sources);
     this.ActionDestinationsViewModel = new ActionDestinationsViewModel(copyAction.Destinations);
 }
コード例 #2
0
        private void CreateCopyAction()
        {
            bool isComplete = CheckCompletedActionViewModel(m_SelectedActionViewModel);
            if (true == isComplete)
            {
                ConfirmActionNameViewModel confirmActionNameVM = new ConfirmActionNameViewModel(m_ActionViewModels);
                ConfirmActionNameWindow confirmActionNameWindow = new ConfirmActionNameWindow();
                confirmActionNameWindow.DataContext = confirmActionNameVM;

                if (true == confirmActionNameWindow.ShowDialog())
                {
                    string defaultActionName = confirmActionNameVM.ActionName;

                    CopyActionModel action = new CopyActionModel();
                    action.Name = defaultActionName;
                    action.Sources = new List<DragDropData>();
                    action.Destinations = new List<DragDropData>();

                    CopyActionViewModel actionVM = new CopyActionViewModel(action);
                    ActionViewModels.Add(actionVM);

                    SelectedViewModelsIndex(m_ActionViewModels.Count - 1);
                }
            }
            else
            {
                MessageBoxDialog messageDialog = new MessageBoxDialog();
                messageDialog.Show(CanExecuteActionCallback, "Information", String.Format("Cannot create new action now. The action {0} must be completed or saved first.", m_SelectedActionViewModel.Action.Name),
                                   MessageBoxButton.OK);
            }
        }