مشكلة في تحويل كود من c# الى vb.net - aldery - 17-05-21
السلام عليكم , قمت بتحويل برنامج من c# الى vb.net ولكن واجهت مشكلة في أحد الاسطر أتمنى منكم مساعدتي في حلها وشكراً
هذا النص الاصلي
كود :
private void Prec(object sender, Presence p)
{
{
{
if (InvokeRequired)
BeginInvoke(new agsXMPP.protocol.client.PresenceHandler(Prec), new object[] { sender, p });
else
{
if (checkBox2.Checked == true)
{
if (p.Type == agsXMPP.protocol.client.PresenceType.subscribe)
{
x.Send("<presence to=\"" + p.From + "\" type=\"subscribed\" />" +
"<presence to=\"" + p.From + "\" type=\"subscribe\" />");
x.Send("<message to=\"" + p.From + "\" type=\"chat\"><body>" + textBox5.Text + "</body></message>");
}
}
}
}
}
}
void cnt_OnMessage1(object sender, agsXMPP.protocol.client.Message Msg)
{
if (InvokeRequired)
BeginInvoke(new agsXMPP.protocol.client.MessageHandler(cnt_OnMessage1), new object[] { sender, Msg });
else
{
if (Msg.Body.ToLower().StartsWith(textBox6.Text))
{
x.Send("<message to=\"" + Msg.From + "\" type=\"chat\"><body> You Are Member </body></message>");
x.Send("<iq to='" + textBox4.Text + "@conference.nimbuzz.com' type='set' id='ChatBuzz'><query xmlns='http://jabber.org/protocol/muc#admin'><item affiliation='member' jid='" + Msg.From.Resource + "@nimbuzz.com'/></query></iq>");
x.Send("<message id='mir_141' to='" + textBox4.Text + "@conference.nimbuzz.com' type='groupchat'><body>" + Msg.From.Resource + " You Are Member</body></message>");
}
}
}
هذا الكود لدي بعد تحويله الى vb
كود :
Class SurroundingClass
Private Sub Prec(ByVal sender As Object, ByVal p As Presence)
If True Then
If True Then
If InvokeRequired Then
BeginInvoke(New agsXMPP.protocol.client.PresenceHandler(AddressOf Prec), New Object() {sender, p})
Else
If checkBox2.Checked = True Then
If p.Type = agsXMPP.protocol.client.PresenceType.subscribe Then
x.Send("<presence to=""" & p.From & """ type=""subscribed"" />" & "<presence to=""" + p.From & """ type=""subscribe"" />")
x.Send("<message to=""" & p.From & """ type=""chat""><body>" + textBox5.Text & "</body></message>")
End If
End If
End If
End If
End If
End Sub
Private Sub cnt_OnMessage1(ByVal sender As Object, ByVal Msg As agsXMPP.protocol.client.Message)
If InvokeRequired Then
BeginInvoke(New agsXMPP.protocol.client.MessageHandler(AddressOf cnt_OnMessage1), New Object() {sender, Msg})
Else
If Msg.Body.ToLower().StartsWith(textBox6.Text) Then
x.Send("<message to=""" & Msg.From & """ type=""chat""><body> You Are Member </body></message>")
x.Send("<iq to='" & textBox4.Text & "@conference.nimbuzz.com' type='set' id='ChatBuzz'><query xmlns='http://jabber.org/protocol/muc#admin'><item affiliation='member' jid='" + Msg.From.Resource & "@nimbuzz.com'/></query></iq>")
x.Send("<message id='mir_141' to='" & textBox4.Text & "@conference.nimbuzz.com' type='groupchat'><body>" + Msg.From.Resource & " You Are Member</body></message>")
End If
End If
End Sub
End Class
وهذا رابط المشروع كامل
RE: مشكلة في تحويل كود من c# الى vb.net - bidaya - 17-05-21
جرب اخي الكريم
اتمنى ما تلقى خلل هذه المرة
RE: مشكلة في تحويل كود من c# الى vb.net - aldery - 18-05-21
(17-05-21, 09:47 PM)bidaya كتب : جرب اخي الكريم
اتمنى ما تلقى خلل هذه المرة
جزاك الله خيراً أخي واشكرك من أعماق قلبي
|