예제 #1
0
 private void onConfigure(UploaderViewModelConfiguration config)
 {
     if (_isConfigurating)
     {
         return;
     }
     Task.Run(() => configureAsync(config));
 }
예제 #2
0
        private async Task configureAsync(UploaderViewModelConfiguration config)
        {
            _isConfigurating = true;

            try {
                if (await Waiter.WaitUntilConditionSetsTrue(() => !IsBusy, 5, TimeSpan.FromSeconds(1f)) == false)
                {
                    return;
                }

                IsEnabled = config.IsEnabled;

                if (!config.IsEnabled)
                {
                    return;
                }

                if (await Waiter.WaitUntilConditionSetsTrue(() => _pullersController.Postponed.Items.Any(), 5,
                                                            TimeSpan.FromSeconds(1f)) == false)
                {
                    return;
                }

                if (config.DateOverride == -1)
                {
                    await fillMissing(_pullersController.Postponed.Items);

                    var firstMissed = MissingDates.FirstOrDefault();
                    if (firstMissed == default(int))
                    {
                        return;
                    }
                    DateUnix = firstMissed;
                }
                else
                {
                    DateUnix = config.DateOverride;
                }
            }
            finally {
                _isConfigurating = false;
            }
        }