Exemplo n.º 1
0
 public static int Callback(Network.NetTools.Packet obj)
 {
     Console.WriteLine("Gotcha");
     Network.Client.Instance.SendDataToServer(new Network.NetTools.Packet
     {
         Name = UserName,
         Key  = obj.Key,
         Data = new KeyValuePair <Network.NetTools.PacketCommand, object>(Network.NetTools.PacketCommand.C_UNLOCK, null)
     });
     return(0);
 }
Exemplo n.º 2
0
Arquivo: Net.cs Projeto: Codex04/AREA
        /// <summary>
        /// Call back function when a packet is received
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static int Callback(Network.NetTools.Packet obj)
        {
            Network.Client.Instance.SendDataToServer(new Network.NetTools.Packet
            {
                Name = Username,
                Key  = obj.Key,
                Data = new KeyValuePair <Network.NetTools.PacketCommand, object>(Network.NetTools.PacketCommand.C_UNLOCK, null)
            });
            switch (obj.Data.Key)
            {
            case Network.NetTools.PacketCommand.S_EVENT:
                DataMessageConverter(obj.Data.Value);
                break;

            case Network.NetTools.PacketCommand.S_DISCONNECT:
                App.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(delegate()
                {
                    MainWindow.Instance.ContentControl.Content = MainWindow.conntectionInstance;
                }));
                break;

            case Network.NetTools.PacketCommand.S_PONG:
                Net.Instance.checkConnection++;
                Console.WriteLine("connect");
                break;

            case Network.NetTools.PacketCommand.S_LOGIN_SUCCESS:
                Net.Instance.checkConnection++;
                Console.WriteLine("login");
                break;

            case Network.NetTools.PacketCommand.ERROR:
                Net.Instance.checkConnection = 0;
                break;
            }
            if (Net.Instance.checkConnection >= 2)
            {
                App.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(delegate()
                {
                    MainWindow.Instance.ContentControl.Content = MainWindow.servicesInstance;
                }));
            }
            return(0);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Callback used when a monitor send a request to the server
 /// </summary>
 /// <param name="data">The <see cref="Network.NetTools.Packet"/> data</param>
 public static int MonitorCallback(Network.NetTools.Packet data)
 {
     return(0);
 }