public void SetData(object data) { var dataProcessor = data as IDataProcessor; _dataProcessor = dataProcessor ?? throw new InvalidOperationException($"Аргумент {nameof(data)} должен наследовать интерфейс {nameof(IDataProcessor)}"); _dataProcessorInfo = new DataProcessorInfo(dataProcessor); _dataProcessor.Awake(); if (_dataProcessorInfo.Outputs.Count > 1) { throw new NotImplementedException(); } var output = _dataProcessorInfo.Outputs.Single(); _outputDataRenderer = DataRendererUtil.GetRendererFor(output.Type); _outputDataRenderer.OnUpdateRequest += RequestUpdate; _outputDataRenderer.UpdateControlsRequest += () => UpdateControlsRequest?.Invoke(); var outputObject = output.Get(); if (outputObject != null) { _outputDataRenderer.SetData(outputObject); } _dataProcessor.Updated += DataProcessorUpdated; }
private void UpdateControls() { SetControlMode(); SetViewMode(); UpdateControlsRequest?.Invoke(); }