Esempio n. 1
0
        public MainViewModel(IRepository repository,
                             IAppSettingsService settingsService,
                             IUserSettingsService userSettingsService,
                             ITrackingService trackingService,
                             IReleaseNotesService releaseNotesService,
                             IWindowService windowService,
                             Mediator mediator,
                             ExportFactory <DataHostViewModel> dataVMFactory,
                             ExportFactory <StatisticsHostViewModel> statisticsVMFactory,
                             ExportFactory <SettingsHostViewModel> settingsVMFactory)
        {
            this.repository          = repository;
            this.settingsService     = settingsService;
            this.userSettingsService = userSettingsService;
            this.trackingService     = trackingService;
            this.releaseNotesService = releaseNotesService;
            this.windowService       = windowService;
            this.mediator            = mediator;

            mediator.Register(MediatorMessages.SCREENSHOT_TAKEN, () =>
            {
                if (userSettingsService.AppSettings.NotifyScreenshotTaken)
                {
                    InfoContent = "Screenshot taken";
                    windowService.FlashWindow();
                }
            });

            RegisterChild(() => ProduceViewModel(dataVMFactory));
            RegisterChild(() => ProduceViewModel(statisticsVMFactory));
            RegisterChild(() => ProduceViewModel(settingsVMFactory));

            SelectedChild = GetChild <DataHostViewModel>();

            multipleUsers = repository.GetFiltered <Uzer>(u => u.ID > 0).Count() > 1;

            if (!userSettingsService.AppSettings.DisableNotifyForNewVersion)
            {
                releaseNotesService.GetReleaseNotesAsync()
                .ContinueWith(OnGetReleaseNotes, TaskContinuationOptions.NotOnFaulted);
            }
        }
        public async Task <HttpResponseMessage> Generate([FromBody] ReleaseNotesRequest releaseNotesRequest)
        {
            Argument.IsNotNull(() => releaseNotesRequest);

            var context1 = new ReleaseNotesGenerationParameters
            {
                RepositorySettings =
                {
                    Url    = releaseNotesRequest.RepositoryUrl,
                    Branch = releaseNotesRequest.RepositoryBranch
                },
                IssueTracker = { ProjectId = releaseNotesRequest.IssueTrackerProjectId }
            };

            var context = context1;

            context.AllTags = true;
            var releaseNotes = await releaseNotesService.GetReleaseNotesAsync(context);

            return(new HttpResponseMessage
            {
                Content = new JsonContent(releaseNotes)
            });
        }