示例#1
0
        private bool SyncConfigAndRestartTask()
        {
            bool isNeedRestartTask, isNeedRefreshView, channelEnabled;

            _channelViewManager.SyncChannelConfig(out isNeedRestartTask, out isNeedRefreshView, out channelEnabled);
            if (!channelEnabled)
            {
                _scopeTask.Stop();
                Clear();
                _funcTask.Stop();
            }
            else
            {
                if (isNeedRestartTask || !_scopeTask.TaskRunning)
                {
                    _scopeTask.Stop();
                    _funcTask.Stop();
                    Clear();
                    Thread.Sleep(100);
                    _globalInfo.AITask.ClearChannels();
                    ApplyCommonConfig();
                    _channelViewManager.ApplyChannelConfig();
                    RefreshMeasureChannelItems();
                    _scopeTask.Start();
                    _funcTask.Start();
                }
            }

            return(channelEnabled);
        }
示例#2
0
        private async Task <bool> SyncConfigAndRestartTask()
        {
            bool isNeedRestartTask, isNeedRefreshView, channelEnabled;

            _channelViewManager.SyncChannelConfig(out isNeedRestartTask, out isNeedRefreshView, out channelEnabled);
            if (!channelEnabled)
            {
                await this._scopeTask.Stop();

                Clear();
                await this._functionTask.Stop();

                await this._measureTask.Stop();
            }
            else
            {
                if (isNeedRestartTask || !this._scopeTask.TaskRunning)
                {
                    await StopTask();

                    Clear();
                    Thread.Sleep(Constants.RestartDelayTime);
                    this._globalInfo.AITask.ClearChannels();
                    ApplyCommonConfig();
                    this._channelViewManager.ApplyChannelConfig();
                    RefreshMeasureChannelItems();
                    this._scopeTask.Start();
                    this._functionTask.Start();
                    this._measureTask.Start();
                }
            }
            return(channelEnabled);
        }