コード例 #1
0
        public TasksPresenter(IAppContext context, ILayerService layerService, TasksDockPanel view, ITaskCollection tasks)
            : base(view)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (layerService == null)
            {
                throw new ArgumentNullException("layerService");
            }
            if (tasks == null)
            {
                throw new ArgumentNullException("tasks");
            }

            _context      = context;
            _layerService = layerService;
            _tasks        = tasks;

            View.Initialize(tasks);

            tasks.TaskChanged += TaskChanged;

            View.TreeViewKeyDown += OnTreeViewKeyDown;
        }
コード例 #2
0
ファイル: AppContext.cs プロジェクト: zylimit/MapWindow5
        public AppContext(
            IApplicationContainer container,
            IProjectionDatabase projectionDatabase,
            IStyleService styleService,
            ITaskCollection tasks)
        {
            Logger.Current.Trace("In AppContext");
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }
            if (styleService == null)
            {
                throw new ArgumentNullException("styleService");
            }
            if (tasks == null)
            {
                throw new ArgumentNullException("tasks");
            }

            _container          = container;
            _projectionDatabase = projectionDatabase;
            _styleService       = styleService;
            _tasks = tasks;
        }
コード例 #3
0
 public HistoryDataProvider(ITimeLogsManager timeLogsManager, ITaskCollection taskCollection)
 {
     TimeLogsManager   = timeLogsManager;
     TaskCollection    = taskCollection;
     table             = CreateTable();
     ActivitiesHistory = new ActivitiesHistory();
 }
コード例 #4
0
 public TaskTimeSummarizer(string taskName, DataTable table, ITimeLogsManager timeLogsManager, ITaskCollection taskCollection)
 {
     this.entityName      = taskName;
     this.table           = table;
     this.timeLogsManager = timeLogsManager;
     this.taskCollection  = taskCollection;
 }
コード例 #5
0
 public TaskTimeSummarizer(string taskName, DataTable table, ITimeLogsManager timeLogsManager, ITaskCollection taskCollection)
 {
     this.entityName = taskName;
     this.table = table;
     this.timeLogsManager = timeLogsManager;
     this.taskCollection = taskCollection;
 }
コード例 #6
0
ファイル: TaskManifest.cs プロジェクト: Philo/Revalee
		internal TaskManifest(TaskConfigurationCollection configuredTasks)
		{
			if (configuredTasks == null)
			{
				throw new ArgumentNullException("configuredTasks");
			}

			_CallbackBaseUri = configuredTasks.CallbackBaseUri;
			var taskList = new List<ConfiguredTask>();

			using (var taskBuilder = new TaskBuilder(_CallbackBaseUri))
			{
				foreach (TaskConfigurationElement element in configuredTasks)
				{
					taskList.Add(taskBuilder.Create(_ClockSource, element.Periodicity, element.Hour, element.Minute, element.Url));

					if (this.CallbackBaseUri == null)
					{
						this.ScavengeForCallbackBaseUri(element.Url);
					}
				}
			}

			_TaskCollection = new ImmutableTaskCollection(taskList);
		}
コード例 #7
0
        internal TaskManifest(IRevaleeRegistrar revalee, HttpContext context, IOptions <RevaleeOptions> option, IRevaleeClientRecurringSettings configuredTasks)
        {
            if (configuredTasks == null)
            {
                throw new ArgumentNullException(nameof(configuredTasks));
            }

            _option          = option.Value;
            _revalee         = revalee;
            _context         = context;
            _callbackBaseUri = configuredTasks.CallbackBaseUri;

            InitVariables();

            var taskList = new List <ConfiguredTask>();

            using (var taskBuilder = new TaskBuilder(_callbackBaseUri))
            {
                foreach (var task in configuredTasks.TaskModel)
                {
                    taskList.Add(taskBuilder.Create(_clockSource, task.Periodicity, task.Day.GetValueOrDefault(), task.Hour.GetValueOrDefault(), task.Minute, task.Url));

                    if (CallbackBaseUri == null)
                    {
                        ScavengeForCallbackBaseUri(task.Url);
                    }
                }
            }

            _taskCollection = new ImmutableTaskCollection(taskList);
        }
