예제 #1
0
        protected SystemDefinedView(IWorkbook workbook, ISystemView view)
            : base(workbook, view)
        {
            this.view = view;

            this.Ready();
        }
예제 #2
0
        public void AddSystemView(ISystemView view)
        {
            if (view.Id == 0)
            {
                view.Id = viewId++;
            }

            this.views.Add(view);
        }
예제 #3
0
        public void RemoveSystemView(ISystemView view)
        {
            if (view == null)
            {
                throw new ArgumentNullException(nameof(view));
            }

            this.Delete(view);
            this.views.Remove(view);
        }
예제 #4
0
        public static ISystemView BuildView(IWorkbook workbook, ISystemView view)
        {
            if (workbook == null)
            {
                throw new ArgumentNullException("workbook");
            }
            if (view == null)
            {
                throw new ArgumentNullException("view");
            }

            switch (view.ViewKind)
            {
            case ViewKind.Today:
                return(new ViewToday(workbook, view));

            case ViewKind.Week:
                return(new ViewWeek(workbook, view));

            case ViewKind.All:
                return(new ViewAll(workbook, view));

            case ViewKind.Completed:
                return(new ViewCompleted(workbook, view));

            case ViewKind.Starred:
                return(new ViewStarred(workbook, view));

            case ViewKind.NoDate:
                return(new ViewNoDate(workbook, view));

            case ViewKind.Tomorrow:
                return(new ViewTomorrow(workbook, view));

            case ViewKind.Reminder:
                return(new ViewReminder(workbook, view));

            case ViewKind.Late:
                return(new ViewLate(workbook, view));

            case ViewKind.StartDate:
                return(new ViewStartDate(workbook, view));

            case ViewKind.NonCompleted:
                return(new ViewNonCompleted(workbook, view));

            case ViewKind.ToSync:
                return(new ViewToSync(workbook, view));

            default:
                throw new ArgumentOutOfRangeException(nameof(view));
            }
        }
예제 #5
0
        public void LoadViews()
        {
            foreach (var view in this.databaseContext.Views.OrderBy(f => f.Order))
            {
                if (!this.views.Any(v => v.ViewKind == view.ViewKind))
                {
                    ISystemView systemView = ViewFactory.BuildView(this, view);
                    systemView.PropertyChanged += this.OnFolderPropertyChanged;

                    this.views.Add(systemView);
                }
            }
        }
예제 #6
0
        public EditViewViewModel(ISystemView view, IWorkbook workbook, INavigationService navigationService, IMessageBoxService messageBoxService, IPlatformService platformService)
            : base(workbook, navigationService, messageBoxService, platformService)
        {
            if (view == null)
            {
                throw new ArgumentNullException(nameof(view));
            }

            this.view = view;

            this.IsAscending = view.GroupAscending;
            this.TaskGroup   = view.TaskGroup;
        }
예제 #7
0
        public void AddSystemView(ISystemView view)
        {
            if (view == null)
            {
                throw new ArgumentNullException(nameof(view));
            }

            var target = this.views.FirstOrDefault(t => t.ViewKind == view.ViewKind);

            if (target != null)
            {
                return;
            }

            this.objectTracker.EnsureIsTracked(view);
            this.connection.Insert(view);

            this.views.Add(view);
        }
예제 #8
0
 public ViewStarred(IWorkbook workbook, ISystemView view)
     : base(workbook, view)
 {
 }
예제 #9
0
 public void RemoveSystemView(ISystemView view)
 {
     this.views.Remove(view);
 }
예제 #10
0
 public ViewReminder(IWorkbook workbook, ISystemView view)
     : base(workbook, view)
 {
 }
예제 #11
0
 public ViewWeek(IWorkbook workbook, ISystemView view)
     : base(workbook, view)
 {
 }
예제 #12
0
 public ViewTomorrow(IWorkbook workbook, ISystemView view)
     : base(workbook, view)
 {
 }
예제 #13
0
 public ViewLate(IWorkbook workbook, ISystemView view)
     : base(workbook, view)
 {
 }
예제 #14
0
 public void AddView(ISystemView view)
 {
     this.databaseContext.AddSystemView(view);
     this.databaseContext.SendChanges();
 }
예제 #15
0
 public ViewCompleted(IWorkbook workbook, ISystemView view)
     : base(workbook, view)
 {
 }
예제 #16
0
        public FolderItemViewModel(IWorkbook workbook, IAbstractFolder folder)
        {
            if (workbook == null)
            {
                throw new ArgumentNullException(nameof(workbook));
            }
            if (folder == null)
            {
                throw new ArgumentNullException(nameof(folder));
            }

            this.workbook             = workbook;
            this.settings             = workbook.Settings;
            this.settings.KeyChanged += this.OnSettingsKeyChanged;
            this.folder = folder;

            this.setTargetGroupCommand = new RelayCommand <string>(taskGroup => this.SelectedTaskGroup = TaskGroupConverter.FromName(taskGroup));
            this.contextualCommand     = new RelayCommand(this.ContextualCommandExecute);

            this.showFutureStartDates = this.workbook.Settings.GetValue <bool>(CoreSettings.ShowFutureStartDates);
            this.isDatesGrouped       = this.workbook.Settings.GetValue <bool>(CoreSettings.UseGroupedDates);
            this.hideCompletedTasks   = this.workbook.Settings.GetValue <CompletedTaskMode>(CoreSettings.CompletedTasksMode) == CompletedTaskMode.Hide;

            ISystemView view = this.folder as ISystemView;

            if (view != null)
            {
                this.viewKind = view.ViewKind;
            }
            else if (this.folder is ViewSearch)
            {
                this.viewKind = ViewKind.Search;
            }
            else
            {
                this.viewKind = ViewKind.None;
            }

            this.trackedTasks = new List <ITask>();

            this.folder.TaskAdded   += (s, e) => this.AddTask(e.Item);
            this.folder.TaskRemoved += (s, e) => this.RemoveTask(e.Item);

            this.folder.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == "Name")
                {
                    this.RaisePropertyChanged("Name");
                }
                else if (e.PropertyName == "TaskCount" && this.folder.HasCustomCommand)
                {
                    this.RaisePropertyChanged("HasContextualCommand");
                }
            };

            this.folder.GroupingChanged += (s, e) =>
            {
                this.smartCollection.GroupBuilder = GroupBuilderFactory.GetGroupBuilder(this.folder, this.settings);
                this.RaisePropertyChanged("DisplayFolder");
                this.RaisePropertyChanged("DisplayDue");
            };

            // the last parameter is a function which returns the folder associated with a task
            // when we group by folder, it's the folder of the task
            // otherwise (most of the time), it's the folder of this ViewModel
            this.smartCollection = new SmartCollection <ITask>(
                this.folder.Tasks,
                GroupBuilderFactory.GetGroupBuilder(this.folder, this.workbook.Settings),
                this.TaskFilter,
                this,
                task => this.folder);

            foreach (var task in this.folder.Tasks)
            {
                this.StartTrackingTask(task);
            }
        }
예제 #17
0
 public void AddSystemView(ISystemView view)
 {
     this.views.Add(view);
 }
예제 #18
0
 public ViewToSync(IWorkbook workbook, ISystemView view) : base(workbook, view)
 {
 }