Exemplo n.º 1
0
        public PhotoListContext(StatusControlContext statusContext, PhotoListLoadMode photoListLoadMode)
        {
            StatusContext = statusContext ?? new StatusControlContext();

            DataNotificationsProcessor = new DataNotificationsWorkQueue {
                Processor = DataNotificationReceived
            };

            ViewImageCommand      = StatusContext.RunNonBlockingTaskCommand <PhotoContent>(ViewImage);
            EditContentCommand    = StatusContext.RunNonBlockingTaskCommand <PhotoContent>(EditContent);
            ApertureSearchCommand = StatusContext.RunNonBlockingTaskCommand <PhotoContent>(async x =>
                                                                                           await RunReport(async() => await ApertureSearch(x), $"Aperture - {x.Aperture}"));
            LensSearchCommand = StatusContext.RunNonBlockingTaskCommand <PhotoContent>(async x =>
                                                                                       await RunReport(async() => await LensSearch(x), $"Lens - {x.Lens}"));
            CameraMakeSearchCommand = StatusContext.RunNonBlockingTaskCommand <PhotoContent>(async x =>
                                                                                             await RunReport(async() => await CamerMakeSearch(x), $"Camera Make - {x.CameraMake}"));
            CameraModelSearchCommand = StatusContext.RunNonBlockingTaskCommand <PhotoContent>(async x =>
                                                                                              await RunReport(async() => await CameraModelSearch(x), $"Camera Model - {x.CameraModel}"));
            FocalLengthSearchCommand = StatusContext.RunNonBlockingTaskCommand <PhotoContent>(async x =>
                                                                                              await RunReport(async() => await FocalLengthSearch(x), $"Focal Length - {x.FocalLength}"));
            IsoSearchCommand = StatusContext.RunNonBlockingTaskCommand <PhotoContent>(async x =>
                                                                                      await RunReport(async() => await IsoSearch(x), $"Iso - {x.Iso}"));
            ShutterSpeedSearchCommand = StatusContext.RunNonBlockingTaskCommand <PhotoContent>(async x =>
                                                                                               await RunReport(async() => await ShutterSpeedSearch(x), $"Shutter Speed - {x.ShutterSpeed}"));
            PhotoTakenOnSearchCommand = StatusContext.RunNonBlockingTaskCommand <PhotoContent>(async x =>
                                                                                               await RunReport(async() => await PhotoTakenOnSearch(x),
                                                                                                               $"Photo Created On - {x.PhotoCreatedOn.Date:D}"));


            SortListCommand = StatusContext.RunNonBlockingTaskCommand <string>(SortList);
            ToggleListSortDirectionCommand = StatusContext.RunNonBlockingTaskCommand(async() =>
            {
                SortDescending = !SortDescending;
                await SortList(_lastSortColumn);
            });

            ToggleLoadRecentLoadAllCommand = new Command(() =>
            {
                if (LoadMode == PhotoListLoadMode.All)
                {
                    LoadMode = PhotoListLoadMode.Recent;
                    StatusContext.RunBlockingTask(LoadData);
                }
                else if (LoadMode == PhotoListLoadMode.Recent)
                {
                    LoadMode = PhotoListLoadMode.All;
                    StatusContext.RunBlockingTask(LoadData);
                }
            });

            LoadMode = photoListLoadMode;
        }
        public NoteListContext(StatusControlContext statusContext)
        {
            StatusContext = statusContext ?? new StatusControlContext();

            DataNotificationsProcessor = new DataNotificationsWorkQueue {
                Processor = DataNotificationReceived
            };

            SortListCommand = StatusContext.RunNonBlockingTaskCommand <string>(SortList);
            ToggleListSortDirectionCommand = StatusContext.RunNonBlockingTaskCommand(async() =>
            {
                SortDescending = !SortDescending;
                await SortList(_lastSortColumn);
            });

            StatusContext.RunFireAndForgetBlockingTaskWithUiMessageReturn(LoadData);
        }
Exemplo n.º 3
0
        public TagListContext(StatusControlContext context)
        {
            StatusContext = context ?? new StatusControlContext();

            DataNotificationsProcessor = new DataNotificationsWorkQueue {
                Processor = DataNotificationReceived
            };

            RefreshDataCommand = StatusContext.RunBlockingTaskCommand(LoadData);

            SelectedDetailItemsToExcelCommand =
                StatusContext.RunBlockingTaskCommand(async() => await TagContentToExcel(DetailsSelectedItems));
            AllDetailItemsToExcelCommand =
                StatusContext.RunBlockingTaskCommand(async() => await TagContentToExcel(DetailsList));

            EditContentCommand         = StatusContext.RunNonBlockingTaskCommand <Guid>(async x => await EditContent(x));
            VisibleTagsToExcelCommand  = StatusContext.RunBlockingTaskCommand(VisibleTagsToExcel);
            SelectedTagsToExcelCommand = StatusContext.RunBlockingTaskCommand(SelectedTagsToExcel);
            ImportFromExcelCommand     =
                StatusContext.RunBlockingTaskCommand(async() => await ExcelHelpers.ImportFromExcel(StatusContext));

            StatusContext.RunFireAndForgetBlockingTaskWithUiMessageReturn(LoadData);
        }