コード例 #1
0
        public void SetSyncStatus(SyncStatus status)
        {
            switch (status)
            {
            case SyncStatus.Changed:
                Img_NewStatus.IsVisible     = false;
                Img_DoneUpload.IsVisible    = false;
                Img_PendingUpload.IsVisible = true;
                break;

            case SyncStatus.New:
                Img_NewStatus.IsVisible     = true;
                Img_DoneUpload.IsVisible    = false;
                Img_PendingUpload.IsVisible = false;
                break;

            case SyncStatus.Saved:
                Img_NewStatus.IsVisible     = false;
                Img_DoneUpload.IsVisible    = true;
                Img_PendingUpload.IsVisible = false;
                break;

            default:
                Img_NewStatus.IsVisible     = false;
                Img_DoneUpload.IsVisible    = false;
                Img_PendingUpload.IsVisible = false;
                break;
            }
        }
コード例 #2
0
        private void ToogleControls(SyncStatus status)
        {
            switch (status)
            {
            case SyncStatus.Started:
                SaveEnabled     = false;
                SyncEnabled     = false;
                prog.Visibility = Visibility.Visible;
                lblCurrentOperation.Visibility = Visibility.Visible;
                ckbSyncContracts.IsEnabled     = false;
                ckbSyncCusomers.IsEnabled      = false;
                ckbSyncPayments.IsEnabled      = false;
                ckbSyncProperties.IsEnabled    = false;
                ckbSyncShedPays.IsEnabled      = false;
                break;

            case SyncStatus.Completed:
                SaveEnabled     = true;
                SyncEnabled     = true;
                prog.Visibility = Visibility.Hidden;
                lblCurrentOperation.Visibility = Visibility.Hidden;
                ckbSyncContracts.IsEnabled     = true;
                ckbSyncCusomers.IsEnabled      = true;
                ckbSyncPayments.IsEnabled      = true;
                ckbSyncProperties.IsEnabled    = true;
                ckbSyncShedPays.IsEnabled      = true;
                break;

            default:
                throw new ArgumentOutOfRangeException("status");
            }
            ribbon.UpdateLayout();
            UpdateLayout();
        }
コード例 #3
0
        /// <summary>
        /// Called when the <see cref="F:Microsoft.ManagementConsole.StandardVerbs.Delete"></see> standard verb is triggered.
        /// </summary>
        /// <param name="status">An object that holds the status information.</param>
        protected override void OnDelete(SyncStatus status)
        {
            string companyId  = this.CompanyInfo.Id;
            string domainName = this.DisplayName;

            DeleteCompanyForm form = new DeleteCompanyForm(GetCompanyConfigurator(), companyId, domainName);

            if (this.SnapIn.Console.ShowDialog(form) == DialogResult.OK)
            {
                status.ReportProgress(0, 0, string.Format(SnapInResources.CompanyScopeNode_Action_Delete_Progress, domainName));

                //Thread.Sleep(10000);
                GetCompanyConfigurator().DeleteCompany(companyId, form.DeleteDatabase);

                // Refresh ServerFormView
                ServerScopeNode serverScopeNode = ((ServerScopeNode)this.Parent.Parent);

                if (serverScopeNode.ServerFormView != null && serverScopeNode.ServerFormView.ServerFeaturesControl != null)
                {
                    serverScopeNode.ServerFormView.ServerFeaturesControl.LoadDataFromConfigurator();
                }

                // Remove Current Element From Tree
                this.Parent.Children.Remove(this);
            }
        }
コード例 #4
0
 /// <summary>
 /// Handles Delete standard verb
 /// </summary>
 /// <param name="status">synchronous status used to update console</param>
 protected override void OnDelete(SyncStatus status)
 {
     foreach (ResultNode cutNode in this.SelectedNodes)
     {
         this.ResultNodes.Remove(cutNode);
     }
 }
コード例 #5
0
        private static string GetResourceString(this SyncStatus status)
        {
            switch (status)
            {
            case SyncStatus.Updating:
                return(StringRes.StatusUpdating);

            case SyncStatus.Updated:
                return(StringRes.StatusUpdated);

            case SyncStatus.Acquiring:
                return(StringRes.StatusAcquiring);

            case SyncStatus.Acquired:
                return(StringRes.StatusAcquired);

            case SyncStatus.Preparing:
                return(StringRes.StatusPreparing);

            case SyncStatus.Prepared:
                return(StringRes.StatusPrepared);

            case SyncStatus.NewVersionAvailable:
                return(StringRes.StatusNewVersionAvailable);

            case SyncStatus.OverVersion:
                return(StringRes.StatusOverVersionContent);

            case SyncStatus.OverVersionNoContent:
                return(StringRes.StatusOverVersionNoContent);

            default:
                return(string.Empty);
            }
        }
コード例 #6
0
        private void SyncUserManager(IActiveDirectoryContext adContext, Guid syncBatchGUID, User user, ManagerUser managerUser)
        {
            var managerUsers = _managerUserService.GetManagerUser(managerUser);

            if (managerUsers.Count() > 0)
            {
                var syncStatus = new SyncStatus
                {
                    ObjectGUID     = user.UserGuid,
                    ObjectName     = user.Username,
                    ObjectType     = "ManagerUser",
                    SyncBatchGUID  = syncBatchGUID,
                    SyncStatusText = "NOACTION",
                    ErrorMessage   = "Manager already exists"
                };
                _syncStatusService.Insert(syncStatus);
            }
            else
            {
                _managerUserService.Insert(managerUser);
                var syncStatus = new SyncStatus
                {
                    ObjectGUID     = user.UserGuid,
                    ObjectName     = user.Username,
                    ObjectType     = "ManagerUser",
                    SyncBatchGUID  = syncBatchGUID,
                    SyncStatusText = "INSERT"
                };
                _syncStatusService.Insert(syncStatus);
            }
            //TODO: If user has manager other than specified, may need to be deleted.
        }
