private static void threadStartFun(string serverIP, int port,String username, String password,string sysncpath ) { Program.ClientForm.addtoConsole("Sign Up initiated"); //TBD //System.Windows.Forms.MessageBox.Show("start", "SignUp Thread started"); MessageClasses.MsgSignUp msgobj = new MessageClasses.MsgSignUp(); msgobj.userName = username; msgobj.psw = password; // Fill out the content in msgobj //call CreateMsg.createSignUpMsg(msgobj) get it in bytes form Message.CreateMsg msg=new Message.CreateMsg(); String message = msg.createSignUpMsg(msgobj); //create a socket connection. you may need to create in Conection Manager sender = conn.connect(serverIP, port); if(sender == null) { Program.ClientForm.addtoConsole("Error : <<Could not connect to server. May be Server is not Running>>"); //System.Windows.Forms.MessageBox.Show("Could not connect to server.Please check if Server is Running.", "DBLike Client"); Program.ClientForm.addtoConsole("Exiting"); Program.ClientForm.signupfail(); Thread.CurrentThread.Abort(); } //call SocketCommunication.ReaderWriter.write(byte[] msg) to write msg on socket SocketCommunication.ReaderWriter rw = new SocketCommunication.ReaderWriter(); //System.Windows.Forms.MessageBox.Show("going to write socket:"+message, "SignUp Thread started"); Program.ClientForm.addtoConsole("Writing to socket: " + message); rw.writetoSocket(sender, message); //call SocketCommunication.ReaderWriter.read() to read response from server //System.Windows.Forms.MessageBox.Show("going to read socket: " , "SignUp Thread started"); String response=rw.readfromSocket(sender); Program.ClientForm.addtoConsole("Read from socket :" + response); //System.Windows.Forms.MessageBox.Show("read:"+ response, "SignUp Thread started"); //call parser and process it..... Message.MessageParser mp = new Message.MessageParser(); //msgobj = mp.signInParseMessage(response); msgobj = mp.signUpParseMessage(response); // This functionality should be added here //call parser and process it..... if (!msgobj.ack.Equals("")) { Message.MessageParser msgparser = new Message.MessageParser(); if (msgobj.ack.Equals("ERRORS")) { Program.ClientForm.addtoConsole("Error :" +"<<"+ msgobj.addiMsg +">>"); //System.Windows.Forms.MessageBox.Show("Some error occured!Please try again.", "Error Occured"); Program.ClientForm.addtoConsole("Exiting"); Program.ClientForm.signupfail(); Thread.CurrentThread.Abort(); } else { Program.ClientForm.ballon("Congratulations " + username + "! Your account is successfully created"); if (File.Exists(@"C:\dblikeConfig\dblike.txt")) { if (DialogResult.No == System.Windows.Forms.MessageBox.Show("This System is already configured for a dblike user." + "Do you want to reconfigure it for yourself?", "DBLike Client", MessageBoxButtons.YesNo)) { Program.ClientForm.addtoConsole("Exiting"); Program.ClientForm.signupfail(); Thread.CurrentThread.Abort(); } } /* if (!Program.ClientForm.IsHandleCreated) { Program.ClientForm.CreateHandle(); } Program.ClientForm.Appendconsole("Successefully Signed in"); */ LocalDbAccess.LocalDB file = new LocalDbAccess.LocalDB(); if (false == file.writetofile(username, password, sysncpath)) { Program.ClientForm.addtoConsole("Error : <<Unable to access config file. Please try Sign In>>"); //System.Windows.Forms.MessageBox.Show("Unable to access dblike file. Please try Sign In.", "Error Occured"); Program.ClientForm.addtoConsole("Exiting"); Program.ClientForm.signupfail(); Thread.CurrentThread.Abort(); } else { //Upload all the content bool result = file.writetofile(username, password, sysncpath); if (result == false) { Program.ClientForm.addtoConsole("Error : <<Unable to access config file. Please try Sign In>>"); //System.Windows.Forms.MessageBox.Show("Unable to write on the file. Please try Sign In.", "Unable to write on file"); Program.ClientForm.addtoConsole("Exiting"); Program.ClientForm.signupfail(); Thread.CurrentThread.Abort(); //return; } Program.ClientForm.addtoConsole("Initiating content upload"); uploadeverything(sysncpath); //System.Windows.Forms.MessageBox.Show("Uploaded!!!", "Client"); //System.Windows.Forms.MessageBox.Show("Started!!!", "Client"); // initialize the file list for sign up scenario Client.LocalFileSysAccess.FileListMaintain fileMaintain = new Client.LocalFileSysAccess.FileListMaintain(); fileMaintain.scanAllFilesAttributes(); Program.folderWatcher.start(); Program.ClientForm.addtoConsole("File watcher Installed"); Client.Program.poll.start(); Program.ClientForm.addtoConsole("Poll thread started"); if (!Program.ClientForm.IsHandleCreated) { Program.ClientForm.CreateHandle(); } //enable service controller Program.ClientForm.signUppassed(); /* Threads.FileSysWatchDog watchdog = new FileSysWatchDog(); if (watchdog.start() == false) { //disable stop service button //enable start service button } */ } Program.ClientForm.addtoConsole("Exiting Sign Up thread"); Thread.CurrentThread.Abort(); } } }