我是 C# 新手,这是我的第一个程序。我正在尝试从 OVH.IE 集成 SOAPI(更多信息:www.ovh.ie/products/soapi.xml),但是每当我启动程序并单击登录按钮时,程序崩溃(VS2012 的内存使用量增加并且然后崩溃)。
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.Web.Services;
namespace Server_Manager
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
}
void login(string uid, string pwd, string dc)
{
if (dc == "OVH")
{
managerService soapi = new managerService();
string session = soapi.login(uid, pwd, "ie", false);
if (String.IsNullOrWhiteSpace(session))
{
MessageBox.Show("Not Logged");
}
else
{
MessageBox.Show("Logged In");
}
}
}
private void button1_Click(object sender, EventArgs e)
{
if (String.IsNullOrWhiteSpace(textBox1.Text) || String.IsNullOrWhiteSpace(textBox1.Text))
{
MessageBox.Show("Please Fill all the Details");
}
else
{
string uid, pwd, dc;
uid = textBox1.Text;
pwd = textBox2.Text;
dc = comboBox1.Text;
login(uid,pwd,dc);
}
MessageBox.Show(comboBox1.Text);
}
}
}