コード例 #7
0
        /// <summary>
        /// OnDelete method implmentation
        /// </summary>
        protected override void OnDelete(SyncStatus status)
        {
            MessageBoxParameters messageBoxParameters = new MessageBoxParameters();

            messageBoxParameters.Caption       = "Multi-Factor Authentication";
            messageBoxParameters.Buttons       = MessageBoxButtons.YesNo;
            messageBoxParameters.DefaultButton = MessageBoxDefaultButton.Button1;
            messageBoxParameters.Icon          = MessageBoxIcon.Question;
            messageBoxParameters.Text          = "Voulez vous vraiment supprimer cet élément ?";

            if (this.SnapIn.Console.ShowDialog(messageBoxParameters) == DialogResult.Yes)
            {
                MMCRegistrationList reg = (MMCRegistrationList)SelectionData.SelectionObject;
                bool res = DeleteUserStoreData(reg);
                if (res)
                {
                    status.Complete("ok", true);
                }
                else
                {
                    status.CanCancel = true;
                    status.Complete("error", false);
                }
            }
            else
            {
                status.CanCancel = true;
                base.OnDelete(status);
            }
        }
コード例 #8
0
 public StateRawData(string id)
 {
     ID         = id;
     RawData    = "{}";
     Sync       = SyncStatus.Updated;
     OriginalId = ID;
 }
コード例 #9
0
ファイル: SyncReport.cs プロジェクト: snowdream1985/livehapi
 private SyncReport(Guid clientId, string endpoint, SyncStatus status, SynchronizeClientsResponse response,
                    string message, Exception exception, string exceptionInfo) : this(clientId, endpoint, status, response)
 {
     Message       = message;
     Exception     = exception;
     ExceptionInfo = exceptionInfo;
 }
コード例 #10
0
 /// <summary>
 /// OnSaveCustomData method implmentation
 /// </summary>
 protected override byte[] OnSaveCustomData(SyncStatus status)
 {
     try
     {
         MMCPersistenceData data = new MMCPersistenceData();
         data.Filter = MMCService.Filter;
         if (CultureInfo.DefaultThreadCurrentUICulture.LCID == CultureInfo.InstalledUICulture.LCID)
         {
             data.Language = 0;
         }
         else
         {
             data.Language = CultureInfo.DefaultThreadCurrentUICulture.LCID;
         }
         return((byte[])data);
     }
     catch (Exception ex)
     {
         MessageBoxParameters msgp = new MessageBoxParameters();
         msgp.Text    = ex.Message;
         msgp.Buttons = MessageBoxButtons.OK;
         msgp.Icon    = MessageBoxIcon.Error;
         this.Console.ShowDialog(msgp);
         return(null);
     }
 }
コード例 #11
0
        protected override void OnDelete(SyncStatus status)
        {
            var deleted   = false;
            var serverDto = GetServerDto();
            var auth      = SnapInContext.Instance.AuthTokenManager.GetAuthToken(serverDto, DisplayName);

            ActionHelper.Execute(delegate
            {
                if (ErrorMessageDisplayHelper.Confirm("Delete Tenant " + DisplayName + " permenantly?"))
                {
                    var service = ScopeNodeExtensions.GetServiceGateway(auth.ServerDto.ServerName);
                    service.Tenant.Delete(auth.ServerDto, DisplayName, auth.Token);
                    deleted = true;

                    var parent = ((ServerNode)Parent);
                    for (var i = 0; i < parent.Children.Count; i++)
                    {
                        if (parent.Children[i].DisplayName == DisplayName)
                        {
                            parent.Children.RemoveAt(i);
                            break;
                        }
                    }
                }
            }, auth);
            if (deleted)
            {
                base.OnDelete(status);
            }
        }
コード例 #12
0
        /// <summary>
        /// OnDelete method implmentation
        /// </summary>
        protected override void OnDelete(SyncStatus status)
        {
            MessageBoxParameters messageBoxParameters = new MessageBoxParameters
            {
                Caption       = "Multi-Factor Authentication",
                Buttons       = MessageBoxButtons.YesNo,
                DefaultButton = MessageBoxDefaultButton.Button1,
                Icon          = MessageBoxIcon.Question,
                Text          = res.USERSFRMCONFIRMDELETE
            };

            if (this.SnapIn.Console.ShowDialog(messageBoxParameters) == DialogResult.Yes)
            {
                MFAUserList reg  = (MFAUserList)SelectionData.SelectionObject;
                bool        xres = DeleteUserStoreData(reg);
                if (xres)
                {
                    status.Complete("ok", true);
                }
                else
                {
                    status.CanCancel = true;
                    status.Complete("error", false);
                }
            }
            else
            {
                status.CanCancel = true;
                base.OnDelete(status);
            }
        }
コード例 #13
0
        protected override void OnDelete(SyncStatus status)
        {
            if (!MMCDlgHelper.ShowConfirm(CommonConstants.GetSelectedDeleteMsg("secret keys", this.SelectedNodes.Count)))
            {
                return;
            }

            base.OnDelete(status);
            var entriesNode = this.ScopeNode as VecsStoreEntriesNode;
            var dto         = entriesNode.ServerDTO;
            var storeName   = entriesNode.StoreName;
            var storePass   = "";

            MMCActionHelper.CheckedExec(delegate()
            {
                using (var session = new VecsStoreSession(dto.VecsClient, storeName, storePass))
                {
                    foreach (ResultNode node in this.SelectedNodes)
                    {
                        var certDTO = node.Tag as Vecs.CertDTO;
                        session.DeleteCertificate(certDTO.Alias);
                    }
                }
            });
            Refresh();
        }
コード例 #14
0
        public async Task UpdateSyncStatus(IEnumerable <Guid> clientIds, SyncStatus syncStatus, string statusInfo = "")
        {
            var backLog = new List <KeyValuePair <Guid, string> >();

            foreach (var clientId in clientIds)
            {
                string sql = $@"
                            UPDATE {nameof(ClientStage)}s
                            SET
                                {nameof(ClientStage.SyncStatus)} = @SyncStatus,
                                {nameof(ClientStage.SyncStatusInfo)} = @SyncStatusInfo,
                                {nameof(ClientStage.StatusDate)}=@StatusDate
                            WHERE
                                {nameof(ClientStage.ClientId)} = @ClientId;
                          ";
                backLog.Add(new KeyValuePair <Guid, string>(clientId, sql));
            }

            using (var con = GetDbConnection())
            {
                foreach (var backLogItem in backLog)
                {
                    await con.ExecuteAsync(backLogItem.Value,
                                           new
                    {
                        ClientId       = backLogItem.Key,
                        SyncStatus     = syncStatus,
                        SyncStatusInfo = statusInfo,
                        StatusDate     = DateTime.Now
                    });
                }
            }
        }
