PART 2(SEND MESSAGE TO USER/JOIN ROOM/SEND MESSAGE IN ROOM IN TALKINCHAT)
Now after you done in my Part 1 Tutorials to Login,then Add textbox ,name it txtusertarget
and add again textbox and name it txtmessage,and add 1 button name it btnsend.
Now double click the btnsned and add this codes.
'this codes for sending text....
ryu.sendmessage(txtusertarget.text,txtmessage.text,messagetype.chatmessage)
after you add that codes, build your projects and test the application,open your application,
login,after login succesfully,put the id of user you want to send message in txtusertarget,then add message in txtmessage and click btnsend.
now sending message to a user is working,go back to your project,
add textbox again,name it txtroomname = means this textbox is for roomname,add 1 button and name it btnjoin.
Now after you add textbox for room and button for join,double click the btnjoin and add this codes.
ryu.joinmuc(txtroomname.text)
now after you add that codes, run again your project,login,add name of your room in txtroomname and click btnjoin,YES! Now your id in your project is succesfully join in your room,
next the last part of this tutorials part 2 is for sending message in your room.
go back to your project,add textbox again and name it rommtextmessage and add 1 button name it btonroomsend,double click btnroomsend and add this codes.
ryu.sendmessage(txtroomname.text,roomtextmessage.text,messagetype.mucmessage
YES! Now Your talkinchat project is almost done!
Wait for the next tutorials..
Please stay tune on my blogsite and feel free to leave a comments,
please support on my channel .
PART 1(LOGIN IN TALKINCHAT)
Now,after to download the Visual Studio and install,Open your visual studio and name your project. on this sample,name your project as "TalkinExample" after Name your Project, go to the option where you want to save your projects . after selecting where you save your projects,then click Ok. now, after clicking Ok,the form is show,you can see an empty Form, next, add 2 labels and name it username and password. next add 2 textbox and name it usernametextbox and passtextbox. next add 1 Button, Name it LoginBtn for the name and Sign In for the text now your form look like this. now,the next step is fucos your mouse in your form and rightclick the mouse and select view code. After that, the page for codes is shown, now add this codes on the top of Public Class.
Imports TalkinClient.UserImports TalkinClientImports MaterialSkin.ControlsImports System.Reflection
Looks Like This
Now add the next codes after in the Public Class Form1
. Inherits MaterialFormPrivate ryu As TalkinChatPrivate Delegate Sub SetControlPropertyThreadSafeDelegate(ByVal control As Control, ByVal propertyName As String, ByVal propertyValue As Object)Private Sub SetControlPropertyThreadSafe(ByVal control As Control, ByVal propertyName As String, ByVal propertyValue As Object)On Error Resume NextIf control.InvokeRequired Thencontrol.Invoke(New SetControlPropertyThreadSafeDelegate(AddressOf SetControlPropertyThreadSafe), New Object() {control, propertyName, propertyValue})Elsecontrol.[GetType]().InvokeMember(propertyName, BindingFlags.SetProperty, Nothing, control, New Object() {propertyValue})End IfEnd SubPrivate Sub loginMe()SetControlPropertyThreadSafe(statuslbl, "Text", "Connecting...")ryu = New TalkinChat()ryu.AutoReconnect = Trueryu.ReconnectInterval = 10000AddHandler ryu.OnLogin, Function(ryu, authCode)TrySelect Case authCodeCase TalkinClient.User.AuthCode.Successstatuslbl.Text = "Login Success."SetControlPropertyThreadSafe(Usernametextbox, "Enabled", False)SetControlPropertyThreadSafe(passtextbox, "Enabled", False)SetControlPropertyThreadSafe(loginBtn, "Text", "Logout")SetControlPropertyThreadSafe(loginBtn, "BackColor", Color.Red)SetControlPropertyThreadSafe(statuslbl, "Text", "Login Success.")SetControlPropertyThreadSafe(statuslbl, "ForeColor", Color.Green)Case TalkinClient.User.AuthCode.FailedUsernametextbox.Enabled = Truepasstextbox.Enabled = TrueloginBtn.Enabled = Truestatuslbl.Text = "Wrong Password."statuslbl.ForeColor = Color.RedCase TalkinClient.User.AuthCode.DisabledUsernametextbox.Enabled = Truepasstextbox.Enabled = TrueloginBtn.Enabled = Truestatuslbl.Text = "Account has been disabled."statuslbl.ForeColor = Color.BlackCase TalkinClient.User.AuthCode.[Error]Usernametextbox.Enabled = Truepasstextbox.Enabled = TrueloginBtn.Enabled = Truestatuslbl.Text = "Unable to login."statuslbl.ForeColor = Color.BlackEnd SelectCatchEnd Try#Disable Warning BC42105 ' Function doesn't return a value on all code pathsEnd Function#Enable Warning BC42105 ' Function doesn't return a value on all code pathsAddHandler ryu.OnLogout, Function(ryu)' contactslistView.Items.Clear()SetControlPropertyThreadSafe(Usernametextbox, "Enabled", True)SetControlPropertyThreadSafe(passtextbox, "Enabled", True)SetControlPropertyThreadSafe(loginBtn, "Text", "Sign In")SetControlPropertyThreadSafe(loginBtn, "BackColor", Color.Green)SetControlPropertyThreadSafe(statuslbl, "Text", "Logged out.")SetControlPropertyThreadSafe(statuslbl, "ForeColor", Color.Black)#Disable Warning BC42105 ' Function doesn't return a value on all code pathsEnd Function#Enable Warning BC42105 ' Function doesn't return a value on all code pathsAddHandler ryu.OnClose, Function(ryu)SetControlPropertyThreadSafe(Usernametextbox, "Enabled", True)SetControlPropertyThreadSafe(passtextbox, "Enabled", True)SetControlPropertyThreadSafe(loginBtn, "Text", "Sign In")SetControlPropertyThreadSafe(loginBtn, "BackColor", Color.Green)' contactslistView.Items.Clear()If ryu.AutoReconnect ThenSetControlPropertyThreadSafe(statuslbl, "Text", "Reconnecting...")ElseSetControlPropertyThreadSafe(statuslbl, "Text", "Disconnected.")End IfSetControlPropertyThreadSafe(statuslbl, "ForeColor", Color.Black)#Disable Warning BC42105 ' Function doesn't return a value on all code pathsEnd Function#Enable Warning BC42105 ' Function doesn't return a value on all code pathsAddHandler ryu.OnError, Function(ryu, [error])SetControlPropertyThreadSafe(Usernametextbox, "Enabled", True)SetControlPropertyThreadSafe(passtextbox, "Enabled", True)SetControlPropertyThreadSafe(loginBtn, "Text", "Sign In")SetControlPropertyThreadSafe(loginBtn, "BackColor", Color.Green)SetControlPropertyThreadSafe(statuslbl, "Text", "Error: " & [error])SetControlPropertyThreadSafe(statuslbl, "ForeColor", Color.Black)#Disable Warning BC42105 ' Function doesn't return a value on all code pathsEnd Function#Enable Warning BC42105 ' Function doesn't return a value on all code pathsAddHandler ryu.OnChatMessage, AddressOf OnChatMessageIf Not String.IsNullOrWhiteSpace(Usernametextbox.Text) AndAlso Not String.IsNullOrWhiteSpace(passtextbox.Text) Thenryu.Login(Usernametextbox.Text, passtextbox.Text)End If
Looks Like this.
and the last Codes, go to your form and doubleclick the loginbutton and add this codes.
loginMe()
Looks Like this.
Now your Project is almost Ready to test,go to the top of visual studio and click build.
after build succesfuly,then go to where your project save and open Debug Folder, select exe file and doubleclick to open,
Now your first project is works,
Happy Coding,
If any Question bout this Guide,then
you can leave comment here or message me on my talkinchat account syntax-error
or mail me on d1mustdie@gmail.com
2 comments:
brother, from where we can download talkinchatClient dll?
YOU CAN GET DLL FILE WHEN YOU DOWNLOAD 1 OF ANY MY TALKINCHAT SOFTWARE.
IF YOU WANT A FULL SOURCE CODE,THEN LET ME KNOW WHAT PROJECT YOU WANT TO BUILD AND I WILL ARRANGE THAT FOR YOU,ABOUT THE PRICE,DEPENDS ON WHAT PROJECT YOU WANT TO BUILD OR WHAT CODES YOU WANT.
Post a Comment