public SchedulerViewModel(IEventAggregator eventPublisher, DirectoryObjectPickerDialog directoryObjectPicker, IPopupController popupController, IAsyncWorker asyncWorker, IServer server, Func <IServer, IServer> toEnvironmentModel, Task <IResourcePickerDialog> getResourcePicker = null)
            : base(eventPublisher)
        {
            SchedulerTaskManager = new SchedulerTaskManager(this, getResourcePicker);
            VerifyArgument.IsNotNull("directoryObjectPicker", directoryObjectPicker);
            DirectoryObjectPickerDialog directoryObjectPicker1 = directoryObjectPicker;

            VerifyArgument.IsNotNull("popupController", popupController);
            _popupController = popupController;

            VerifyArgument.IsNotNull("asyncWorker", asyncWorker);
            _asyncWorker        = asyncWorker;
            _toEnvironmentModel = toEnvironmentModel ?? (a => a.ToEnvironmentModel());
            Errors    = new ErrorResultTO();
            IsLoading = false;
            directoryObjectPicker1.AllowedObjectTypes = ObjectTypes.Users;
            directoryObjectPicker1.DefaultObjectTypes = ObjectTypes.Users;
            directoryObjectPicker1.AllowedLocations   = Locations.All;
            directoryObjectPicker1.DefaultLocations   = Locations.JoinedDomain;
            directoryObjectPicker1.MultiSelect        = false;
            directoryObjectPicker1.TargetComputer     = string.Empty;
            directoryObjectPicker1.ShowAdvancedView   = false;

            InitializeHelp();
            DebugOutputViewModel = new DebugOutputViewModel(new EventPublisher(), ServerRepository.Instance, new DebugOutputFilterStrategy());

            Server = server;
            SetupServer(server);
            SetDisplayName(false);
        }
        public virtual bool DoDeactivate(bool showMessage)
        {
            if (showMessage)
            {
                if (SelectedTask != null && SelectedTask.IsDirty)
                {
                    MessageBoxResult showSchedulerCloseConfirmation = _popupController.ShowSchedulerCloseConfirmation();
                    switch (showSchedulerCloseConfirmation)
                    {
                    case MessageBoxResult.Cancel:
                    case MessageBoxResult.None:
                        return(false);

                    case MessageBoxResult.No:
                        return(true);
                    }
                    return(SchedulerTaskManager.SaveTasks());
                }
            }
            if (SelectedTask != null && !showMessage)
            {
                return(SchedulerTaskManager.SaveTasks());
            }
            return(true);
        }
 public void UpdateScheduleWithResourceDetails(string resourcePath, Guid id, string resourceName)
 {
     SchedulerTaskManager.UpdateScheduleWithResourceDetails(resourcePath, id, resourceName);
 }
 public void CreateNewTask()
 {
     SchedulerTaskManager.CreateNewTask();
 }