コード例 #8
0
        public ITaskCollection GetTasks()
        {
            StreamReader    reader         = null;
            ITaskCollection taskCollection = null;

            if (File.Exists(TasksFileName))
            {
                try
                {
                    reader         = File.OpenText(TasksFileName);
                    taskCollection = TaskCollectionSerializer.Deserialize(reader);
                }
                catch (Exception ex)
                {
                    Log.Exception(ex);
                }
                finally
                {
                    if (reader != null)
                    {
                        reader.Close();
                    }
                }
            }
            return(taskCollection);
        }
コード例 #9
0
        internal TaskManifest(TaskConfigurationCollection configuredTasks)
        {
            if (configuredTasks == null)
            {
                throw new ArgumentNullException("configuredTasks");
            }

            _CallbackBaseUri = configuredTasks.CallbackBaseUri;
            var taskList = new List <ConfiguredTask>();

            using (var taskBuilder = new TaskBuilder(_CallbackBaseUri))
            {
                foreach (TaskConfigurationElement element in configuredTasks)
                {
                    taskList.Add(taskBuilder.Create(_ClockSource, element.Periodicity, element.Hour, element.Minute, element.Url));

                    if (this.CallbackBaseUri == null)
                    {
                        this.ScavengeForCallbackBaseUri(element.Url);
                    }
                }
            }

            _TaskCollection = new ImmutableTaskCollection(taskList);
        }
コード例 #10
0
 public HistoryDataProvider(ITimeLogsManager timeLogsManager, ITaskCollection taskCollection)
 {
     TimeLogsManager = timeLogsManager;
     TaskCollection = taskCollection;
     table = CreateTable();
     ActivitiesHistory = new ActivitiesHistory();
 }
コード例 #11
0
        public SchedulerContext(ITaskCollection <TTaskInfo> queue, CancellationTokenSource cts)
        {
            this.cts = cts;

            Queue     = queue;
            IsInvalid = false;
        }
コード例 #12
0
        internal void Initialize(ITaskCollection tasks)
        {
            splitContainerAdv1.SplitterDistance = Convert.ToInt32(Height * 0.7);

            InitTextBox();

            tasksTreeView1.Initialize(tasks);
        }
コード例 #13
0
        public void DeserializeBrokenXml()
        {
            string sXml = "<tasks><task>&</task></tasks>";

            ITaskCollection taskCollection = TaskCollectionSerializer.Deserialize(new StringReader(sXml));

            Assert.IsNull(taskCollection);
        }
コード例 #14
0
        public void DeserializeWrongRoot()
        {
            string sXml = "<projects><task name=\"Name\"></task></projects>";

            ITaskCollection taskCollection = TaskCollectionSerializer.Deserialize(new StringReader(sXml));

            Assert.AreEqual(0, taskCollection.Count);
        }
コード例 #15
0
        public Worker(IStepManager <IStepInformation> stepManager, ILogger logger)
        {
            this.stepManager = stepManager;

            this.createdTasks = new TaskCollection();

            this.logger = logger;
        }
コード例 #16
0
ファイル: TasksSummary.cs プロジェクト: gayancc/lazycure-code
 public TasksSummary(DataTable activitiesSummaryTable,ITaskCollection taskCollection)
 {
     dataTable = new DataTable("TasksSummary");
     dataTable.Columns.Add("Task");
     dataTable.Columns.Add("Spent", TimeSpan.Zero.GetType());
     ActivitiesSummaryTable = activitiesSummaryTable;
     this.taskCollection = taskCollection;
     Calculate();
 }
コード例 #17
0
ファイル: TasksSummary.cs プロジェクト: EugeneBA/lazycure
 public TasksSummary(DataTable activitiesSummaryTable, ITaskCollection taskCollection)
 {
     dataTable = new DataTable("TasksSummary");
     dataTable.Columns.Add("Task");
     dataTable.Columns.Add("Spent", TimeSpan.Zero.GetType());
     ActivitiesSummaryTable = activitiesSummaryTable;
     this.taskCollection    = taskCollection;
     Calculate();
 }