コード例 #15
0
 internal SyncConflict(long itemId, SyncStatus syncStatus, ISyncableItemInfo localItemInfo, ISyncableItemInfo remoteItemInfo)
 {
     _itemId         = itemId;
     _syncStatus     = syncStatus;
     _remoteItemInfo = remoteItemInfo;
     _localItemInfo  = localItemInfo;
 }
コード例 #16
0
 public void Insert(SyncStatus syncStatus)
 {
     syncStatus.SyncGUID = Guid.NewGuid();
     _context.Connection.Execute(@"INSERT INTO[SyncStatus]
        ([SyncGUID]
       ,[SyncBatchGUID]
       ,[SyncStatusText]
       ,[ErrorMessage]
       ,[ObjectType]
       ,[ObjectName]
       ,[ObjectGUID])
        VALUES
        ( @SyncGUID
        , @SyncBatchGUID
        , @SyncStatusText
        , @ErrorMessage
        , @ObjectType
        , @ObjectName
        , @ObjectGUID)",
                                 new
     {
         syncStatus.SyncGUID,
         syncStatus.SyncBatchGUID,
         syncStatus.SyncStatusText,
         syncStatus.ErrorMessage,
         syncStatus.ObjectType,
         syncStatus.ObjectName,
         syncStatus.ObjectGUID
     }
                                 );
 }
コード例 #17
0
        /// <summary>
        /// OnDelete method implmentation
        /// </summary>
        /// <param name="status"></param>
        protected override void OnDelete(SyncStatus status)
        {
            MessageBoxParameters messageBoxParameters = new MessageBoxParameters();

            messageBoxParameters.Caption       = "Multi-Factor Authentication";
            messageBoxParameters.Buttons       = MessageBoxButtons.YesNo;
            messageBoxParameters.DefaultButton = MessageBoxDefaultButton.Button1;
            messageBoxParameters.Icon          = MessageBoxIcon.Question;
            messageBoxParameters.Text          = "Voulez vous vraiment supprimer cet élément ?";

            this.SelectionData.BeginUpdates();
            try
            {
                if (this.SnapIn.Console.ShowDialog(messageBoxParameters) == DialogResult.Yes)
                {
                    MMCRegistrationList reg = (MMCRegistrationList)SelectionData.SelectionObject;
                    DeleteNodes(reg);
                }
                else
                {
                    status.CanCancel = true;
                }
                base.OnDelete(status);
            }
            finally
            {
                this.SelectionData.EndUpdates();
            }
        }
コード例 #18
0
        protected override IResponse CreateResponse(UnicornControlPanelRequestPipelineArgs args)
        {
            const string SyncInProgress = "Sync in progress";

            if (Status == SyncStatus.NotStarted)
            {
                var configurations = ResolveConfigurations();
                System.Threading.Tasks.Task.Run(() => ProcessAsync(Progress, Logger, configurations))
                .ContinueWith(t =>
                {
                    if (t.Exception != null)
                    {
                        Status = SyncStatus.Finished;
                        Progress.ReportException(t.Exception);
                    }
                });
                return(new PlainTextResponse(SyncInProgress));
            }

            if (Status == SyncStatus.Started)
            {
                return(new PlainTextResponse(SyncInProgress));
            }

            string message = Logger.LogData.ToString();

            //resetting sync data
            Reset();
            // in any case, need to send 200 OK here and parse response then in script
            return(new PlainTextResponse(message));
        }
コード例 #19
0
 /// <summary>
 /// Defines actions for selection.
 /// </summary>
 /// <param name="status"></param>
 protected override void OnSelectionChanged(SyncStatus status)
 {
     this.SelectionData.BeginUpdates();
     try
     {
         if (this.SelectedNodes.Count == 0)
         {
             this.SelectionData.Clear();
         }
         else
         {
             var r = this.ResultNodes.IndexOf((ResultNode)this.SelectedNodes[0]);
             MMCRegistrationList regs = GetSelectedUsers();
             if (regs.Count > 0)
             {
                 SelectionData.Update(regs, this.SelectedNodes.Count > 1, null, null);
                 if (regs.Count == 1)
                 {
                     UpdateActionPanelItems(regs);
                     SelectionData.DisplayName = regs[0].UPN;
                 }
                 else
                 {
                     UpdateActionPanelItems(regs);
                     SelectionData.DisplayName = "Sélection multiple";
                 }
             }
         }
     }
     finally
     {
         this.SelectionData.EndUpdates();
     }
 }
コード例 #20
0
        public void UpdateSyncStatus(int taskIdentifier, SyncStatus syncStatus)
        {
            // Get the Upload
            var realm    = Realm.GetInstance();
            var syncItem = realm.All <SyncModel>().FirstOrDefault(sync => sync.TaskIdentifier == taskIdentifier);

            realm.Write(() =>
            {
                if (syncStatus == SyncStatus.Stopped)
                {
                    syncItem.Status = (int)SyncStatus.Stopped;
                }
                else if (syncStatus == SyncStatus.Started)
                {
                    syncItem.Status = (int)SyncStatus.Started;
                }
                else if (syncStatus == SyncStatus.Completed)
                {
                    syncItem.TaskIdentifier = 0;
                    syncItem.Status         = (int)SyncStatus.Completed;
                }
                else if (syncStatus == SyncStatus.Failed)
                {
                    syncItem.TaskIdentifier = null;
                    syncItem.Status         = (int)SyncStatus.Failed;
                }
            });
        }
