Exferia/Exferia_Hermes/Test/Form2.cs

82 lines
2.5 KiB
C#

using Exferia_Aplicacion.General;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
namespace Test
{
public partial class Form2 : Form
{
private string g_str_RUTA = Variables.G_STR_LIBRERIA_RUTAINICIAL + @"\XML_DatosPrueba.xml";
public Form2(string _str_Servidor, string _str_BaseDatos, string _str_Usuario, string _str_Clave, string _str_IdUsuario)
{
InitializeComponent();
txt_Servidor.Text = _str_Servidor;
txt_BaseDatos.Text = _str_BaseDatos;
txt_Usuario.Text = _str_Usuario;
txt_Clave.Text = _str_Clave;
txt_IdUsuario.Text = _str_IdUsuario;
//Se pone asi para que se muestre el texto en tooltip pero no intente abrir el .htm
//helpProvider1.SetShowHelp(txt_Servidor, false);
//helpProvider1.SetHelpString(txt_Servidor, "En este cuadro de texto se graba el nombre del servidor");
}
private void btn_Actualizar_Click(object sender, EventArgs e)
{
XmlDocument XDox = new XmlDocument();
XDox.Load(g_str_RUTA);
XmlNode obj_NodoPadre = XDox.GetElementsByTagName("Datos")[0];
obj_NodoPadre["servidor"].InnerText = txt_Servidor.Text;
obj_NodoPadre["basedatos"].InnerText = txt_BaseDatos.Text;
obj_NodoPadre["usuario"].InnerText = txt_Usuario.Text;
obj_NodoPadre["clave"].InnerText = txt_Clave.Text;
obj_NodoPadre["idusuario"].InnerText = txt_IdUsuario.Text;
XDox.Save(g_str_RUTA);
Application.Restart();
this.Close();
}
private void Form2_FormClosing(object sender, FormClosingEventArgs e)
{
Application.Exit();
}
/* #region Ayuda
#region Para la Ayuda
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
private static extern IntPtr SendMessage(IntPtr hWnd, Int32 Msg, IntPtr wParam, IntPtr lParam);
private const int WM_SYSCOMMAND = 0x112;
private const int SC_CONTEXTHELP = 0xf180;
#endregion
#endregion
private void button1_Click(object sender, EventArgs e)
{
button1.Capture = false;
SendMessage(this.Handle, WM_SYSCOMMAND, (IntPtr)SC_CONTEXTHELP, IntPtr.Zero);
}*/
}
}