private void ExecutedTaskEnabledChangedCommand(object sender, ExecutedRoutedEventArgs e)
		{
			var lv = (ListView)e.Source;
			var task = lv.SelectedItem as IHydraTask;

			if (task == null)
				return;

			if (task.Settings.IsEnabled)
				lv.ScrollIntoView(task);

			//если задача была включена впервые - открыть окно редактирования настроек
			if (task.Settings.IsDefault && task.Settings.IsEnabled)
			{
				EditTask(task);

				OpenPaneCommand.Execute("Task", null);

				//настройки не были сохранены - необходимо выключить задачу
				if (task.Settings.IsDefault)
				{
					var checkBox = e.OriginalSource as CheckBox;
					if (checkBox != null)
						checkBox.IsChecked = false;

					new MessageBoxBuilder()
						.Text(LocalizedStrings.Str2905)
						.Warning()
						.Owner(this)
						.Show();
				}
			}
			else
				task.SaveSettings();
		}
Example #2
0
        private void ExecutedNewTaskCommand(object sender, ExecutedRoutedEventArgs e)
        {
            var task = (IHydraTask)e.Parameter;

            if (task == null)
            {
                return;
            }

            //if (Tasks.Any(t => t.GetType() == task.GetType()))
            //{
            //	var msg = "Multi".ValidateLicense();

            //	if (msg != null)
            //	{
            //		_logManager.Application.AddErrorLog(msg);

            //		new MessageBoxBuilder()
            //			.Text(LocalizedStrings.Str2903Params.Put(task.GetDisplayName()))
            //			.Warning()
            //			.Owner(this)
            //			.Show();

            //		return;
            //	}
            //}

            BusyIndicator.BusyContent = LocalizedStrings.Str2904Params.Put(task.GetDisplayName());
            BusyIndicator.IsBusy      = true;

            IHydraTask newTask = null;

            Task.Factory
            .StartNew(() => newTask = CreateTask(task.GetType()))
            .ContinueWithExceptionHandling(this, res =>
            {
                BusyIndicator.IsBusy = false;

                if (!res)
                {
                    return;
                }

                Tasks.Add(newTask);

                NavigationBar.SelectedIndex = task.Type == TaskTypes.Source ? 0 : 1;

                GetListView(newTask).SelectedItem = newTask;
                NewSourceButton.IsOpen            = false;
                GetListView(newTask).ScrollIntoView(newTask);

                OpenPaneCommand.Execute("Task", null);
                EditTask(newTask);
            });
        }
Example #3
0
 private void CurrentTasks_OnSelectionItemDoubleClick(object sender, MouseButtonEventArgs e)
 {
     OpenPaneCommand.Execute("Task", null);
 }