public void AddPerson(List<object> values)
 {
     System.Diagnostics.Debug.WriteLine("WecClient: Add person.");
     Command command = new Command(Command.Commands.AddRecord, string.Empty);
     command.ValuesList.Add(values);
     protocol.SendObject(command, socket);
 }
 public void FireEvent(Command command)
 {
     System.Diagnostics.Debug.WriteLine("Client: New message received: {0}", command.CurrentCommand);
     switch (command.CurrentCommand)
     {
         case "FullData":
             FullData(null, new SocketEventArgs(command));
             break;
         case "ReadPhoto":
             ReadPhoto(null, new SocketEventArgs(command));
             break;
         case "ReadFile":
             ReadFile(null, new SocketEventArgs(command));
             break;
         case "ReadPhotoLink":
             ReadPhotoLink(null, new SocketEventArgs(command));
             break;
     }
 }
 public void Exit()
 {
     System.Diagnostics.Debug.WriteLine("WecClient: Exit.");
     if (socket != null)
     {
         Command command = new Command(Command.Commands.Exit, string.Empty);
         protocol.SendObject(command, socket);
         protocol.ReadObject(socket, typeof(Command));
     }
 }
 public void DeletePerson(object id)
 {
     System.Diagnostics.Debug.WriteLine("WecClient: Delete person.");
     Command command = new Command(Command.Commands.DeleteRecord, id.ToString());
     protocol.SendObject(command, socket);
 }
 public void SendPhotoLink(string fileName, object ID)
 {
     Command command = new Command(Command.Commands.SendPhotoLink, ID.ToString());
     //command.File = new Imager().ImageToBytes(fileName);//read file
     command.FilePath = Path.GetFileName(fileName);
     protocol.SendObject(command, socket);
 }
 public void SendPhoto(string fileName, object ID)
 {
     Command command = new Command(Command.Commands.SendPhoto, ID.ToString());
     //command.File = ConvertPhoto(fileName);
     protocol.SendObject(command, socket);
 }
 public void SendFile(string fileName, object id)
 {
     using (FileStream fs = new FileStream(fileName, FileMode.Open))
     {
         byte[] buffer = new byte[fs.Length];
         fs.Read(buffer, 0, (int)fs.Length);
         Command command = new Command(Command.Commands.SendFile, id.ToString());
         command.File = buffer;
         command.FilePath = Path.GetFileName(fileName);
         protocol.SendObject(command, socket);
     }
 }
 public void ReadPhotoLink(string fileName, object id)
 {
     Command command = new Command(Command.Commands.ReadPhotoLink, id.ToString());
     command.FilePath = fileName;
     protocol.SendObject(command, socket);
 }
 public void GetTable(string tableName)
 {
     System.Diagnostics.Debug.WriteLine("WecClient: Get table.");
     Command command = new Command(Command.Commands.FullData, tableName);
     protocol.SendObject(command, socket);
 }
 public SocketEventArgs(Command command)
 {
     this.command = command;
 }