Exemplo n.º 1
0
        public async Task <ResponseContainer> MetadataTopFolder(SynchroManager _manager, Boolean _reentrant)
        {
            String _request = API_METADATA + "/sandbox?access_token=" + Token;
            HttpResponseMessage _response = await SendRequest(_request);

            if (_response != null)
            {
                if (_response.StatusCode == HttpStatusCode.OK)
                {
                    return(await Serialization.DeserializeHttpToJson <ResponseContainer>(_response.Content) as ResponseContainer);
                }
                else if ((_response.StatusCode == HttpStatusCode.Unauthorized) || (_response.StatusCode == HttpStatusCode.NotFound))
                {
                    if (_reentrant)
                    {
                        await Login();
                    }
                    //return await MetadataTopFolder(_manager, false);

                    return(null);
                }
                else
                {
                    ManageError(_response.StatusCode);
                }
            }
            return(null);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Appelé lorsque l'exécution de l'application est suspendue.  L'état de l'application est enregistré
        /// sans savoir si l'application pourra se fermer ou reprendre sans endommager
        /// le contenu de la mémoire.
        /// </summary>
        /// <param name="sender">Source de la requête de suspension.</param>
        /// <param name="e">Détails de la requête de suspension.</param>
        private async void OnSuspending(object sender, SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();

            // stop current uploads
            SynchroManager.CancelAll();
            await SuspensionManager.SaveAsync();

            deferral.Complete();
        }
Exemplo n.º 3
0
        private async Task SaveConf()
        {
            if (_importInProgress)
            {
                return;
            }

            if (TripRef.Sample)
            {
                Toast.DisplayTwoLines(_res.GetString("SampleMode"), _res.GetString("NoSampleModification"), "Icons/toastImageAndText.png");
                return;
            }

            _changeInProgress = false;

            StartImport();

            // modification of summary from ViewHome only
            if (PageRef is ViewHome)
            {
                TripSummaryRef.FolderTopName           = TripName.Text;
                TripSummaryRef.LocationMain            = TripName.Text;
                TripSummaryRef.LocationFromTo          = TripLocation.Text;
                TripSummaryRef.SyncDropbox.Requested   = (bool)ChkDropbox.IsChecked;
                TripSummaryRef.SyncDropbox.Compression = SynchroManager.IntToCompr(ComboDropbox.SelectedIndex);
                TripSummaryRef.SyncUsb.Requested       = (bool)ChkUsb.IsChecked;
                TripSummaryRef.SyncUsb.Compression     = SynchroManager.IntToCompr(ComboUsb.SelectedIndex);

                // save summary
                await(PageRef as ViewHome).SaveSummary();
            }

            TripRef.Summary.FolderTopName = TripName.Text;

            // modification of Trip
            foreach (AlbumConfUserControl _albumConf in listAlbums)
            {
                if (_albumConf.AlbumRef.DisplayName != _albumConf.NameTopRef.Text)
                {
                    // was changed bu user
                    _albumConf.AlbumRef.DisplayName              = _albumConf.NameTopRef.Text;
                    _albumConf.AlbumRef.Summary.StrLocation      = _albumConf.NameTopRef.Text;
                    _albumConf.AlbumRef.Summary.StrLocationShort = _albumConf.NameTopRef.Text;
                }
                _albumConf.AlbumRef.DateArrival     = _albumConf.DateTopRef.Date.Date;
                _albumConf.AlbumRef.PositionPresent = (Boolean)_albumConf.CheckBoxRef.IsChecked;
            }

            await TripRef.Update(true, false, null, null, null, this);
        }
Exemplo n.º 4
0
        private void UpdateCheckSync(SynchroHandle _handle, ComboBox _comboBox, CheckBox _checkBox)
        {
            if (_handle.Compression == SynchroManager.ComprLevel.Undefined)
            {
                _handle.Compression = SynchroManager.ComprLevel.Original;
            }

            _comboBox.SelectedIndex = SynchroManager.ComprToInt(TripSummaryRef.SyncUsb.Compression);
            _comboBox.Visibility    = (Boolean)_checkBox.IsChecked ? Visibility.Visible : Visibility.Collapsed;

            if ((TripRef.Sample) || !(PageRef is ViewHome))
            {
                _comboBox.IsEnabled = false;
                _checkBox.IsEnabled = false;
            }
        }
Exemplo n.º 5
0
 private void ComboUsb_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     TripSummaryRef.SyncUsb.Compression = SynchroManager.IntToCompr((sender as ComboBox).SelectedIndex);
     NotifyChange();
 }
Exemplo n.º 6
0
 public void AppInit()
 {
     AppSettings    = new Settings();
     SynchroManager = new SynchroManager(AppSettings);
 }