Exemple #1
0
        protected override void OnClosed(EventArgs e)
        {
            if (this.expertHost != null)
            {
                this.expertHost.UnInitialize();
                this.expertHost = null;
            }
            if (this.client != null)
            {
                this.SessionCheckBox.Enabled = false;

                if (this.platform != null)
                {
                    this.platform.UnRegisterSource(SourceTypeEnum.HighPriorityLiveFullProvider, this.client.ProxyTransportInfo);
                }

                this.client.Stop(out this.message);
                this.client = null;
            }

            if (this.platform != null)
            {
                this.platform = null;
            }


            base.OnClosed(e);
        }
Exemple #2
0
        protected virtual void SessionCheckBox_CheckedChanged(object sender, EventArgs e)
        {
            if (this.SessionCheckBox.Checked)
            {
                if (this.expertHost == null)
                {
                    if (platform.RegisterComponent(this.expertHost = new RemoteExpertHost(this.ExpertName, this.expertType)))
                    {
                        ISessionDataProvider provider = this.expertHost.CreateRemoteExpertSession(
                            new DataSessionInfo(
                                this.sessionGuid = Guid.NewGuid(),
                                this.SessionName,
                                new Symbol(this.SymbolName),
                                this.LotSize,
                                this.DecimalPlaces
                                ),
                            this.clientID
                            );

                        if (provider != null)
                        {
                            provider.ObtainDataBarProvider(TimeSpan.FromMinutes(1));

                            this.SessionNameTextBox.Enabled   = false;
                            this.SymbolsComboBox.Enabled      = false;
                            this.LotTextBox.Enabled           = false;
                            this.DecimalPlacesTextBox.Enabled = false;
                            this.Message = "Session Connected";
                        }
                    }
                }
            }
            else
            {
                if (this.expertHost != null)
                {
                    this.expertHost.UnInitialize();
                    this.expertHost = null;

                    this.Message = "Session Lost";
                }
                this.SessionNameTextBox.Enabled   = true;
                this.SymbolsComboBox.Enabled      = true;
                this.LotTextBox.Enabled           = true;
                this.DecimalPlacesTextBox.Enabled = true;
            }
        }