示例#1
0
 public void SetCurrentShares(GABUser store, ICollection <SharedFolder> shares, CancellationToken?cancel = null)
 {
     using (ZPushWebServiceDevice deviceService = _connection.DeviceService)
     {
         deviceService.Execute(new AdditionalFolderSetListRequest(store, shares));
     }
 }
示例#2
0
        public void SetDeviceOptions(ZPushAccount account, SyncTimeFrame timeFrame)
        {
            try
            {
                Logger.Instance.Debug(this, "Setting sync time frame for {0} to {1}", account, timeFrame);

                // First set the server value.
                using (ZPushConnection connection = account.Connect())
                    using (ZPushWebServiceDevice deviceService = connection.DeviceService)
                    {
                        deviceService.Execute(new SetDeviceOptionsRequest(timeFrame));
                    }

                // And the local value
                account.SyncTimeFrame = timeFrame;
                Logger.Instance.Debug(this, "Set sync time frame for {0} to {1}", account, timeFrame);

                // Sync
                ThisAddIn.Instance.SendReceive(account.Account);
            }
            catch (Exception x)
            {
                Logger.Instance.Warning(this, "Exception setting sync time frame for {0} to {1}: {2}", account, timeFrame, x);
            }
        }
示例#3
0
 public ICollection <SharedFolder> GetCurrentShares(CancellationToken?cancel = null)
 {
     using (ZPushWebServiceDevice deviceService = _connection.DeviceService)
     {
         // Fetch
         return(deviceService.Execute(new AdditionalFolderListRequest()));
     }
 }
示例#4
0
        private void CheckSyncState(ZPushAccount account)
        {
            // TODO: we probably want one invocation for all accounts
            using (ZPushConnection connection = account.Connect())
            {
                // Check total size
                CheckTotalSize(connection);

                // Update sync state
                using (ZPushWebServiceDevice deviceService = connection.DeviceService)
                {
                    // Fetch
                    DeviceDetails details = deviceService.Execute(new GetDeviceDetailsRequest());
                    if (details != null)
                    {
                        bool wasSyncing = false;

                        // Create or update session
                        SyncSession session = account.GetFeatureData <SyncSession>(this, null);
                        if (session == null)
                        {
                            session = new SyncSession(this, account);
                        }
                        else
                        {
                            wasSyncing = session.IsSyncing;
                        }

                        session.Add(details);

                        // Store with the account
                        account.SetFeatureData(this, null, session);

                        if (wasSyncing != session.IsSyncing)
                        {
                            // Sync state has changed, update the schedule
                            Watcher.Sync.SetTaskSchedule(_task, account, session.IsSyncing ? CheckPeriodSync : (TimeSpan?)null);
                        }
                    }
                }
            }

            // Update the total for all accounts
            UpdateTotalSyncState();

            // Check for stalls
            CheckSyncStalled(account);
        }