/// <summary>
        /// Loads the values of the combobox cbxSelectedMultiSite and selects the predefined value, if was set
        /// </summary>
        private void LoadMultiSiteComboBox()
        {
            var tmp = new List <string>();

            tmp.Add(ApplicationSettings.AutomaticSite);

            var multiSiteList = _sites.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var entry in multiSiteList)
            {
                var site = entry.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                tmp.Add(site[0]);
            }

            AvailableSites = new SortableObservableCollection <string>(tmp);
            AvailableSites.Sort(x => x.ToString(), ListSortDirection.Ascending);

            if ((ApplicationSettings.Instance.SelectedMultiSiteEntry != null) && (AvailableSites.Contains(ApplicationSettings.Instance.SelectedMultiSiteEntry)))
            {
                SelectedSite = ApplicationSettings.Instance.SelectedMultiSiteEntry;
            }
            else
            {
                SelectedSite = ApplicationSettings.AutomaticSite;
            }
        }
Exemple #2
0
        public void Add(double r, double h)
        {
            Point p = new Point(r, h);

            if (_profile.Contains(p))
            {
                return;
            }
            else
            {
                _profile.Add(p);
            }

            if (_profile.Count > 1)
            {
                _profile.Sort <Point>((Point pt) => pt, _xascending);
            }
        }
        private void LoadDataInBackground()
        {
            if (App.RtmClient.TaskLists != null)
            {
                var tempTaskLists = new SortableObservableCollection<TaskList>();

                var tempOverdueTasks = new SortableObservableCollection<Task>();
                var tempTodayTasks = new SortableObservableCollection<Task>();
                var tempTomorrowTasks = new SortableObservableCollection<Task>();
                var tempWeekTasks = new SortableObservableCollection<Task>();
                var tempNoDueTasks = new SortableObservableCollection<Task>();

                var tempTags = new SortableObservableCollection<string>();

                foreach (TaskList l in App.RtmClient.TaskLists)
                {
                    tempTaskLists.Add(l);

                    if (l.IsNormal && l.Tasks != null)
                    {
                        foreach (Task task in l.Tasks)
                        {
                            // add tags
                            foreach (string tag in task.Tags)
                            {
                                if (!tempTags.Contains(tag)) tempTags.Add(tag);
                            }

                            if (task.IsIncomplete)
                            {
                                if (task.DueDateTime.HasValue)
                                {
                                    // overdue
                                    if (task.DueDateTime.Value < DateTime.Today || (task.HasDueTime && task.DueDateTime.Value < DateTime.Now))
                                    {
                                        tempOverdueTasks.Add(task);
                                    }
                                    // today
                                    else if (task.DueDateTime.Value.Date == DateTime.Today)
                                    {
                                        tempTodayTasks.Add(task);
                                    }
                                    // tomorrow
                                    else if (task.DueDateTime.Value.Date == DateTime.Today.AddDays(1))
                                    {
                                        tempTomorrowTasks.Add(task);
                                    }
                                    // this week
                                    else if (task.DueDateTime.Value.Date > DateTime.Today.AddDays(1) && task.DueDateTime.Value.Date <= DateTime.Today.AddDays(6))
                                    {
                                        tempWeekTasks.Add(task);
                                    }
                                }
                                else
                                {
                                    // no due
                                    tempNoDueTasks.Add(task);
                                }
                            }
                        }
                    }
                }

                tempOverdueTasks.Sort();
                tempTodayTasks.Sort();
                tempTomorrowTasks.Sort();
                tempWeekTasks.Sort();
                tempNoDueTasks.Sort();

                tempTags.Sort();

                SmartDispatcher.BeginInvoke(() =>
                {
                    TaskLists = tempTaskLists;

                    TodayTasks = tempTodayTasks;
                    TomorrowTasks = tempTomorrowTasks;
                    OverdueTasks = tempOverdueTasks;
                    WeekTasks = tempWeekTasks;
                    NoDueTasks = tempNoDueTasks;

                    Tags = tempTags;
                });
            }
        }