コード例 #18
0
ファイル: FileManagerTest.cs プロジェクト: EugeneBA/lazycure
        public void GetTasksWhenThereIsNoTasksFile()
        {
            Log.Writer = new StringWriter();
            File.Delete(fileManager.TasksFileName);
            ITaskCollection taskCollection = fileManager.GetTasks();

            Assert.IsNull(taskCollection);
            Assert.AreEqual("", Log.Writer.ToString());
        }
コード例 #19
0
        internal TaskManifest(IRevaleeRegistrar revalee, HttpContext context, IOptions <RevaleeOptions> option)
        {
            InitVariables();

            _option         = option.Value;
            _revalee        = revalee;
            _context        = context;
            _taskCollection = new ImmutableTaskCollection();
        }
コード例 #20
0
        public void Deserialize()
        {
            XmlDocument doc = new XmlDocument();

            doc.AppendChild(doc.CreateElement("tasks")).InnerXml =
                TaskSerializer.Serialize(new Task("task1")).OuterXml;

            ITaskCollection taskCollection = TaskCollectionSerializer.Deserialize(doc);

            Assert.IsTrue(taskCollection.Contains("task1"));
        }
コード例 #21
0
ファイル: TasksSummaryTest.cs プロジェクト: EugeneBA/lazycure
        public void SetUp()
        {
            DataTable activitiesSummaryTable = new DataTable("ActivitiesSummary");

            activitiesSummaryTable.Columns.Add("Task");
            activitiesSummaryTable.Columns.Add("Spent", TimeSpan.Zero.GetType());
            ITaskCollection taskCollection = NewMock <ITaskCollection>();

            Stub.On(taskCollection).Method("IsWorking").With("Work").Will(Return.Value(true));
            Stub.On(taskCollection).Method("IsWorking").With("Rest").Will(Return.Value(false));
            tasksSummary = new TasksSummary(activitiesSummaryTable, taskCollection);
        }
コード例 #22
0
ファイル: Driver.cs プロジェクト: gayancc/lazycure-code
        public bool Load()
        {
            ITaskCollection loadedTasks = fileManager.GetTasks();

            if (loadedTasks != null)
            {
                TaskCollection = loadedTasks;
            }
            fileManager.LoadHistory(HistoryDataProvider.ActivitiesHistory);
            LoadTimeLog(TimeManager.TimeSystem.Now);
            return(true);
        }
コード例 #23
0
        public void Initialize(ITaskCollection tasks)
        {
            AddRootNode();

            if (tasks == null)
            {
                throw new ArgumentNullException("tasks");
            }
            _tasks              = tasks;
            _tasks.TaskChanged += OnTaskChanged;
            _tasks.Cleared     += OnTasksCleared;
        }
コード例 #24
0
 public static void Serialize(ITaskCollection taskCollection, TextWriter writer)
 {
     try
     {
         if (writer != null)
             writer.WriteLine(Serialize(taskCollection).InnerXml);
         else
             Log.Error("Could not serialize tasks because writer is null");
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
     }
 }
コード例 #25
0
 public static XmlNode Serialize(ITaskCollection taskCollection)
 {
     XmlDocument doc = new XmlDocument();
     XmlNode root = doc.AppendChild(doc.CreateElement(ROOT_NODE));
     if (taskCollection != null)
     {
         foreach (Task task in taskCollection)
         {
             root.InnerXml += TaskSerializer.Serialize(task).OuterXml;
         }
     }
     else
         Log.Error("Could not serialize null tasks collection");
     return doc;
 }
コード例 #26
0
        public static XmlNode Serialize(ITaskCollection taskCollection)
        {
            XmlDocument doc  = new XmlDocument();
            XmlNode     root = doc.AppendChild(doc.CreateElement(ROOT_NODE));

            if (taskCollection != null)
            {
                foreach (Task task in taskCollection)
                {
                    root.InnerXml += TaskSerializer.Serialize(task).OuterXml;
                }
            }
            else
            {
                Log.Error("Could not serialize null tasks collection");
            }
            return(doc);
        }
コード例 #27
0
 public static void Serialize(ITaskCollection taskCollection, TextWriter writer)
 {
     try
     {
         if (writer != null)
         {
             writer.WriteLine(Serialize(taskCollection).InnerXml);
         }
         else
         {
             Log.Error("Could not serialize tasks because writer is null");
         }
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
     }
 }
コード例 #28
0
ファイル: Trimmer.cs プロジェクト: MingMZ/treetrim
        /// <summary>
        /// Trims the tree by using the provided tasks.
        /// </summary>
        /// <param name="tasks">The tasks to run.  These are run in order.
        /// When finished, they are run in reverse order and given a chance to clean up.</param>
        /// <param name="sourceTreeRoot">The source tree root.</param>
        public static void TrimTree(ITaskCollection tasks, string sourceTreeRoot)
        {
            ITask lastTask = new Task { Plugin = new NullPlugin( sourceTreeRoot ) } ;

            foreach ( ITask eachTask in tasks )
            {
                eachTask.Run( lastTask );
                
                lastTask = eachTask ;
            }

            IEnumerable<ITask> reversedTasks = tasks.Reverse( ) ;

            foreach (ITask eachTask in reversedTasks)
            {
                eachTask.Cleanup();
            }
        }
コード例 #29
0
 public bool SaveTasks(ITaskCollection taskCollection)
 {
     if (taskCollection != null)
     {
         StreamWriter writer;
         try
         {
             writer = File.CreateText(TasksFileName);
             TaskCollectionSerializer.Serialize(taskCollection, writer);
             writer.Close();
             return(true);
         }
         catch (Exception ex)
         {
             Log.Exception(ex);
         }
     }
     return(false);
 }
コード例 #30
0
        public void IntervalsChangesWhenActivityBecomesWorking()
        {
            ITaskCollection taskCollection = NewMock <ITaskCollection>();
            ITimeLog        timeLog        = NewMock <ITimeLog>();

            Expect.Once.On(taskCollection).Method("IsWorkingActivity").With("test").
            Will(Return.Value(false));
            Stub.On(timeLog).GetProperty("Data").Will(Return.Value(null));
            List <IActivity> activities = new List <IActivity>();

            activities.Add(new Activity("test", DateTime.Now, TimeSpan.FromMinutes(1)));
            Stub.On(timeLog).GetProperty("Activities").Will(Return.Value(activities));
            workingTime = new WorkingTimeForDay(timeLog, taskCollection);
            Expect.AtLeastOnce.On(taskCollection).Method("IsWorkingActivity").With("test").
            Will(Return.Value(true));
            TimeSpan workingTasksTime = workingTime.WorkingTasksTime;

            Assert.AreEqual(1, workingTime.Intervals.Rows.Count);
        }
コード例 #31
0
ファイル: Trimmer.cs プロジェクト: treetrim/treetrim
        /// <summary>
        /// Trims the tree by using the provided tasks.
        /// </summary>
        /// <param name="tasks">The tasks to run.  These are run in order.
        /// When finished, they are run in reverse order and given a chance to clean up.</param>
        /// <param name="sourceTreeRoot">The source tree root.</param>
        public static void TrimTree(ITaskCollection tasks, string sourceTreeRoot)
        {
            ITask lastTask = new Task {
                Plugin = new NullPlugin(sourceTreeRoot)
            };

            foreach (ITask eachTask in tasks)
            {
                eachTask.Run(lastTask);

                lastTask = eachTask;
            }

            IEnumerable <ITask> reversedTasks = tasks.Reverse( );

            foreach (ITask eachTask in reversedTasks)
            {
                eachTask.Cleanup();
            }
        }
