Esempio n. 1
0
        public void CreateNewTask()
        {
            if (_schedulerViewModel.CurrentEnvironment?.Connection != null && !_schedulerViewModel.CurrentEnvironment.Connection.IsConnected)
            {
                ShowServerDisconnectedPopup();
                return;
            }

            if (_schedulerViewModel.IsDirty)
            {
                _schedulerViewModel.PopupController.Show(Core.SchedulerUnsavedTaskMessage, Core.SchedulerUnsavedTaskHeader, MessageBoxButton.OK, MessageBoxImage.Error, null, false, true, false, false, false, false);
                return;
            }

            var dev2DailyTrigger = new Dev2DailyTrigger(new TaskServiceConvertorFactory(), new DailyTrigger());
            var scheduleTrigger  = SchedulerFactory.CreateTrigger(TaskState.Ready, dev2DailyTrigger);
            ScheduledResource scheduledResource = new ScheduledResource(Core.SchedulerNewTaskName + _newTaskCounter, SchedulerStatus.Enabled, scheduleTrigger.Trigger.Instance.StartBoundary, scheduleTrigger, string.Empty, Guid.NewGuid().ToString());

            scheduledResource.OldName = scheduledResource.Name;
            var newres = _schedulerViewModel.ScheduledResourceModel.ScheduledResources[_schedulerViewModel.ScheduledResourceModel.ScheduledResources.Count == 1 ? 0 : _schedulerViewModel.ScheduledResourceModel.ScheduledResources.Count - 1];

            _schedulerViewModel.ScheduledResourceModel.ScheduledResources[_schedulerViewModel.ScheduledResourceModel.ScheduledResources.Count == 1 ? 0 : _schedulerViewModel.ScheduledResourceModel.ScheduledResources.Count - 1] = scheduledResource;
            _schedulerViewModel.ScheduledResourceModel.ScheduledResources.Add(newres);

            _newTaskCounter++;

            _schedulerViewModel.NotifyOfPropertyChange(() => _schedulerViewModel.TaskList);
            _schedulerViewModel.SelectedTask       = _schedulerViewModel.ScheduledResourceModel.ScheduledResources[_schedulerViewModel.ScheduledResourceModel.ScheduledResources.Count == 1 ? 1 : _schedulerViewModel.ScheduledResourceModel.ScheduledResources.Count - 2];
            _schedulerViewModel.WorkflowName       = string.Empty;
            _schedulerViewModel.SelectedTask.IsNew = true;
            ViewModelUtils.RaiseCanExecuteChanged(_schedulerViewModel.NewCommand);
        }
        protected override IScheduleTrigger ShowEditTriggerDialog()
        {
            var dailyTrigger = new DailyTrigger {
                StartBoundary = new DateTime(2013, 04, 01, 02, 21, 25)
            };

            return(SchedulerFactory.CreateTrigger(TaskState.Disabled, new Dev2Trigger(null, dailyTrigger)));
        }
Esempio n. 3
0
        protected virtual IScheduleTrigger ShowEditTriggerDialog()
        {
            var tmpTrigger = _schedulerViewModel.SelectedTask.Trigger.Trigger.Instance;

            if (TriggerEditDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (!TriggerEquals(TriggerEditDialog.Trigger, tmpTrigger))
                {
                    return(SchedulerFactory.CreateTrigger(TaskState.Disabled, new Dev2Trigger(null, TriggerEditDialog.Trigger)));
                }
            }
            return(null);
        }