public HttpResponseMessage Synchronize([FromBody] SynchronizationOptions options)
        {
            if (Repository.GetStatus().SynchronizationState != SynchronizationState.Idle)
            {
                return(Request.CreateResponse(HttpStatusCode.Conflict, "Synchronization is already in progress."));
            }

            if (options == null)
            {
                options = new SynchronizationOptions();
            }

            TaskRunner.QueueBackgroundWorkItem(async cancellationToken =>
            {
                var registration = cancellationToken.Register(
                    UserRequestedCancellationTokenSource.Cancel);

                using (registration)
                {
                    await Repository.SynchronizeWithFileSystem(
                        options.Mode,
                        UserRequestedCancellationTokenSource.Token);
                }
            });

            return(Request.CreateResponse(HttpStatusCode.Accepted));
        }
Beispiel #2
0
        /**
         * Speichert die Optionen ab
         */
        private void SaveSynchronizationOptions()
        {
            SynchronizationOptions so = OptionsAccess.SynchronizationOptions;

            if (this.checkBoxOnlyInsert.IsChecked == null || this.checkBoxOnlyInsert.IsChecked == false)
            {
                so.OnlyInsert = false;
            }
            else
            {
                so.OnlyInsert = true;
            }
            OptionsAccess.SynchronizationOptions = so;

            DialogResult = true;
        }
Beispiel #3
0
        /**
         * Aktualisiert die Optionen in der Ansicht
         */
        private void UpdateSynchronizationOptionsView()
        {
            SynchronizationOptions so = OptionsAccess.SynchronizationOptions;

            this.checkBoxOnlyInsert.IsChecked = so.OnlyInsert;
        }