private void HandleWarning(IOperationViewModel operation)
 {
     operation.State = OperationState.CompleteWithWarnings;
     eventAggregator.PublishOnUIThread(
         new LogEntry(string.Format("{0} completed with warnings!", operation.Description),
                      LogEntrySeverity.Warning, LogEntrySource.UI));
 }
 private static IOperationViewModel GetPreviousItem(IEnumerable<IOperationViewModel> operations, IOperationViewModel currentOperation)
 {
     // Todo: Redo this as extension method?
     var currentIndex = operations.ToList().IndexOf(currentOperation);
     var previousOperation = operations.ElementAt(currentIndex == 0 ? currentIndex : currentIndex - 1);
     return previousOperation;
 }
 private void HandleSuccess(IOperationViewModel operation)
 {
     operation.State = OperationState.Success;
     eventAggregator.PublishOnUIThread(
         new LogEntry(string.Format("{0} completed successfully.", operation.Description), LogEntrySeverity.Info,
                      LogEntrySource.UI));
 }
        private bool CanContinue(IOperationViewModel previousOperation)
        {
            var statesToContinueFrom = new List <OperationState>()
            {
                OperationState.CompleteWithWarnings,
                OperationState.Success,
                OperationState.NotStarted
            };

            return(statesToContinueFrom.Contains(previousOperation.State));
        }
Exemple #5
0
        public NodeViewModel(INetworkViewModel _parentNetworkViewModel, IOperationViewModel _operationViewModel)
        {
            VisualLoadedCommand  = new RelayCommand <FrameworkElement>(ExecuteVisualLoadedCommand);
            VisualUpdatedCommand = new RelayCommand(ExecuteVisualUpdatedCommand);
            DragStartedCommand   = new RelayCommand <MouseButtonEventArgs>(ExecuteDragStartedCommand);
            DraggingCommand      = new RelayCommand <MouseEventArgs>(ExecuteDraggingCommand);
            DragCompletedCommand = new RelayCommand <MouseButtonEventArgs>(ExecuteDragCompletedCommand);

            OperationModel     = _operationViewModel;
            ParentNetworkView  = _parentNetworkViewModel;
            LeftEdgeViewModel  = new EdgeViewModel(this, ConnectorType.Input);
            RightEdgeViewModel = new EdgeViewModel(this, ConnectorType.Output);
        }
        private static IOperationViewModel GetPreviousItem(IEnumerable <IOperationViewModel> operations, IOperationViewModel currentOperation)
        {
            // Todo: Redo this as extension method?
            var currentIndex      = operations.ToList().IndexOf(currentOperation);
            var previousOperation = operations.ElementAt(currentIndex == 0 ? currentIndex : currentIndex - 1);

            return(previousOperation);
        }
 private void HandleErrors(IOperationViewModel operation)
 {
     operation.State = OperationState.Failed;
     eventAggregator.PublishOnUIThread(new LogEntry(string.Format("{0} failed!", operation.Description),
                                                    LogEntrySeverity.Error, LogEntrySource.UI));
 }
 private void HandleCancellation(IOperationViewModel operation)
 {
     eventAggregator.PublishOnUIThread(
         new LogEntry(string.Format("Operation {0} canceled.", operation.Description), LogEntrySeverity.Warning,
                      LogEntrySource.UI));
 }
 private void HandleWarning(OperationResult result, IOperationViewModel operation)
 {
     operation.State = OperationState.CompleteWithWarnings;
     eventAggregator.PublishOnUIThread(
         new LogEntry(string.Format("{0} completed with warnings!", operation.Description),
             LogEntrySeverity.Warning, LogEntrySource.UI));
 }
 private void HandleSuccess(OperationResult result, IOperationViewModel operation)
 {
     operation.State = OperationState.Success;
     eventAggregator.PublishOnUIThread(
         new LogEntry(string.Format("{0} completed successfully.", operation.Description), LogEntrySeverity.Info,
             LogEntrySource.UI));
 }
 private void HandleErrors(OperationResult result, IOperationViewModel operation)
 {
     operation.State = OperationState.Failed;
     eventAggregator.PublishOnUIThread(new LogEntry(string.Format("{0} failed!", operation.Description),
         LogEntrySeverity.Error, LogEntrySource.UI));
 }
 private void HandleCancellation(OperationResult result, IOperationViewModel operation)
 {
     eventAggregator.PublishOnUIThread(
         new LogEntry(string.Format("Operation {0} canceled.", operation.Description), LogEntrySeverity.Warning,
             LogEntrySource.UI));
 }
        private bool CanContinue(IOperationViewModel previousOperation)
        {
            var statesToContinueFrom = new List<OperationState>()
            {
                OperationState.CompleteWithWarnings,
                OperationState.Success,
                OperationState.NotStarted
            };

            return statesToContinueFrom.Contains(previousOperation.State);
        }