Beispiel #1
0
        /// <summary>
        /// 同步线程方法
        /// </summary>
        public void threadSync()
        {
            //setSyncFormFileStatus(SyncResult.getSyncFileResult(userLocalInfo.SyncPath), SyncResult.FileSyncStatus.Fail);
            while (true)
            {
                try
                {
                    //setCloudDiskFormSyncLabel("正在尝试同步");
                    int    tempExitCode = CMDComand.syncDirectory(userLocalInfo.SyncPath, userInfo.UserID, userInfo.Password, userInfo.SyncServerAddress);
                    string syncResult   = SyncResult.getSyncResult();
                    if (tempExitCode == 0)
                    {
                        setCloudDiskFormSyncLabel(syncResult);

                        /*
                         * if (syncResult.Equals(SyncResult.RESULT_SYNC_SUCCESS))
                         * {
                         *  //setSyncFormFileStatus(SyncResult.getSyncFileResult(userLocalInfo.SyncPath), SyncResult.FileSyncStatus.Success);
                         * }
                         * else
                         * {
                         *  //setSyncFormFileStatus(SyncResult.getSyncFileResult(userLocalInfo.SyncPath), SyncResult.FileSyncStatus.Fail);
                         * }
                         */
                    }
                    else
                    {
                        setCloudDiskFormSyncLabel("同步进程未能正常执行");
                        //setSyncFormFileStatus(SyncResult.getSyncFileResult(userLocalInfo.SyncPath), SyncResult.FileSyncStatus.Fail);
                    }
                    Thread.Sleep(2000);
                    /* 清除同步记录 */
                    SyncResult.clearSyncResult();
                    if (!isAutoSync)
                    {
                        return;
                    }
                }
                catch (Exception e)
                {
                    Reporter.reportBug(e.ToString());
                }
            }
        }