Ejemplo n.º 1
0
    private protected async Task OpenAsync(CancellationToken cancellationToken = default)
    {
        if (State != FbServiceState.Closed)
        {
            throw new InvalidOperationException("Service already Open.");
        }
        if (string.IsNullOrEmpty(_options.UserID))
        {
            throw new InvalidOperationException("No user name was specified.");
        }
        if (string.IsNullOrEmpty(_options.Password))
        {
            throw new InvalidOperationException("No user password was specified.");
        }

        try
        {
            if (_svc == null)
            {
                _svc = await ClientFactory.CreateServiceManagerAsync(_options, cancellationToken).ConfigureAwait(false);
            }
            await _svc.AttachAsync(BuildSpb(), _options.DataSource, _options.Port, ServiceName, _options.CryptKey, cancellationToken).ConfigureAwait(false);

            _svc.WarningMessage = OnWarningMessage;
            State = FbServiceState.Open;
        }
        catch (Exception ex)
        {
            throw FbException.Create(ex);
        }
    }
Ejemplo n.º 2
0
    private protected void Open()
    {
        if (State != FbServiceState.Closed)
        {
            throw new InvalidOperationException("Service already Open.");
        }
        if (string.IsNullOrEmpty(_options.UserID))
        {
            throw new InvalidOperationException("No user name was specified.");
        }
        if (string.IsNullOrEmpty(_options.Password))
        {
            throw new InvalidOperationException("No user password was specified.");
        }

        try
        {
            if (_svc == null)
            {
                _svc = ClientFactory.CreateServiceManager(_options);
            }
            _svc.Attach(BuildSpb(), _options.DataSource, _options.Port, ServiceName, _options.CryptKey);
            _svc.WarningMessage = OnWarningMessage;
            State = FbServiceState.Open;
        }
        catch (Exception ex)
        {
            throw FbException.Create(ex);
        }
    }
Ejemplo n.º 3
0
        public RInteractiveWindowVisualComponent(IInteractiveWindow interactiveWindow, IVisualComponentContainer <IInteractiveWindowVisualComponent> container)
        {
            InteractiveWindow = interactiveWindow;
            Container         = container;

            var textView = interactiveWindow.TextView;

            Controller = ServiceManagerBase.GetService <ICommandTarget>(textView);
            Control    = textView.VisualElement;
            interactiveWindow.Properties.AddProperty(typeof(IInteractiveWindowVisualComponent), this);
        }
Ejemplo n.º 4
0
        public RHistoryWindowVisualComponent(ITextBuffer historyTextBuffer, IRHistoryProvider historyProvider, ITextEditorFactoryService textEditorFactory, IVisualComponentContainer <IRHistoryWindowVisualComponent> container)
        {
            _container = container;
            _history   = historyProvider.GetAssociatedRHistory(historyTextBuffer);

            TextView   = CreateTextView(historyTextBuffer, textEditorFactory);
            Control    = textEditorFactory.CreateTextViewHost(TextView, false).HostControl;
            Controller = ServiceManagerBase.GetService <ICommandTarget>(TextView);

            TextView.Selection.SelectionChanged += TextViewSelectionChanged;
        }
Ejemplo n.º 5
0
 private protected void Close()
 {
     if (State != FbServiceState.Open)
     {
         return;
     }
     try
     {
         _svc.Detach();
         _svc  = null;
         State = FbServiceState.Closed;
     }
     catch (Exception ex)
     {
         throw FbException.Create(ex);
     }
 }
        public RInteractiveWindowVisualComponent(IInteractiveWindow interactiveWindow, IVisualComponentContainer <IInteractiveWindowVisualComponent> container, IRSessionProvider sessionProvider, ICoreShell shell)
        {
            InteractiveWindow = interactiveWindow;
            Container         = container;

            _sessionProvider = sessionProvider;
            _shell           = shell;
            sessionProvider.BrokerStateChanged += OnBrokerChanged;

            var textView = interactiveWindow.TextView;

            Controller = ServiceManagerBase.GetService <ICommandTarget>(textView);
            Control    = textView.VisualElement;
            interactiveWindow.Properties.AddProperty(typeof(IInteractiveWindowVisualComponent), this);

            UpdateWindowTitle(_sessionProvider.IsConnected);
        }
Ejemplo n.º 7
0
    private protected async Task CloseAsync(CancellationToken cancellationToken = default)
    {
        if (State != FbServiceState.Open)
        {
            return;
        }
        try
        {
            await _svc.DetachAsync(cancellationToken).ConfigureAwait(false);

            _svc  = null;
            State = FbServiceState.Closed;
        }
        catch (Exception ex)
        {
            throw FbException.Create(ex);
        }
    }
Ejemplo n.º 8
0
		public virtual void OnValidate() {
			
			if (Application.isPlaying == true) return;
			
			if (this.serviceManager == null) this.serviceManager = this.GetComponent<ServiceManagerBase>();
			
		}