コード例 #21
0
        public async IAsyncEnumerable <SyncJob> GetSyncJobsAsync(SyncStatus status = SyncStatus.All, bool includeDisabled = false)
        {
            var syncJobs = new List <SyncJob>();
            var table    = _tableClient.GetTableReference(_syncJobsTableName);

            var linqQuery = table.CreateQuery <SyncJob>().Where(x => x.StartDate <= DateTime.UtcNow);

            if (status != SyncStatus.All)
            {
                linqQuery = linqQuery.Where(x => x.Status == status.ToString());
            }

            if (!includeDisabled)
            {
                linqQuery = linqQuery.Where(x => x.Enabled);
            }

            TableContinuationToken continuationToken = null;

            do
            {
                var segmentResult = await table.ExecuteQuerySegmentedAsync(linqQuery.AsTableQuery(), continuationToken);

                continuationToken = segmentResult.ContinuationToken;

                foreach (var job in ApplyFilters(segmentResult.Results))
                {
                    yield return(job);
                }
            } while (continuationToken != null);
        }
コード例 #22
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (VolumeFreeSpacePercent > 100)
     {
         throw new ValidationException(ValidationRules.InclusiveMaximum, "VolumeFreeSpacePercent", 100);
     }
     if (VolumeFreeSpacePercent < 0)
     {
         throw new ValidationException(ValidationRules.InclusiveMinimum, "VolumeFreeSpacePercent", 0);
     }
     if (TierFilesOlderThanDays > 2147483647)
     {
         throw new ValidationException(ValidationRules.InclusiveMaximum, "TierFilesOlderThanDays", 2147483647);
     }
     if (TierFilesOlderThanDays < 0)
     {
         throw new ValidationException(ValidationRules.InclusiveMinimum, "TierFilesOlderThanDays", 0);
     }
     if (SyncStatus != null)
     {
         SyncStatus.Validate();
     }
     if (CloudTieringStatus != null)
     {
         CloudTieringStatus.Validate();
     }
     if (RecallStatus != null)
     {
         RecallStatus.Validate();
     }
 }
コード例 #23
0
        protected override void OnDelete(SyncStatus status)

        {
            base.OnDelete(status);

            RemoveServer();
        }
コード例 #24
0
        /// <summary>
        /// Wird beim Downloadende ausgelöst
        /// </summary>
        /// <param name="status">Status ob erfolgreich, True ist ok</param>
        private void ProfileStateSetCallback(SyncStatus status)
        {
            _syncStarted = false;
            //btnSyncStart.Enabled = true;
            switch (status)
            {
            case SyncStatus.SyncFinished:
                if (_currentSyncNode != null)
                {
                    _currentSyncNode.SelectedImageKey = "folder_finish.ico";
                    _currentSyncNode.ImageKey         = "folder_finish.ico";
                }
                break;

            case SyncStatus.SyncStopped:
                if (_currentSyncNode != null)
                {
                    _currentSyncNode.SelectedImageKey = "folder_start.ico";
                    _currentSyncNode.ImageKey         = "folder_start.ico";
                }
                break;

            case SyncStatus.SyncStarted:
                if (_currentSyncNode != null)
                {
                    _currentSyncNode.SelectedImageKey = "folder_sync.ico";
                    _currentSyncNode.ImageKey         = "folder_sync.ico";
                }
                break;
                //case 0:
            }
        }
コード例 #25
0
ファイル: DNSRecordListView.cs プロジェクト: wfu8/lightwave
        protected override void OnDelete(SyncStatus status)

        {
            if (!UIErrorHelper.Confirm(MMCUIConstants.CONFIRM_DELETE))
            {
                return;
            }



            base.OnDelete(status);

            var zoneNode = this.ScopeNode as VMDNSZoneEntryNode;

            if (zoneNode != null)

            {
                int entriesIndex = (int)this.SelectedNodes[0].Tag;

                zoneNode.DeleteRecord(this.Entries[entriesIndex]);

                var node = this.SelectedNodes[0] as ResultNode;

                this.ResultNodes.Remove(node);

                this.Refresh();
            }
        }
コード例 #26
0
 private void SyncStatusProc(SyncStatus status)
 {
     /*
      * if (status.Show && !pbSync.Visible)
      * {
      *  lbStatusSyn.Visible = true;
      *  pbSync.Visible = true;
      *
      *  pbSync.Maximum = 100;
      *  pbSync.Value = 0;
      *
      *  lbStatusSyn.Text = "Sincronizando...";
      * }
      * else
      * {
      *  lbStatusSyn.Visible = false;
      *  pbSync.Visible = false;
      * }
      *
      * if (status.Total > 0)
      * {
      *  pbSync.Maximum = status.Total;
      *  pbSync.Value = status.Atual;
      *
      *  lbStatusSyn.Text = "Sincronizando...";
      *
      *  pbSync.Invalidate();
      * }
      *
      * Application.DoEvents();
      */
 }
コード例 #27
0
        /// <summary>
        /// Called when a selection changes. The snap-in should override this method to read the updated <see cref="P:Microsoft.ManagementConsole.MmcListView.SelectedNodes"></see> property and update <see cref="T:Microsoft.ManagementConsole.SelectionData"></see> class accordingly.
        /// </summary>
        /// <param name="status">The object that holds the status information.</param>
        protected override void OnSelectionChanged(SyncStatus status)
        {
            if (this.SelectedNodes.Count == 0)
            {
                // No items are selected; clear selection data and associated actions.
                SelectionData.Clear();
                SelectionData.ActionsPaneItems.Clear();
            }
            else
            {
                StringBuilder selectedItems = new StringBuilder();

                foreach (ResultNode node in this.SelectedNodes)
                {
                    selectedItems.Append(node.DisplayName);
                    selectedItems.Append(" ");
                    selectedItems.Append(string.Join(" ", node.SubItemDisplayNames.ToArray()));
                    selectedItems.AppendLine();
                }

                SelectionData.Update(selectedItems.ToString(), this.SelectedNodes.Count > 1, null, null);

                SelectionData.ActionsPaneItems.Clear();
                SelectionData.ActionsPaneItems.Add(this.CopyToClipboardAction);
            }
        }
