コード例 #1
0
        public void btnConnectToAllPublications_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                if (this.lstAvailablePubications.Items.Count <= 0)
                {
                    throw (new Exception("No publications available to connect to"));
                }
                CF_DPE_ConnectionMode frm = new CF_DPE_ConnectionMode();

                if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    IEnumerator enumm   = this.lstAvailablePubications.Items.GetEnumerator();
                    string      pubName = "";

                    while (enumm.MoveNext())
                    {
                        pubName = System.Convert.ToString(enumm.Current);

                        this._client.ConnectToADataPublication(pubName, frm.ConnectionMode);
                        this._PublicationsConnectionsHandlersContainer.AddPublicationConnectionHandler(pubName);

                        //serialization of data
                        publicationsConnection.PublicationConnectionData publicationCnnData = new publicationsConnection.PublicationConnectionData(pubName, frm.ConnectionMode);

                        this._ClientHandlerData.AddPublicationConnectionData(publicationCnnData);
                    }
                }
                frm.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
        public void btnConnectToPublication_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                string pubName = this.GetSelectedPublicationName();
                if (pubName == null)
                {
                    throw (new Exception("No selected publication from list"));
                }
                CF_DPE_ConnectionMode frm = new CF_DPE_ConnectionMode();
                if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    this._client.ConnectToADataPublication(pubName, frm.ConnectionMode);
                    this._PublicationsConnectionsHandlersContainer.AddPublicationConnectionHandler(pubName);

                    //serialization of data
                    publicationsConnection.PublicationConnectionData publicationCnnData = new publicationsConnection.PublicationConnectionData(pubName, frm.ConnectionMode);
                    this._ClientHandlerData.AddPublicationConnectionData(publicationCnnData);
                }
                frm.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }