Ejemplo n.º 1
0
        private void btnShowAddForm_Click(object sender, EventArgs e)
        {
            var form = new AddTaskForm();

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var taskInfo = form.ResultTaskInfo;

                var taskState = new TaskState();
                taskState.index = 0;
                if (taskInfo.apartment)
                {
                    var THREE = 3;
                    taskState.addTimeout = DateTime.Now.AddDays(THREE);
                }
                else
                    taskState.addTimeout = DateTime.Now;
                taskState.Serialize(Path.Combine("tasks", taskInfo.id + ".state.data"));

                var task = new Task(taskInfo.id);
                tasksManager.tasks.Add(task);
                tasksManager.Save();

                RefreshTable(sender, null);

                Log("Задача успешно добавлена. Количество добавленых записей: " + task.info.count + ".");
            }
        }
Ejemplo n.º 2
0
 public Task(string id)
 {
     info = TaskInfo.Unserialize(Path.Combine("tasks", id + ".info.data"));
     state = TaskState.Unserialize(Path.Combine("tasks", id + ".state.data"));
 }