コード例 #28
0
        private NodeStatsEventType GetSyncEventType(SyncStatus syncStatus)
        {
            switch (syncStatus)
            {
            case SyncStatus.InitCompleted:
                return(NodeStatsEventType.SyncInitCompleted);

            case SyncStatus.InitCancelled:
                return(NodeStatsEventType.SyncInitCancelled);

            case SyncStatus.InitFailed:
                return(NodeStatsEventType.SyncInitFailed);

            case SyncStatus.Started:
                return(NodeStatsEventType.SyncStarted);

            case SyncStatus.Completed:
                return(NodeStatsEventType.SyncCompleted);

            case SyncStatus.Failed:
                return(NodeStatsEventType.SyncFailed);

            case SyncStatus.Cancelled:
                return(NodeStatsEventType.SyncCancelled);
            }

            throw new Exception($"SyncStatus not supported: {syncStatus.ToString()}");
        }
コード例 #29
0
        /// <summary>
        /// Get sync buffer status from RF access point
        /// </summary>
        /// <param name="status">return value containing the status of the buffer</param>
        /// <returns>true, if the command succeeded</returns>
        public bool GetSyncBufferStatus(out SyncStatus status)
        {
            Packet response = SendAndReceive(Packet.Create(APCommand.BM_SYNC_GET_BUFFER_STATUS, null), 1, 0);

            status = (SyncStatus)response.Data[Constants.PACKET_DATA_START];
            return(CheckResponse(response));
        }
コード例 #30
0
        private async Task SaveSyncData(IDbConnection connection, ISyncableItemInfo remoteSyncableItemInfo,
                                        SyncStatus status)
        {
            var data = JObject.Parse("{item:{itemRefs:[]}}");

            if (!remoteSyncableItemInfo.Deleted)
            {
                var request = new JObject
                {
                    { "sessionID", _remoteSessionId },
                    { "item", SyncUtil.SyncableItemInfoToJson(remoteSyncableItemInfo) }
                };
                var response = await _transport.TransportAsync(SyncEndpoint.GetItemData, request);

                data = response;
            }

            SessionDbHelper.SaveItemData(connection, remoteSyncableItemInfo, status, data);

            var itemRefs = (JArray)data["item"]["itemRefs"];

            foreach (var item in itemRefs)
            {
                ISyncableItemInfo itemRefInfo      = SyncUtil.SyncableItemInfoFromJson(item);
                ISyncableItemInfo localItemRefInfo = _store.LocateCurrentItemInfo(itemRefInfo);
                if (localItemRefInfo != null && localItemRefInfo.Deleted)
                {
                    await SaveSyncData(connection, itemRefInfo, SyncStatus.MayBeNeeded);
                }
            }
        }
コード例 #31
0
        protected override void OnSelectionChanged(SyncStatus status)
        {
            if (this.SelectedNodes.Count == 0)
            {
                this.SelectionData.Clear();
            }
            else
            {
                var state = (CertificateState)this.ScopeNode.Tag;
                this.SelectionData.Update(GetDetails(), this.SelectedNodes.Count > 1, null, null);
                this.SelectionData.ActionsPaneItems.Clear();

                if (this.ScopeNode is VMCAPersonalCertificatesNode)
                {
                    this.SelectionData.EnabledStandardVerbs = StandardVerbs.Delete;
                }

                if (SelectedNodes.Count == 1)
                {
                    this.SelectionData.ActionsPaneItems.Add(new Microsoft.ManagementConsole.Action("Show Certificate",
                                                                                                   "Shows certificate details", -1, ACTION_SHOW_CERTIFICATE));
                    if (state == CertificateState.Active)
                    {
                        this.SelectionData.ActionsPaneItems.Add(new Microsoft.ManagementConsole.Action("Revoke Certificate",
                                                                                                       "Revoke Certificate", -1, ACTION_REVOKE_CERTIFICATE));
                    }
                    this.SelectionData.ActionsPaneItems.Add(new Microsoft.ManagementConsole.Action("Show Certificate String",
                                                                                                   "Show Certificate String", -1, ACTION_SHOW_CERTIFICATE_STRING));
                }
            }
        }
コード例 #32
0
        public SparkleRepoBase(string path, SparkleBackend backend)
        {
            LocalPath          = path;
            Name               = Path.GetFileName (LocalPath);
            Backend            = backend;
            this.poll_interval = this.short_interval;

            SyncStatusChanged += delegate (SyncStatus status) {
                this.status = status;
            };

            CreateWatcher ();

            if (CurrentRevision == null)
                CreateInitialChangeSet ();

            CreateListener ();

            this.local_timer.Elapsed += delegate (object o, ElapsedEventArgs args) {
                CheckForChanges ();
            };

            this.remote_timer.Elapsed += delegate {
                bool time_to_poll = (DateTime.Compare (this.last_poll,
                    DateTime.Now.Subtract (this.poll_interval)) < 0);

                if (time_to_poll) {
                    this.last_poll = DateTime.Now;

                    if (CheckForRemoteChanges ())
                        SyncDownBase ();
                }

                // In the unlikely case that we haven't synced up our
                // changes or the server was down, sync up again
                if (HasUnsyncedChanges) {
                    SyncUpBase ();
                    SyncUpNotes ();
                }
            };

            this.remote_timer.Start ();
            this.local_timer.Start ();

            // Sync up everything that changed
            // since we've been offline
            if (AnyDifferences) {
                DisableWatching ();
                SyncUpBase ();

                while (HasUnsyncedChanges)
                    SyncUpBase ();
                EnableWatching ();
            }
        }
コード例 #33
0
        // TODO: constructor (path, url, backend)
        public SparkleRepoBase(string path, SparkleBackend backend)
        {
            LocalPath = path;
            Name      = Path.GetFileName (LocalPath);
            Backend   = backend;

            SyncStatusChanged += delegate (SyncStatus status) {
                this.status = status;
            };

            if (CurrentRevision == null) {
                CreateInitialChangeSet ();
                HasUnsyncedChanges = true;
            }

            CreateWatcher ();
            CreateListener ();

            this.local_timer.Elapsed += delegate (object o, ElapsedEventArgs args) {
                CheckForChanges ();
            };

            this.remote_timer.Elapsed += delegate {
                if (this.is_polling) {
                    if (CheckForRemoteChanges ())
                        SyncDownBase ();
                }

                if (this.is_polling && !this.listener.IsConnecting && !this.listener.IsConnected)
                    this.listener.Connect ();

                // In the unlikely case that we haven't synced up our
                // changes or the server was down, sync up again
                if (HasUnsyncedChanges)
                    SyncUpBase ();
            };

            this.remote_timer.Start ();
            this.local_timer.Start ();

            // Sync up everything that changed
            // since we've been offline
            if (AnyDifferences) {
                DisableWatching ();
                SyncUpBase ();

                while (HasUnsyncedChanges)
                    SyncUpBase ();
                EnableWatching ();
            }
        }
コード例 #34
0
        public SparkleRepoBase(string path)
        {
            LocalPath = path;
            Name      = Path.GetFileName (LocalPath);
            RemoteUrl = new Uri (SparkleConfig.DefaultConfig.GetUrlForFolder (Name));

            this.poll_interval = this.short_interval;

            SyncStatusChanged += delegate (SyncStatus status) {
                this.status = status;
            };

            this.identifier = Identifier;

            if (CurrentRevision == null)
                CreateInitialChangeSet ();

            ChangeSets = GetChangeSets ();
            CreateWatcher ();

            new Thread (
                new ThreadStart (delegate {
                    CreateListener ();
                })
            ).Start ();

            this.local_timer.Elapsed += delegate (object o, ElapsedEventArgs args) {
                CheckForChanges ();
            };

            this.remote_timer.Elapsed += delegate {
                bool time_to_poll = (DateTime.Compare (this.last_poll,
                    DateTime.Now.Subtract (this.poll_interval)) < 0);

                if (time_to_poll) {
                    this.last_poll = DateTime.Now;

                    if (HasRemoteChanges)
                        SyncDownBase ();
                }

                // In the unlikely case that we haven't synced up our
                // changes or the server was down, sync up again
                if (HasUnsyncedChanges && !IsSyncing && this.server_online)
                    SyncUpBase ();
            };
        }
コード例 #35
0
ファイル: NetworkManager.cs プロジェクト: hidetobara/Painter
        IEnumerator Connecting()
        {
            var env = ConstantEnviroment.Instance;
            string uri = env.Network.GetAddress(env.Scene.GetPort(SceneManager.GetActiveScene().name));
            Debug.Log("[Connecting] IP=" + uri + " Group=" + MyPlayerController.Instance.Group);
            var socket = new WebSocket(new Uri(uri));
            yield return StartCoroutine(socket.Connect());

            JsonHash hash = new SyncStatus() { Group = MyPlayerController.Instance.Group, Status = NetworkStatus.Join }.ToHash();
            socket.SendString(Json.Serialize(new JsonList() { hash }));

            while (true)
            {
                yield return null;
                var recv = socket.RecvString();
                Retrieve(recv);
                while(_SynchronizedQueue.Count > 0)
                {
                    Synchronized s = _SynchronizedQueue.Dequeue();
                    SyncStatus status = s as SyncStatus;
                    if (status == null) continue;

                    if (status.Status == NetworkStatus.Accept)
                    {
                        // サーバーと接続できた時
                        Synchronized.MyGroup = status.Group;	// 自分のGroupを登録
                        Synchronized.MyId = status.ShortId;	// 自分のIDを登録
                        MyPlayerController.Instance.SetID(status.Group, status.ShortId);
                        _StartTime = status.Time;	// 始まった時間
                        _WebSocket = socket;	// ソケット登録
                        Debug.Log("[Connected] Group=" + status.Group + " ID=" + Synchronized.MyId + " Time=" + _StartTime);
                        yield break;
                    }
                }
            }
        }
コード例 #36
0
ファイル: Syncer.cs プロジェクト: Radytz/DroppedBoxx
        public void Sync()
        {
            IsSyncing = true;

            SyncStatus = SyncStatus.Checking;

            //FilesUp = new List<SyncFile>();
            //FilesDown = new List<SyncFile>();
            //FilesNew = new List<MetaData>();
            //FilesSkipped = new List<SyncFile>();
            //FilesSkippedD = new List<MetaData>();

            DropBox = new DropBox();
            DropBox.UserLogin = Form1.Instance.DropBox.UserLogin;

            var syncThread = new SyncThread();
            syncThreadThread = new Thread(syncThread.Go);
            syncThreadThread.Start();
        }
コード例 #37
0
        /// <summary>
        /// Drop handler 
        /// </summary>
        /// <param name="data">shared data</param>
        /// <param name="pasteType">verbs one of {Copy | Move}</param>
        /// <param name="status">synchronous status for updating the console</param>
        /// <returns>true for success</returns>
        protected override bool OnPaste(SharedData data, DragAndDropVerb pasteType, SyncStatus status)
        {
            string displayName = "";

            // get pasted name
            data.Add(new SharedDataItem("DisplayName"));
            try
            {
               displayName = Encoding.Unicode.GetString(data.GetItem("DisplayName").GetData());
            }
            catch (Microsoft.ManagementConsole.Advanced.PrimarySnapInDataException)
            {
                return false;
            }

            // find string in buffer
            displayName = displayName.Substring(0, displayName.IndexOf("\0"));

            // update pasted on node to show the drop
            this.SelectedNodes[0].DisplayName += " ( " +  displayName + " Dropped)";

            return true;
        }
コード例 #38
0
        /// <summary>
        /// Manage shortcut menu for selection  
        /// </summary>
        /// <param name="status">asynchronous status for updating the console</param>
        protected override void OnSelectionChanged(SyncStatus status)
        {
            if (this.SelectedNodes.Count == 0)
            {
                this.SelectionData.Clear();
            }
            else
            {
                //// store dragged name
                WritableSharedData writableSharedData = new WritableSharedData();
                WritableSharedDataItem writableSharedDataItem = new WritableSharedDataItem("DisplayName", false);
                writableSharedDataItem.SetData(Encoding.Unicode.GetBytes(this.SelectedNodes[0].Tag + "\0"));
                writableSharedData.Add(writableSharedDataItem);

                // update context
                this.SelectionData.Update(null, this.SelectedNodes.Count > 1, null, writableSharedData);
                this.SelectionData.EnabledStandardVerbs = StandardVerbs.Copy | StandardVerbs.Paste | StandardVerbs.Refresh;

                //Set SetAllowedClipboardFormatIdsForPaste so that ListView only accepts clipboard objects that support "DisplayName" clipboard format
                this.SelectionData.SetAllowedClipboardFormatIdsForPaste(new string[] { "DisplayName" });
            }
        }
