private void RenderSyncUI(GUIStyle sty, GUIStyle but)
        {
            if (!CheckVessel())
            {
                _flyByWire = false;
                Mode       = UIMode.SELECTED;
            }

            if (GUILayout.Button("Sync Orbits", but, GUILayout.ExpandWidth(true)))
            {
                Mode       = UIMode.SELECTED;
                _flyByWire = false;
            }

            GUILayout.EndVertical();

            GUILayout.BeginHorizontal();
            for (int i = 0; i < NumberOfPredictedSyncPoints; i++)
            {
                if (i != (int)SyncMode)
                {
                    continue;
                }

                if (GUILayout.Button(SyncMode.ToString(), but, GUILayout.ExpandWidth(true)))
                {
                    if (i == NumberOfPredictedSyncPoints - 1)
                    {
                        SyncMode = 0;
                    }
                    else
                    {
                        SyncMode = SyncMode + 1;
                    }
                }
                //GUILayout.Box(SyncMode.ToString(),but);
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginVertical();

            GUILayout.Box("Orbit		ShipToR		TgtToR ", GUILayout.ExpandWidth(true));
            for (int i = 0; i < 4; i++)
            {
                GUILayout.Box(_syncString[i]);
            }

            GUILayout.Label("Closest Approach on Orbit " + _closestApproachOrbit.ToString(), sty);
            GUILayout.Label("Min Separation (sec) : " + _minimumPredictedTimeFromTarget.ToString("f1"), sty);

            if (automation == true)
            {
                if (GUILayout.Button(_autoPhaser ? _autoPhaserState.ToString() : "Auto Sync", but, GUILayout.ExpandWidth(true)))
                {
                    _autoPhaser      = !_autoPhaser;
                    _autoPhaserState = AutoPhaserState.Step1WaitForTargetApsis;
                }
            }
        }
Exemplo n.º 2
0
        public async Task <SynchronizationReport> Execute()
        {
            var report = new SynchronizationReport(fileName, sourceFileEtag, type);

            try
            {
                AssertOperationAndLockFile();

                NotifyStart();

                Prepare();

                var localMetadata = fs.Synchronizations.GetLocalMetadata(fileName);

                bool conflictResolved;
                AssertConflictDetection(localMetadata, out conflictResolved);

                fs.SynchronizationTriggers.Apply(trigger => trigger.BeforeSynchronization(fileName, sourceMetadata, type));

                dynamic afterSynchronizationTriggerData = null;

                switch (type)
                {
                case SynchronizationType.Delete:
                    ExecuteDelete(localMetadata);
                    break;

                case SynchronizationType.Rename:
                    ExecuteRename(Rename);
                    break;

                case SynchronizationType.MetadataUpdate:
                    ExecuteMetadataUpdate();
                    break;

                case SynchronizationType.ContentUpdate:
                    await ExecuteContentUpdate(localMetadata, report).ConfigureAwait(false);

                    afterSynchronizationTriggerData = new
                    {
                        TempFileName = RavenFileNameHelper.DownloadingFileName(fileName)
                    };
                    break;

                default:
                    throw new ArgumentOutOfRangeException("type", type.ToString());
                }


                fs.SynchronizationTriggers.Apply(trigger => trigger.AfterSynchronization(fileName, sourceMetadata, type, afterSynchronizationTriggerData));

                if (conflictResolved)
                {
                    fs.ConflictArtifactManager.Delete(fileName);

                    fs.Publisher.Publish(new ConflictNotification
                    {
                        FileName = fileName,
                        Status   = ConflictStatus.Resolved
                    });
                }
            }
            catch (Exception ex)
            {
                if (ShouldAddExceptionToReport(ex))
                {
                    report.Exception = ex;

                    Log.WarnException(string.Format("Error was occurred during deletion synchronization of file '{0}' from {1}", fileName, sourceFs), ex);
                }
            }

            fs.Synchronizations.FinishSynchronization(fileName, report, sourceFs, sourceFileEtag);

            NotifyEnd();

            return(report);
        }