예제 #1
0
        private void InitRPC()
        {
            string servidor = "";
            try
            {
                servidor = mW.getFromConfigFile("DictionaryServer");
            }
            catch
            {
                servidor = mainW.defaultDictionaries;
                mW.updateReplaceConfigFile("DictionaryServer", servidor); // 1st exec ... maybe xD
            }
            dictAddr.Text = servidor;

            cliente = new RPC_Client(servidor, 26108);
            if (cliente.Connect())
            {
                dic = cliente.GetDictionaries();
                cliente.Disconnect();
                foreach (string s in dic)
                    if (!s.Equals("")) listBox4.Items.Add(s);
            }
            listBox4.SelectedIndexChanged += new EventHandler(listBox4_SelectedIndexChanged);
            dataGridView2.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(dataGridView2_CellValueChanged);
            addDictText.KeyPress += new System.Windows.Forms.KeyPressEventHandler(addDictText_KeyPress);
            estadoConexion.Tick += new EventHandler(estadoConexion_Tick);
            estadoConexion.Interval = 1000;
            estadoConexion.Enabled = true;
        }
예제 #2
0
 private void button6_Click(object sender, EventArgs e)
 {
     RPC_Client test = new RPC_Client(dictserv.Text, 26108);
     if (test.Connect())
     {
         MessageBox.Show("Servidor de diccionarios conectado con éxito.", mainW.appTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
         test.Disconnect();
     }
     else
         MessageBox.Show("No se ha podido establecer la conexión con el servidor de diccionarios.", mainW.appTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
 }