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; }
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; }
public HistoryDataProvider(ITimeLogsManager timeLogsManager, ITaskCollection taskCollection) { TimeLogsManager = timeLogsManager; TaskCollection = taskCollection; table = CreateTable(); ActivitiesHistory = new ActivitiesHistory(); }
public TaskTimeSummarizer(string taskName, DataTable table, ITimeLogsManager timeLogsManager, ITaskCollection taskCollection) { this.entityName = taskName; this.table = table; this.timeLogsManager = timeLogsManager; this.taskCollection = taskCollection; }
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); }
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); }
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); }
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); }
public SchedulerContext(ITaskCollection <TTaskInfo> queue, CancellationTokenSource cts) { this.cts = cts; Queue = queue; IsInvalid = false; }
internal void Initialize(ITaskCollection tasks) { splitContainerAdv1.SplitterDistance = Convert.ToInt32(Height * 0.7); InitTextBox(); tasksTreeView1.Initialize(tasks); }
public void DeserializeBrokenXml() { string sXml = "<tasks><task>&</task></tasks>"; ITaskCollection taskCollection = TaskCollectionSerializer.Deserialize(new StringReader(sXml)); Assert.IsNull(taskCollection); }
public void DeserializeWrongRoot() { string sXml = "<projects><task name=\"Name\"></task></projects>"; ITaskCollection taskCollection = TaskCollectionSerializer.Deserialize(new StringReader(sXml)); Assert.AreEqual(0, taskCollection.Count); }
public Worker(IStepManager <IStepInformation> stepManager, ILogger logger) { this.stepManager = stepManager; this.createdTasks = new TaskCollection(); this.logger = logger; }
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(); }
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(); }
public void GetTasksWhenThereIsNoTasksFile() { Log.Writer = new StringWriter(); File.Delete(fileManager.TasksFileName); ITaskCollection taskCollection = fileManager.GetTasks(); Assert.IsNull(taskCollection); Assert.AreEqual("", Log.Writer.ToString()); }
internal TaskManifest(IRevaleeRegistrar revalee, HttpContext context, IOptions <RevaleeOptions> option) { InitVariables(); _option = option.Value; _revalee = revalee; _context = context; _taskCollection = new ImmutableTaskCollection(); }
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")); }
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); }
public bool Load() { ITaskCollection loadedTasks = fileManager.GetTasks(); if (loadedTasks != null) { TaskCollection = loadedTasks; } fileManager.LoadHistory(HistoryDataProvider.ActivitiesHistory); LoadTimeLog(TimeManager.TimeSystem.Now); return(true); }
public void Initialize(ITaskCollection tasks) { AddRootNode(); if (tasks == null) { throw new ArgumentNullException("tasks"); } _tasks = tasks; _tasks.TaskChanged += OnTaskChanged; _tasks.Cleared += OnTasksCleared; }
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); } }
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; }
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); }
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); } }
/// <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(); } }
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); }
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); }
/// <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(); } }
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); }
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 }); }
ISchedulerContext IScheduler.GetContext(ITaskQueue taskQueue, ITaskCollection items, CancellationTokenSource cts, SchedulerContextData queueData) { return(GetContext((ITaskQueue <TTaskInfo>)taskQueue, (ITaskCollection <TTaskInfo>)items, cts, queueData)); }
internal TaskManifest() { _TaskCollection = new ImmutableTaskCollection(); }
public abstract TSchedulerContext GetContext(ITaskQueue <TTaskInfo> taskQueue, ITaskCollection <TTaskInfo> items, CancellationTokenSource cts, SchedulerContextData queueData);
/// <summary> /// Конструктор асинхронной задачи /// </summary> /// <param name="collection">Коллекция задач для привязки</param> public AsyncTaskInfo(ITaskCollection collection) { BingingCollection(collection); Initialize(); }
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; }