private void CancelAddNewTask()
 {
     NewScheduledTask = new ScheduledTask();
     TaskList.Clear();
     RaisePropertyChanged("NewScheduledTask");
     AddTaskWindowVis = false;
 }
Пример #2
0
 protected override void OnGameDataReset()
 {
     base.OnGameDataReset();
     NewPetList.Clear();
     PetList.Clear();
     PetTasks.Clear();
     TaskList.Clear();
 }
Пример #3
0
 private void AddTasksFromService()
 {
     TaskList.Clear();
     foreach (var task in TaskService.GetTasks())
     {
         TaskList.Add(task);
     }
 }
Пример #4
0
        private void Load()
        {
            TaskList.Clear();
            TaskList = _repo.GetAll();
            CreateControls();

            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("TaskControlList"));
        }
Пример #5
0
        ///-------------------------------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>  получить список задач плана  </summary>
        private void GetTaskList()
        {
            if (TaskList != null)
            {
                TaskList.Clear();
            }
            Db DB = new Db();

            DB.GetTaskList(Obj).ForEach(c => TaskList.Add(c));
        }
Пример #6
0
        /// <summary>
        /// 增加一个任务
        /// </summary>
        /// <param name="task"></param>
        /// <param name="startTime"></param>
        public void AddTask(WlyTaskBase task, DateTime startTime)
        {
            if ((m_dailyList.FirstOrDefault(o => o.Task.ID == task.ID) != null) || (m_mainList.FirstOrDefault(o => o.Task.ID == task.ID) != null))
            {
                return;
            }

            if (!task.Filter(this))
            {
                return;
            }

            if (task is WlyTimeTask || task is WlyDailyTask)
            {
                var info = m_accountInfo.GetTaskInfo(task.ID);
                if (!info.IsComplete || (info.CompleteTime < startTime))
                {
                    if (task is WlyFinalTask)
                    {
                        if (m_finalList.FirstOrDefault(o => o.Task.ID == task.ID) == null)
                        {
                            m_finalList.Add(new WlyTaskRunner(task, startTime > info.NextRunTime ? startTime : info.NextRunTime));
                        }
                    }
                    else if (m_dailyList.FirstOrDefault(o => o.Task.ID == task.ID) == null)
                    {
                        m_dailyList.Add(new WlyTaskRunner(task, startTime > info.NextRunTime ? startTime : info.NextRunTime));
                        m_dailyList = m_dailyList.OrderBy(o => o.StartTime).ToList();
                    }
                }
            }
            else if (task is WlyMainTask)
            {
                var info = m_accountInfo.GetTaskInfo(task.ID);
                m_mainList.Add(new WlyTaskRunner(task, startTime > info.NextRunTime ? startTime : info.NextRunTime));
            }

            if (Application.Current != null)
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    TaskList.Clear();
                    foreach (var t in m_dailyList.ToList())
                    {
                        TaskList.Add(t);
                    }

                    foreach (var t in m_mainList.ToList())
                    {
                        TaskList.Add(t);
                    }
                });
            }
        }
Пример #7
0
        private void OnSubmitTaskTimeCommandHandler()
        {
            EmployeeTimeRecord employeeTimeRecord = new EmployeeTimeRecord();

            employeeTimeRecord.Date       = SelectedDate;
            employeeTimeRecord.Comments   = Comments;
            employeeTimeRecord.EmployeeID = _employee.ID;
            employeeTimeRecord.Task       = TaskName;

            var projectTasks = _timeTrackerRepository.GetProjectTasks(_employee.Project.ID);

            bool containsSelectedTask = false;

            foreach (var item in projectTasks)
            {
                if (item.Name.Equals(TaskName))
                {
                    containsSelectedTask = true;
                    break;
                }
            }
            if (!containsSelectedTask)
            {
                ProjectTask projectTask = new ProjectTask();
                projectTask.Name    = TaskName;
                projectTask.Project = _timeTrackerRepository.GetProject(_employee.Project.ID);
                _timeTrackerRepository.PostProjectTasks(projectTask);
            }

            int startTimeValueMinutes = 0;

            if (int.TryParse(StartTimeValue, out startTimeValueMinutes))
            {
                employeeTimeRecord.StartTimeMinutes = startTimeValueMinutes;
            }

            int endTimeValueMinutes = 0;

            if (int.TryParse(EndTimeValue, out endTimeValueMinutes))
            {
                employeeTimeRecord.EndTimeMinutes = endTimeValueMinutes;
            }

            _timeTrackerRepository.PostEmployeeTimeRecord(employeeTimeRecord);

            RecordedList.Clear();
            TaskList.Clear();
            RecordedList = ConvertRecords(_timeTrackerRepository.GetEmployeeTimeRecords(_employee.ID, SelectedDate));
            TaskList     = new ObservableCollection <string>(_timeTrackerRepository.GetProjectTasks(_employee.Project.ID).Select(pt => pt.Name));
        }
Пример #8
0
        private void OnLoadFileClick(object obj)
        {
            var fileDialog = new OpenFileDialog();

            fileDialog.Filter           = "TEXT |*.txt";
            fileDialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;
            if (fileDialog.ShowDialog().Value)
            {
                string filename = fileDialog.FileName;
                //MessageBox.Show("Loading file! " + filename);
                TaskList.Clear();
                TaskList.AddRange(ioManager.LoadFile(filename));
            }
        }