コード例 #39
0
ファイル: RepoBase.cs プロジェクト: j2m2/CmisSync
        /// <summary>
        /// Restart syncing.
        /// </summary>
        public virtual void Resume()
        {
            Status = SyncStatus.Idle;
            RepoInfo.IsSuspended = false;

            //Get configuration
            Config config = ConfigManager.CurrentConfig;
            CmisSync.Lib.Config.SyncConfig.Folder syncConfig = config.getFolder(this.Name);
            syncConfig.IsSuspended = false;
            config.Save();
        }
コード例 #40
0
ファイル: SyncThread.old.cs プロジェクト: Radytz/DroppedBoxx
 private void UpdateSyncStatuses(SyncStatus syncStatus)
 {
     UpdateSyncStatuses(null, syncStatus);
 }
コード例 #41
0
ファイル: StatusIcon.cs プロジェクト: emrul/CmisSync
 private void setSyncItemState(ImageMenuItem syncitem, SyncStatus status)
 {
     switch (status)
     {
         case SyncStatus.Idle:
             (syncitem.Child as Label).Text = CmisSync.Properties_Resources.PauseSync;
             syncitem.Image = new Image (UIHelpers.GetIcon ("media_playback_pause", 12));
             break;
         case SyncStatus.Suspend:
             (syncitem.Child as Label).Text = CmisSync.Properties_Resources.ResumeSync;
             syncitem.Image = new Image (UIHelpers.GetIcon ("media_playback_start", 12));
             break;
     }
 }
コード例 #42
0
 public CalendarItem()
 {
     SyncStatus = new SyncStatus();
 }
コード例 #43
0
        /// <summary>
        /// Manage shortcut menu for selection  
        /// </summary>
        /// <param name="status">status for updating the console</param>
        protected override void OnSelectionChanged(SyncStatus status)
        {
            if (this.SelectedNodes.Count == 0)
            {
                this.SelectionData.Clear();
            }
            else
            {
                this.SelectionData.Update(null, this.SelectedNodes.Count > 1, null, null);
                this.SelectionData.EnabledStandardVerbs = StandardVerbs.Delete | StandardVerbs.Refresh;

                // rename is only for single node
                if (this.SelectedNodes.Count == 1)
                {
                    this.SelectionData.EnabledStandardVerbs = this.SelectionData.EnabledStandardVerbs | StandardVerbs.Rename;
                }
            }
        }
コード例 #44
0
ファイル: RepoBase.cs プロジェクト: prignony/CmisSync
 /// <summary>
 /// Stop syncing momentarily.
 /// </summary>
 public void Suspend()
 {
     Status = SyncStatus.Suspend;
 }
コード例 #45
0
ファイル: RepoBase.cs プロジェクト: prignony/CmisSync
 /// <summary>
 /// Restart syncing.
 /// </summary>
 public void Resume()
 {
     Status = SyncStatus.Idle;
 }
コード例 #46
0
ファイル: StatusIcon.cs プロジェクト: j2m2/CmisSync
 private void setSyncItemState(NSMenuItem item, SyncStatus status) {
     switch (status)
     {
         case SyncStatus.Idle:
             item.Title = Properties_Resources.PauseSync;
             item.Image = this.pause_image;
             break;
         case SyncStatus.Suspend:
             item.Title = Properties_Resources.ResumeSync;
             item.Image = this.resume_image;
             break;
     }
     item.Image.Size = new SizeF(16, 16);
 }
コード例 #47
0
ファイル: Syncer.cs プロジェクト: Radytz/DroppedBoxx
        public void SyncFinished()
        {
            IsSyncing = false;
            LastSync = DateTime.Now;
            SyncStatus = SyncStatus.Nothing;

            Form1.Instance.DropBox.BytesRecieved += DropBox.BytesRecieved;
            Form1.Instance.DropBox.BytesSent += DropBox.BytesSent;

            syncThreadThread = null;
        }
コード例 #48
0
 /// <summary>
 /// Handles rename standard verb
 /// </summary>
 /// <param name="newText">name being changed to</param>
 /// <param name="status">asynchronous status used to update console</param>
 protected override void OnRename(string newText, SyncStatus status)
 {
     ResultNode resultNode = (ResultNode)this.SelectedNodes[0];
     resultNode.DisplayName = newText;
 }
コード例 #49
0
        public SparkleRepoBase(string name )
        {
            Name      = name;
            //LocalPath = path;
            //Name      = Path.GetFileName (LocalPath);
            Url       = new Uri (SparkleConfig.DefaultConfig.GetUrlForFolder (Name));

            string custom_path = SparkleConfig.DefaultConfig.GetFolderOptionalAttribute (Name, "path");

            if (custom_path != null)
                LocalPath = Path.Combine (custom_path, Name);
            else
                LocalPath = Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, Name);

            this.poll_interval = this.short_interval;

            SyncStatusChanged += delegate (SyncStatus status) {
                this.status = status;
            };

            if (CurrentRevision == null)
                CreateInitialChangeSet ();

            this.identifier = Identifier;

            CreateWatcher ();
            CreateListener ();

            this.local_timer.Elapsed += delegate (object o, ElapsedEventArgs args) {
                CheckForChanges ();
            };

            this.remote_timer.Elapsed += delegate {
                bool time_to_poll = (DateTime.Compare (this.last_poll,
                    DateTime.Now.Subtract (this.poll_interval)) < 0);

                if (time_to_poll) {
                    this.last_poll = DateTime.Now;

                    if (HasRemoteChanges)
                        SyncDownBase ();
                }

                // In the unlikely case that we haven't synced up our
                // changes or the server was down, sync up again
                if (HasUnsyncedChanges && !IsSyncing && this.server_online)
                    SyncUpBase ();
            };
        }
