Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 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;
     }
 }
Exemplo n.º 3
0
 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));
     }
 }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
 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);
 }
Exemplo n.º 6
0
 public void SendPhoto(string fileName, object ID)
 {
     Command command = new Command(Command.Commands.SendPhoto, ID.ToString());
     //command.File = ConvertPhoto(fileName);
     protocol.SendObject(command, socket);
 }
Exemplo n.º 7
0
 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);
     }
 }
Exemplo n.º 8
0
 public void ReadPhotoLink(string fileName, object id)
 {
     Command command = new Command(Command.Commands.ReadPhotoLink, id.ToString());
     command.FilePath = fileName;
     protocol.SendObject(command, socket);
 }
Exemplo n.º 9
0
 public void GetTable(string tableName)
 {
     System.Diagnostics.Debug.WriteLine("WecClient: Get table.");
     Command command = new Command(Command.Commands.FullData, tableName);
     protocol.SendObject(command, socket);
 }
Exemplo n.º 10
0
 public SocketEventArgs(Command command)
 {
     this.command = command;
 }