Пример #9
0
        private async Task MergeTaskLists(string remoteTaskContents, string remoteRevision)
        {
            // We need a tasklist from the original remote file
            var original = new TaskList();

            using (IsolatedStorageFile appStorage = IsolatedStorageFile.GetUserStoreForApplication())
            {
                if (appStorage.FileExists("MergeCache"))
                {
                    using (IsolatedStorageFileStream file = appStorage.OpenFile("MergeCache", FileMode.Open, FileAccess.Read))
                    {
                        original.LoadTasks(file);
                    }
                }
            }

            // Now we need the new remote task list
            var tl = new TaskList();

            using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(remoteTaskContents)))
            {
                tl.LoadTasks(ms);
            }

            // Now that we have the original and updated remote versions, we can merge them
            // with the local version
            LoadingState = TaskLoadingState.Loading;

            PauseCollectionChanged();
            ClearTaskPropertyChangedHandlers();

            var newTaskList = TaskList.Merge(original, tl, TaskList);

            TaskList.Clear();
            foreach (var task in newTaskList)
            {
                TaskList.Add(task);
            }

            SaveToStorage();
            await PushLocal(remoteRevision);

            InitTaskPropertyChangedHandlers();
            ResumeCollectionChanged();

            InvokeTaskListChanged(new TaskListChangedEventArgs());

            LoadingState = TaskLoadingState.Ready;
        }
Пример #10
0
        /// <summary>
        /// Reset all tracking variables.
        /// </summary>
        public void Reset()
        {
            VoteStorage.Clear();
            ReferenceOrigins.Clear();
            ReferencePlans.Clear();
            FutureReferences.Clear();
            UndoBuffer.Clear();

            VoteDefinedTasks.Clear();
            OrderedVoteTaskList.Clear();
            TaskList.Clear();

            OnPropertyChanged("VoteCounter");
            OnPropertyChanged("Tasks");
        }
Пример #11
0
 public void LoadList(List <ActiveTask> list)
 {
     try
     {
         TaskList.Clear();
         foreach (var item in list)
         {
             if (!isUnload)
             {
                 TaskList.Add(item);
             }
         }
     }
     catch (Exception)
     {
     }
 }
Пример #12
0
        private void GetTasksCallback(IAsyncResult ar)
        {
            WebRequest request = ar.AsyncState as WebRequest;

            if (request != null)
            {
                WebResponse response = request.EndGetResponse(ar);
                if (response != null)
                {
                    Invoke(new MethodInvoker(delegate() {
                        localTasks.Clear();
                        localTasks.ReadXmlStream(response.GetResponseStream());
                        tasksListBox.VirtualListSize = localTasks.Count;
                        tasksListBox.BackColor       = SystemColors.Window;
                    }));
                }
            }
        }
 public void GetAllTTaskAgainstTaskType()
 {
     try
     {
         List <Taskk> list = new List <Taskk>();
         list.Clear();
         TaskList.Clear();
         list = databaseHelper.GetAllTaskksBaseOnTaskType(SelectedTaskType);
         if (list.Count > 0)
         {
             foreach (var t in list)
             {   // dont add the add custom's task buttons titles
                 if (t.Title == Constants.AppConstant.addCustomMiscellaneousTaskTextTitle ||
                     t.Title == Constants.AppConstant.addCustomProductiveTaskTextTitle ||
                     t.Title == Constants.AppConstant.addCustomUnProductiveTaskTrackId)
                 {
                     //skip to add this one
                 }
                 else
                 {
                     TaskList.Add(t.Title);
                 }
             }
             // need to set it (SelectedTask) to appropriate text here to propmt user otherwise select task picker title will b gone off
             if (isDayTaskEditRequest && TaskTypeChangeAttempts == 1)
             {// if request was for Edit day task then set it to previously assigned task title
                 SelectedTask = prevSelectedTaskTitle;
                 TaskTypeChangeAttempts++;
             }
             else
             {
                 SelectedTask = "Select Task";
                 TaskTypeChangeAttempts++;
             }
         }
     }
     catch (Exception ex)
     {
         MessagingCenter.Send((App)Xamarin.Forms.Application.Current, AppConstant.ErrorEvent, ex.ToString());
     }
 }
Пример #14
0
        private void ProcessTasksInternal()
        {
            List <CustomTask> tmpCopy;

            lock (TaskListSyncRoot)
            {
                tmpCopy = new List <CustomTask>(TaskList);
                TaskList.Clear();
            }

            while (tmpCopy.Count != 0)
            {
                var task = tmpCopy[0];
                tmpCopy.RemoveAt(0);
                ProcessSingleTask(task);
            }

            if (TaskCount == 0)
            {
                DataEvent.Reset();
            }
        }
Пример #15
0
 /*
  *  This method clears all the tasks in the worker's task list and resets the TotalTaskDuration
  */
 public void ClearTasks()
 {
     TaskList.Clear();
     TotalTaskDuration = 0;
 }
Пример #16
0
 public void Clear()
 {
     TaskList.Clear();
 }