예제 #1
0
        public ConnectionTracker(Lifetime lifetime, ILogger logger, UnityHost host, UnityEditorProtocol editorProtocol, IShellLocks locks, UnitySolutionTracker unitySolutionTracker)
        {
            // TODO: this shouldn't be up in tests until we figure out how to test unity-editor requiring features
            if (locks.Dispatcher.IsAsyncBehaviorProhibited)
            {
                return;
            }

            unitySolutionTracker.IsUnityProjectFolder.AdviseOnce(lifetime, args =>
            {
                //check connection between backend and unity editor
                locks.QueueRecurring(lifetime, "PeriodicallyCheck", TimeSpan.FromSeconds(1), () =>
                {
                    if (editorProtocol.UnityModel.Value == null)
                    {
                        myLastCheckResult = UnityEditorState.Disconnected;
                    }
                    else
                    {
                        var rdTask = editorProtocol.UnityModel.Value.GetUnityEditorState.Start(RdVoid.Instance);
                        rdTask?.Result.Advise(lifetime, result =>
                        {
                            myLastCheckResult = result.Result;
                            logger.Trace($"myIsConnected = {myLastCheckResult}");
                        });
                    }

                    logger.Trace($"Sending connection state. State: {myLastCheckResult}");
                    host.PerformModelAction(m => m.EditorState.Value = Wrap(myLastCheckResult));
                });
            });
        }
예제 #2
0
        public ConnectionTracker(Lifetime lifetime, ILogger logger, UnityHost host, UnityEditorProtocol editorProtocol, IShellLocks locks, UnitySolutionTracker unitySolutionTracker)
        {
            unitySolutionTracker.IsUnityProjectFolder.AdviseOnce(lifetime, args =>
            {
                //check connection between backend and unity editor
                locks.QueueRecurring(lifetime, "PeriodicallyCheck", TimeSpan.FromSeconds(1), () =>
                {
                    if (editorProtocol.UnityModel.Value == null)
                    {
                        myLastCheckResult = UnityEditorState.Disconnected;
                    }
                    else
                    {
                        var rdTask = editorProtocol.UnityModel.Value.GetUnityEditorState.Start(Unit.Instance);
                        rdTask?.Result.Advise(lifetime, result =>
                        {
                            myLastCheckResult = result.Result;
                            logger.Trace($"myIsConnected = {myLastCheckResult}");
                        });
                    }

                    logger.Trace($"Sending connection state. State: {myLastCheckResult}");
                    host.PerformModelAction(m => m.EditorState.Value = Wrap(myLastCheckResult));
                });
            });
        }
        public ConnectionTracker(Lifetime lifetime, ILogger logger, UnityEditorProtocol unityEditorProtocolController, IShellLocks locks, ISolution solution)
        {
            // this shouldn't be up in tests until we figure out how to test unity-editor requiring features
            if (locks.Dispatcher.IsAsyncBehaviorProhibited)
            {
                return;
            }

            //check connection between backend and unity editor
            locks.QueueRecurring(lifetime, "PeriodicallyCheck", TimeSpan.FromSeconds(1), () =>
            {
                if (unityEditorProtocolController.UnityModel.Value == null)
                {
                    myLastCheckResult = UnityEditorState.Disconnected;
                }
                else
                {
                    var rdTask = unityEditorProtocolController.UnityModel.Value.GetUnityEditorState.Start(RdVoid.Instance);
                    rdTask?.Result.Advise(lifetime, result =>
                    {
                        myLastCheckResult = result.Result;
                        logger.Trace($"myIsConnected = {myLastCheckResult}");
                    });
                }

                logger.Trace($"Sending connection state. State: {myLastCheckResult}");
                solution.GetProtocolSolution().SetCustomData("UNITY_EditorState", Wrap(myLastCheckResult));
            });
        }
        public ExternalCodeOptionsPage(
            IUIApplication environment,
            OptionsSettingsSmartContext settings,
            Lifetime lifetime,
            IShellLocks shellLocks,
            IWindowsHookManager windowsHookManager,
            FormValidators formValidators,
            IMainWindow mainWindow = null)
            : base(lifetime, environment, Pid)
        {
            _settings = settings;
            _lifetime = lifetime;
            _windowsHookManager = windowsHookManager;
            _formValidators = formValidators;
            _mainWindow = mainWindow;

            InitControls();
            shellLocks.QueueRecurring(lifetime, "Force settings merge", TimeSpan.FromMilliseconds(300.0), () => OnOk());
        }
        public ExternalCodeOptionsPage(
            IUIApplication environment,
            OptionsSettingsSmartContext settings,
            Lifetime lifetime,
            IShellLocks shellLocks,
            IWindowsHookManager windowsHookManager,
            FormValidators formValidators,
            IMainWindow mainWindow = null)
            : base(lifetime, environment, Pid)
        {
            _settings           = settings;
            _lifetime           = lifetime;
            _windowsHookManager = windowsHookManager;
            _formValidators     = formValidators;
            _mainWindow         = mainWindow;

            InitControls();
            shellLocks.QueueRecurring(lifetime, "Force settings merge", TimeSpan.FromMilliseconds(300.0), () => OnOk());
        }