コード例 #32
0
        public ITaskCollection GetTasks(int Month)
        {
            ITaskCollection _taskCollection = Factory.TaskCollectionFactory.Instantiate();
            DataSet         ds = CnBDAL.TasksFactory.Instantiate().GetTasks(Month);

            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    ITask _Task;
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        _Task                 = Factory.TaskFactory.Instantiate();
                        _Task.TaskID          = Convert.ToInt32(dr["TaskID"].ToString());
                        _Task.ClientID        = Convert.ToInt32(dr["ClientID"].ToString());
                        _Task.ClientName      = dr["ClientName"].ToString();
                        _Task.ProgramName     = dr["ProgramName"].ToString();
                        _Task.ApplicationName = dr["ApplicationName"].ToString();
                        _Task.TandimNumber    = Convert.ToInt32(dr["TandimNumber"].ToString());
                        _Task.RequestTypeID   = Convert.ToInt32(dr["RequestTypeID"].ToString());
                        _Task.RequestType     = dr["RequestType"].ToString();
                        _Task.WorkTypeID      = Convert.ToInt32(dr["WorkTypeID"].ToString());
                        _Task.WorkType        = dr["WorkType"].ToString();
                        _Task.HoursEstimate   = Convert.ToDouble(dr["HoursEstimate"].ToString());
                        _Task.HoursActual     = Convert.ToDouble(dr["HoursActual"].ToString());
                        _Task.Description     = dr["Description"].ToString();
                        _Task.Notes           = dr["Notes"].ToString();
                        _Task.EmployeeID      = Convert.ToInt32(dr["EnteredBy"].ToString());
                        _Task.Employee        = dr["Employee"].ToString();
                        _Task.DateTimeEntered = Convert.ToDateTime(dr["DateTimeEntered"].ToString());

                        _taskCollection.Add(_Task);
                    }
                }
            }
            return(_taskCollection);
        }
コード例 #33
0
        public override SchedulerContext <TaskInfo> GetContext(ITaskQueue <TaskInfo> taskQueue, ITaskCollection <TaskInfo> items, CancellationTokenSource cts, SchedulerContextData queueData)
        {
            return(new SchedulerContext <TaskInfo>(items, cts)
            {
                Delay = taskQueue.Delay,
                CancelOnException = taskQueue.CancelOnException,

                _queueEmpty = queueData._queueEmpty,

                _queueStarted = queueData._queueStarted,
                _queueStopped = queueData._queueStopped,

                _taskScheduled = queueData._taskScheduled,
                _taskCanceled = queueData._taskCanceled,
                _taskCanceling = queueData._taskCanceling,
                _taskExecuting = queueData._taskExecuting,
                _taskExecuted = queueData._taskExecuted,
                _taskException = queueData._taskException
            });
        }
コード例 #34
0
 ISchedulerContext IScheduler.GetContext(ITaskQueue taskQueue, ITaskCollection items, CancellationTokenSource cts, SchedulerContextData queueData)
 {
     return(GetContext((ITaskQueue <TTaskInfo>)taskQueue, (ITaskCollection <TTaskInfo>)items, cts, queueData));
 }
コード例 #35
0
 internal TaskManifest()
 {
     _TaskCollection = new ImmutableTaskCollection();
 }
コード例 #36
0
 public abstract TSchedulerContext GetContext(ITaskQueue <TTaskInfo> taskQueue, ITaskCollection <TTaskInfo> items, CancellationTokenSource cts, SchedulerContextData queueData);
コード例 #37
0
ファイル: TaskManifest.cs プロジェクト: javafun/Revalee
 internal TaskManifest()
 {
     _TaskCollection = new ImmutableTaskCollection();
 }
コード例 #38
0
 /// <summary>
 /// Конструктор асинхронной задачи
 /// </summary>
 /// <param name="collection">Коллекция задач для привязки</param>
 public AsyncTaskInfo(ITaskCollection collection)
 {
     BingingCollection(collection);
     Initialize();
 }
コード例 #39
0
ファイル: FileManager.cs プロジェクト: gayancc/lazycure-code
 public bool SaveTasks(ITaskCollection taskCollection)
 {
     if(taskCollection!=null)
     {
         StreamWriter writer;
         try
         {
             writer = File.CreateText(TasksFileName);
             TaskCollectionSerializer.Serialize(taskCollection, writer);
             writer.Close();
             return true;
         }
         catch(Exception ex)
         {
             Log.Exception(ex);
         }
     }
     return false;
 }