コード例 #50
0
 /// <summary>
 /// Define actions for selection  
 /// </summary>
 /// <param name="status">status for updating the console</param>
 protected override void OnSelectionChanged(SyncStatus status)
 {
     if (this.SelectedNodes.Count == 0)
     {
         this.SelectionData.Clear();
     }
     else
     {
         this.SelectionData.Update(GetSelectedUsers(), this.SelectedNodes.Count > 1, null, null);
         this.SelectionData.ActionsPaneItems.Clear();
         this.SelectionData.ActionsPaneItems.Add(new Action("Show Selected", "Shows list of selected Users.", -1, "ShowSelected"));
     }
 }
コード例 #51
0
ファイル: StatusIcon.cs プロジェクト: emrul/CmisSync
 private void setSyncItemState(ToolStripMenuItem pauseItem, ToolStripMenuItem syncItem, SyncStatus status)
 {
     switch (status)
     {
         case SyncStatus.Idle:
             pauseItem.Text = CmisSync.Properties_Resources.PauseSync;
             pauseItem.Image = UIHelpers.GetBitmap("media_playback_pause");
             syncItem.Enabled = true;
             break;
         case SyncStatus.Suspend:
             pauseItem.Text = CmisSync.Properties_Resources.ResumeSync;
             pauseItem.Image = UIHelpers.GetBitmap("media_playback_start");
             syncItem.Enabled = false;
             break;
     }
 }
コード例 #52
0
 /// <summary>
 /// Do any cleanup. In this case Stop listening for scope node events
 /// </summary>
 /// <param name="status"></param>
 protected override void OnShutdown(SyncStatus status)
 {
     ((NotifyingScopeNode)this.ScopeNode).Changed -= new NotifyingScopeNode.ChangedDelegate(OnScopeNodeChange);
 }
コード例 #53
0
 public static SyncStatusFormHelper GetFromStatus(SyncStatus status)
 {
     return helpers.First(x => x.Status == status);
 }
コード例 #54
0
ファイル: Indexer.cs プロジェクト: KalliopeMedia/KalliopeSync
 private void AddToIndex(string path, FileInfo fileInfo, CloudBlockBlob blob, SyncStatus status)
 {
     this.Index.Add(path,
         new IndexItem
         {
             Path = path,
             File = fileInfo,
             Blob = blob,
             Status = status
         });
 }
コード例 #55
0
ファイル: SyncThread.old.cs プロジェクト: Radytz/DroppedBoxx
 private void UpdateSyncStatuses(string fileName, SyncStatus syncStatus)
 {
     //Set the syncer things
     if (!string.IsNullOrEmpty(fileName)) Syncer.Instance.CurrentFileName = fileName;
     Syncer.Instance.SyncStatus = syncStatus;
     //GUI AWAY!
     Form1.Instance.ShowSyncStatus();
 }
コード例 #56
0
 /// <summary>
 /// create SyncStatusHelper
 /// </summary>
 /// <param name="status"></param>
 /// <param name="infControls">controls that should be displayed when the associated Status is active</param>
 private SyncStatusFormHelper(SyncStatus status, List<Control> infControls)
 {
     Status = status;
     InfControls = infControls;
 }
コード例 #57
0
ファイル: RepoBase.cs プロジェクト: j2m2/CmisSync
        /// <summary>
        /// Stop syncing momentarily.
        /// </summary>
        public void Suspend()
        {
            Status = SyncStatus.Suspend;
            RepoInfo.IsSuspended = true;

            //Get configuration
            Config config = ConfigManager.CurrentConfig;
            CmisSync.Lib.Config.SyncConfig.Folder syncConfig = config.getFolder(this.Name);
            syncConfig.IsSuspended = true;
            config.Save();
        }
コード例 #58
0
ファイル: SparkleRepoQS.cs プロジェクト: adaptive/qloudsync
        public override bool SyncDown()
        {
            try
            {
                if (Status == SyncStatus.Idle)
                {
                    Thread downThread = new Thread (DownThreadMethod);
                    Status = SyncStatus.SyncDown;

                    double percentage = 0;
                    finished = false;
                    downThread.Start();
                    double repo_InitialSize = LocalRepo.Size;

                    while (percentage < 100)
                    {
                        if (finished)
                            break;
                        double downSize = DownloadSynchronizer.SyncSize;
                        double repoSize = LocalRepo.Size-repo_InitialSize;

                        if (downSize != 0)
                            percentage = (repoSize / downSize)*100;
                        base.OnProgressChanged (percentage, "0");
                        Thread.Sleep (1000);
                    }
                    BacklogSynchronizer.GetInstance().Write();
                    LastTimeRepo = DateTime.Now;
                    Status = SyncStatus.Idle;
                }
            }
            catch (Exception e)
            {
                Status = SyncStatus.Idle;
                Logger.LogInfo ("Repo", e);
                return false;
            }
            return true;
        }
コード例 #59
0
 /// <summary>
 /// Get sync buffer status from RF access point
 /// </summary>
 /// <param name="status"></param>
 /// <returns></returns>
 public bool GetSyncBufferStatus(out SyncStatus status)
 {
     Packet response = SendAndReceive(Packet.Create(APCommand.BM_SYNC_GET_BUFFER_STATUS, null), 1, 0);
     status = (SyncStatus)response.Data[Constants.PACKET_DATA_START];
     return CheckResponse(response);
 }
コード例 #60
0
ファイル: SparkleRepoQS.cs プロジェクト: adaptive/qloudsync
        public override bool SyncUp()
        {
            try
            {
                if (Status == SyncStatus.Idle)
                {

                    Status = SyncStatus.SyncUp;

                    UpThreadMethod();
                    controlador = 0;
                    Status = SyncStatus.Idle;
                }
            }
            catch(Exception e)
            {
                Logger.LogInfo ("Sync", e);
                return false;
            }
            return true;
        }