Esempio n. 1
0
        public void AddTask()
        {
            SlayerTask          task   = CreateSlayerTask();
            DailySlayerTaskList parent = slayerPage.AddDaily();

            parent.Add(task);
            slayerPage.SlayerTasksView.UpdateLayout();
            slayerPage.UpdateTaskInfoContents();
            this.Close();
        }
Esempio n. 2
0
        /// <summary>
        /// loads a single slayer task from a file
        /// </summary>
        /// <param name="path">
        /// path to a file containing the slayer task
        /// </param>
        private void LoadTaskFromJson(string path)
        {
            if (String.IsNullOrWhiteSpace(path) || !File.Exists(path))
            {
                return;
            }

            DailySlayerTaskList l = null;

            using (var reader = new StreamReader(path)) {
                l = JsonConvert.DeserializeObject <DailySlayerTaskList>(reader.ReadToEnd());
            }

            lock (taskThreadLock) {
                this.DailySlayerTasks.Add(l);
            }
        }
Esempio n. 3
0
        public DailySlayerTaskList AddDaily()
        {
            string dateString = DateUtils.GetTodaysDate();// String.Format("{0}/{1}/{2}", dt.Day < 10 ? "0" + dt.Day.ToString() : dt.Day.ToString(), dt.Month < 10 ? "0" + dt.Month.ToString() : dt.Month.ToString(), dt.Year);

            foreach (var entry in SlayerTasksView.Items)
            {
                if (entry is DailySlayerTaskList list)
                {
                    if (list.TaskDate == dateString)
                    {
                        return(list);
                    }
                }
            }
            var newDaily = new DailySlayerTaskList();
            var tempList = new List <DailySlayerTaskList>(mainWindow.DailySlayerTasks);

            tempList.Add(newDaily);
            tempList = tempList.OrderByDescending(s => s.TaskDate).ToList();
            mainWindow.DailySlayerTasks = new System.Collections.ObjectModel.ObservableCollection <DailySlayerTaskList>(tempList);
            SlayerTasksView.ItemsSource = mainWindow.DailySlayerTasks;
            SlayerTasksView.UpdateLayout();
            return(newDaily);
        }
 public void SetOwner(DailySlayerTaskList list) => this.owner = list;