/// <summary>
 /// Constructor Parametrizado
 /// </summary>
 /// <param name="remoteNetUser">El usuario remoto con el cual se intercambiará el archivo</param>
 /// <param name="sendMessageDelegate">Un método con el cual se puedan envíar mensajes a la MANET</param>
 /// <param name="fileInformation">La información del archivo</param>
 /// <param name="FileData">Los parámetros de configuración</param>
 public FileMessageReceiver(NetUser remoteNetUser, SendMessageDelegate sendMessageDelegate, FileInformation fileInformation, FileData fileData)
     : base(remoteNetUser, sendMessageDelegate, fileInformation, fileData)
 {
     thisLock = new Object();
     this.Type = FileMessageHandlerType.DOWNLOAD;
     this.downloadDir = fileData.DownloadDir;
 }
 /// <summary>
 /// Constructor parametrizado
 /// </summary>
 /// <param name="remoteNetUser">El usuario con quien se intercambia el archivo</param>
 /// <param name="remoteFileHandlerId">El id de la transferencia de archivo</param>
 /// <param name="sendMessageDelegate">Una función por la que se pueda enviar un mensaje</param>
 /// <param name="fileInformation">Información del archivo</param>
 /// <param name="fileData">Datos de configuración de archivos</param>
 public FileMessageSender(NetUser remoteNetUser, Guid remoteFileHandlerId, SendMessageDelegate sendMessageDelegate, FileInformation fileInformation, FileData fileData)
     : base(remoteNetUser, sendMessageDelegate, fileInformation, fileData)
 {
     FileName = fileInformation.Path;
     currentPart = 0;
     this.Type = FileMessageHandlerType.UPLOAD;
     this.Id = remoteFileHandlerId;
 }
 public MessengerService(IRepository repository)
 {
     _twitter = new TwitterNet(Settings.TwitterUserName, TwitterNet.ToSecureString(Settings.TwitterPassword));
     _twitter.TwitterServerUrl = Settings.TwitterServiceUrl;
     _messageSender = new SendMessageDelegate(SendMessage);
     _urlShortneningService = new UrlShorteningService(ShorteningService.Bitly);
     _repository = repository;
 }
예제 #4
0
        private void ExecuteMessagePipeline(SendMessageDelegate del, Type typeObject, byte[] messageBytes, Dictionary <string, string> headers = null, string endPoint = null)
        {
            SendMessageDelegate current = del;

            for (int i = _configuration.SendMessageMiddleware.Count; i > 0; i--)
            {
                var middleware = (ISendMessageMiddleware)_container.GetInstance(_configuration.SendMessageMiddleware[i - 1]);
                middleware.Next = current;
                current         = middleware.Process;
            }
            current(typeObject, messageBytes, headers, endPoint);
        }
예제 #5
0
 void SendMessageReturned(IAsyncResult result)
 {
     try
     {
         SendMessageDelegate dlgt = (SendMessageDelegate)result.AsyncState;
         dlgt.EndInvoke(result);
     }
     catch (Exception ex)
     {
         MessageBox.Show(SettingList["MsgBoxErrSendMsg"] + " " + ex.Message, SettingList["MsgBoxCaptionError"], MessageBoxButtons.OK);
     }
 }
예제 #6
0
 public void SwitchSendMessageTarget(MessageTarget messageTarget, ParameterizedThreadStart sendRequest)
 {
     SendRequest = sendRequest;
     if (messageTarget == MessageTarget.LocalGameProxy)
     {
         SendMessage = SendMessageToLocalGameProxy;
     }
     else if (messageTarget == MessageTarget.Server)
     {
         SendMessage = SendMessageToServer;
     }
 }
예제 #7
0
        static User32()
        {
            IntPtr library = DynamicImport.ImportLibrary("user32.dll");

            CreateWindowEx             = DynamicImport.Import <CreateWindowExDelegate>(library, "CreateWindowExW");
            DefWindowProc              = DynamicImport.Import <DefWindowProcDelegate>(library, "DefWindowProcW");
            DestroyWindow              = DynamicImport.Import <DestroyWindowDelegate>(library, "DestroyWindow");
            DispatchMessage            = DynamicImport.Import <DispatchMessageDelegate>(library, "DispatchMessageW");
            GetClientRect              = DynamicImport.Import <GetClientRectDelegate>(library, "GetClientRect");
            GetWindow                  = DynamicImport.Import <GetWindowDelegate>(library, "GetWindow");
            GetWindowRect              = DynamicImport.Import <GetWindowRectDelegate>(library, "GetWindowRect");
            IsWindow                   = DynamicImport.Import <IsWindowDelegate>(library, "IsWindow");
            IsWindowVisible            = DynamicImport.Import <IsWindowVisibleDelegate>(library, "IsWindowVisible");
            MoveWindow                 = DynamicImport.Import <MoveWindowDelegate>(library, "MoveWindow");
            PeekMessage                = DynamicImport.Import <PeekMessageWDelegate>(library, "PeekMessageW");
            RegisterClassEx            = DynamicImport.Import <RegisterClassExDelegate>(library, "RegisterClassExW");
            SendMessage                = DynamicImport.Import <SendMessageDelegate>(library, "SendMessageW");
            SetLayeredWindowAttributes = DynamicImport.Import <SetLayeredWindowAttributesDelegate>(library, "SetLayeredWindowAttributes");
            SetWindowPos               = DynamicImport.Import <SetWindowPosDelegate>(library, "SetWindowPos");
            ShowWindow                 = DynamicImport.Import <ShowWindowDelegate>(library, "ShowWindow");
            TranslateMessage           = DynamicImport.Import <TranslateMessageDelegate>(library, "TranslateMessage");
            UnregisterClass            = DynamicImport.Import <UnregisterClassDelegate>(library, "UnregisterClassW");
            UpdateWindow               = DynamicImport.Import <UpdateWindowDelegate>(library, "UpdateWindow");
            WaitMessage                = DynamicImport.Import <WaitMessageDelegate>(library, "WaitMessage");
            PostMessage                = DynamicImport.Import <PostMessageWDelegate>(library, "PostMessageW");
            PostQuitMessage            = DynamicImport.Import <PostQuitMessageDelegate>(library, "PostQuitMessage");

            GetForegroundWindow = DynamicImport.Import <GetForegroundWindowDelegate>(library, "GetForegroundWindow");

            GetDesktopWindow         = DynamicImport.Import <GenericGetWindowDelegate>(library, "GetDesktopWindow");
            GetShellWindow           = DynamicImport.Import <GenericGetWindowDelegate>(library, "GetShellWindow");
            GetActiveWindow          = DynamicImport.Import <GenericGetWindowDelegate>(library, "GetActiveWindow");
            FindWindowEx             = DynamicImport.Import <FindWindowExWDelegate>(library, "FindWindowExW");
            GetWindowInfo            = DynamicImport.Import <GetWindowInfoDelegate>(library, "GetWindowInfo");
            GetWindowThreadProcessId = DynamicImport.Import <GetWindowThreadProcessIdDelegate>(library, "GetWindowThreadProcessId");

            if (IntPtr.Size == 4)
            {
                GetClassLongPtr  = DynamicImport.Import <GenericGetWindowLongDelegate>(library, "GetClassLongW");
                GetWindowLongPtr = DynamicImport.Import <GenericGetWindowLongDelegate>(library, "GetWindowLongW");
            }
            else
            {
                GetClassLongPtr  = DynamicImport.Import <GenericGetWindowLongDelegate>(library, "GetClassLongPtrW");
                GetWindowLongPtr = DynamicImport.Import <GenericGetWindowLongDelegate>(library, "GetWindowLongPtrW");
            }

            try
            {
                _setThreadDpiAwarenessContext = DynamicImport.Import <SetThreadDpiAwarenessContextDelegate>(library, "SetThreadDpiAwarenessContext");
            }
            catch { } // ignored
        }
예제 #8
0
        /// <summary>
        /// The constuctor for the MessageQueue class.
        /// </summary>
        /// <param name="sender">The delegate for directly sending messages over the Saint2 device.</param>
        /// <param name="ThreadName">The name to be given to the Sending Thread.</param>
        public MessageQueue(SendMessageDelegate <TMessage> sender, string ThreadName = "")
        {
            _tasks = new BlockingCollection <QueueTask>(circular_buffer_size);
            _ts    = new CancellationTokenSource();

            Sender = sender;

            _worker = new Thread(ExecutionTask(_ts.Token).RunSynchronously)
            {
                Name = ThreadName
            };
            _worker.Start();
        }
예제 #9
0
 public ClientCommunication(
     string id,
     Queue <MessageBase> queue,
     SendMessageDelegate sendMessage,
     GetConfigurationBotDelegate getConfigurationBot,
     GetConfigurationCoreDelegate getConfigurationCore)
 {
     this._id                     = id;
     this._queue                  = queue;
     this._onSendMessage          = sendMessage;
     this._onGetConfigurationBot  = getConfigurationBot;
     this._onGetConfigurationCore = getConfigurationCore;
 }
예제 #10
0
 private void setNotifcationFunctions()
 {
     if (CLI.Instance.CLIModeActive)
     {
         stepEndNotification            = DontNotify;
         preparationStepEndNotification = DontNotify;
     }
     else
     {
         stepEndNotification            = GUIStepEndNotification;
         preparationStepEndNotification = GUIPreparationStepEndNotification;
     }
 }
예제 #11
0
        static User32()
        {
            var library = DynamicImport.ImportLibrary(nameof(User32));

            GetAsyncKeyState = DynamicImport.Import <GetAsyncKeyStateDelegate>(library, nameof(GetAsyncKeyState));
            GetKeyboardState = DynamicImport.Import <GetKeyboardStateDelegate>(library, nameof(GetKeyboardState));
            GetKeyState      = DynamicImport.Import <GetKeyStateDelegate>(library, nameof(GetKeyState));
            SendInput        = DynamicImport.Import <SendInputDelegate>(library, nameof(SendInput));
            KeybdEvent       = DynamicImport.Import <KeybdEventDelegate>(library, "keybd_event");
            MouseEvent       = DynamicImport.Import <MouseEventDelegate>(library, "mouse_event");
            PostMessageW     = DynamicImport.Import <PostMessageDelegate>(library, nameof(PostMessageW));
            SendMessageW     = DynamicImport.Import <SendMessageDelegate>(library, nameof(SendMessageW));
        }
예제 #12
0
        /// <summary>Actually sends the data to mIRC.</summary>
        private Task <string> dispatchMessageAsync(uint message, string command, short eventID, CancellationToken token)
        {
            var taskSource = new TaskCompletionSource <string>();
            var buffer     = new byte[FileSize];

            prepareMappedFile(message, command, buffer);

            // Send the command to mIRC.
            currentDelegate = this.commandCallback;
            SendMessageCallbackW(this.targetWindow, message, new IntPtr(24 | eventID << 16), this.fileNumber, currentDelegate, (IntPtr)GCHandle.Alloc(taskSource));
            token.Register(() => this.cancelled(taskSource));

            return(taskSource.Task);
        }
예제 #13
0
        private void SendMessage()
        {
            try
            {
                if (listViewTo.Items.Count == 0)
                {
                    MessageBox.Show(SettingList["MsgBoxEmptySelectUserTextBox"], SettingList["MsgBoxCaptionWarning"], MessageBoxButtons.OK);
                    btnSelect.Select();
                    btnSelect.Focus();
                    return;
                }
                if (txtMsg.Text.Trim() == "")
                {
                    MessageBox.Show(SettingList["MsgBoxEmptyMsgTextBox"], SettingList["MsgBoxCaptionWarning"], MessageBoxButtons.OK);
                    txtMsg.Text = "";
                    txtMsg.Focus();
                    return;
                }

                Boolean confirmation = false;
                if (cbConfirm.Checked)
                {
                    confirmation = true;
                }
                Cursor.Current = Cursors.WaitCursor;
                AsyncCallback       SendMessageCallBack = new AsyncCallback(SendMessageReturned);
                SendMessageDelegate SMDel = new SendMessageDelegate(ServerObj.SendMessageToServer);
                IAsyncResult        SendMessageAsyncResult = SMDel.BeginInvoke(userName + info, ListSendServer, txtMsg.Text, confirmation, SendMessageCallBack, SMDel);

                Cursor.Current = Cursors.Default;
                MessageBox.Show(SettingList["MsgBoxSendMsgOk"], SettingList["MsgBoxCaptionInfo"], MessageBoxButtons.OK);
                ListSendServer         = null;
                ListSendServer         = new List <string>();
                ListSendServerListView = new List <string>();
                listViewTo.Items.Clear();
                txtMsg.Text       = "";
                cbConfirm.Checked = false;
                btnSelect.Enabled = true;
                btnClear.Enabled  = false;
                btnSend.Enabled   = false;
                cbConfirm.Enabled = false;
                btnClose.Focus();
            }
            catch (Exception ex)
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show(SettingList["MsgBoxErrSendMsg"] + " " + ex.Message, SettingList["MsgBoxCaptionError"], MessageBoxButtons.OK);
            }
        }
        public static T CreateSenderProxy <T>(SendMessageDelegate sendMessage)
        {
            if (!typeof(T).IsInterface)
            {
                throw new ArgumentException("The given type must be an interface");
            }

            if (!proxyImplementations.TryGetValue(typeof(T), out var proxyImplementation))
            {
                proxyImplementation             = DynamicCodeGenerator.GenerateInvokerProxy <T>();
                proxyImplementations[typeof(T)] = proxyImplementation;
            }

            return((T)Activator.CreateInstance(proxyImplementation, sendMessage));
        }
        internal BroadcastingNetworkProtocol(string connectionIdentifier, SendMessageDelegate sendMessageDelegate)
        {
            if (string.IsNullOrEmpty(connectionIdentifier))
            {
                throw new ArgumentNullException(nameof(connectionIdentifier), $"No connection identifier set; we use this to distinguish different connections. Using the remote IP:Port is a good idea");
            }

            if (sendMessageDelegate == null)
            {
                throw new ArgumentNullException(nameof(sendMessageDelegate), $"The protocol class doesn't know anything about the network layer; please put a callback we can use to send data via UDP");
            }

            ConnectionIdentifier = connectionIdentifier;
            Send = sendMessageDelegate;
        }
예제 #16
0
 //////////////////////////////////////////////////////////////
 public void AppendDelegates(UBSModuleDelegates module_delegates)
 {
     this.SendMessageFunction         = module_delegates.SendMessageFunction;
     this.GetAvailableModulesFunction = module_delegates.GetAvailableModulesFunction;
     this.GetModuleFunction           = module_delegates.GetModule;
     this.LogFunction                = module_delegates.LogFunction;
     this.WriteConsoleFunction       = module_delegates.WriteConsoleFunction;
     this.NotifyFunction             = module_delegates.NotifyFunction;
     this.ErrorFunction              = module_delegates.ErrorFunction;
     this.ExecutionTimeFunction      = module_delegates.ExecutionTimeFunction;
     this.SetGlobalParameterFunction = module_delegates.SetGlobalParameterFunction;
     this.GetGlobalParameterFunction = module_delegates.GetGlobalParameterFunction;
     this.GoToModuleFunction         = module_delegates.GoToModuleFunction;
     this.ButtonColorFunction        = module_delegates.ButtonColorFunction;
 }
예제 #17
0
        /// <summary>
        /// 异步向服务器发送数据
        /// </summary>
        /// <param name="message"></param>
        public void AsyncSendMessage(string message)
        {
            SendMessageDelegate d      = new SendMessageDelegate(SendMessage);
            IAsyncResult        result = d.BeginInvoke(message, null, null);

            while (!result.IsCompleted)
            {
                if (isExit)
                {
                    return;
                }
                Thread.Sleep(50);
            }
            SendMessageStates states = new SendMessageStates();

            states.d      = d;
            states.result = result;
            FinishAsyncSendMessage(states, null);
            //Thread t = new Thread(new ThreadStart(FinishAsyncSendMessage));
            //t.IsBackground = true;
            //t.Start();
        }
예제 #18
0
        static User32()
        {
            IntPtr library = DynamicImport.ImportLibrary("user32.dll");

            CreateWindowEx             = DynamicImport.Import <CreateWindowExDelegate>(library, "CreateWindowExW");
            DefWindowProc              = DynamicImport.Import <DefWindowProcDelegate>(library, "DefWindowProcW");
            DestroyWindow              = DynamicImport.Import <DestroyWindowDelegate>(library, "DestroyWindow");
            DispatchMessage            = DynamicImport.Import <DispatchMessageDelegate>(library, "DispatchMessageW");
            GetClientRect              = DynamicImport.Import <GetClientRectDelegate>(library, "GetClientRect");
            GetWindow                  = DynamicImport.Import <GetWindowDelegate>(library, "GetWindow");
            GetWindowRect              = DynamicImport.Import <GetWindowRectDelegate>(library, "GetWindowRect");
            IsWindow                   = DynamicImport.Import <IsWindowDelegate>(library, "IsWindow");
            IsWindowVisible            = DynamicImport.Import <IsWindowVisibleDelegate>(library, "IsWindowVisible");
            MoveWindow                 = DynamicImport.Import <MoveWindowDelegate>(library, "MoveWindow");
            PeekMessage                = DynamicImport.Import <PeekMessageWDelegate>(library, "PeekMessageW");
            RegisterClassEx            = DynamicImport.Import <RegisterClassExDelegate>(library, "RegisterClassExW");
            SendMessage                = DynamicImport.Import <SendMessageDelegate>(library, "SendMessageW");
            SetLayeredWindowAttributes = DynamicImport.Import <SetLayeredWindowAttributesDelegate>(library, "SetLayeredWindowAttributes");
            SetWindowPos               = DynamicImport.Import <SetWindowPosDelegate>(library, "SetWindowPos");
            ShowWindow                 = DynamicImport.Import <ShowWindowDelegate>(library, "ShowWindow");
            TranslateMessage           = DynamicImport.Import <TranslateMessageDelegate>(library, "TranslateMessage");
            UnregisterClass            = DynamicImport.Import <UnregisterClassDelegate>(library, "UnregisterClassW");
            UpdateWindow               = DynamicImport.Import <UpdateWindowDelegate>(library, "UpdateWindow");
            WaitMessage                = DynamicImport.Import <WaitMessageDelegate>(library, "WaitMessage");
            PostMessage                = DynamicImport.Import <PostMessageWDelegate>(library, "PostMessageW");
            GetForegroundWindow        = DynamicImport.Import <GetForegroundWindowDelegate>(library, "GetForegroundWindow");

            try
            {
                _isProcessDPIAware = DynamicImport.Import <IsProcessDPIAwareDelegate>(library, "IsProcessDPIAware");
            }
            catch { } // ignored

            try
            {
                _setThreadDpiAwarenessContext = DynamicImport.Import <SetThreadDpiAwarenessContextDelegate>(library, "SetThreadDpiAwarenessContext");
            }
            catch { } // ignored
        }
예제 #19
0
        /// <summary>
        /// 异步向服务器端发送数据
        /// </summary>
        /// <param name="message"></param>
        private void AsyncSendMessage(string message)
        {
            SendMessageDelegate d      = new SendMessageDelegate(SendMessage);
            IAsyncResult        result = d.BeginInvoke(message, null, null);

            while (result.IsCompleted == false)
            {
                if (isExit)
                {
                    return;
                }
                Thread.Sleep(50);
            }
            SendMessageStates states = new SendMessageStates();

            states.d      = d;
            states.result = result;
            Thread t = new Thread(FinishAsyncSendMessage);

            t.IsBackground = true;
            t.Start(states);
        }
예제 #20
0
        public static bool SendCallback(MessageType type, int value, int timeout, SendCallbackEventHandler callback)
        {
            bool handled = false;
            SendMessageDelegate _callback = delegate(IntPtr hWnd, uint uMsg, UIntPtr dwData, IntPtr lResult)
            {
                if (!handled && callback(hWnd, uMsg, lResult))
                {
                    handled = true;
                }
            };

            NativeMethods.SendMessageCallback((IntPtr)BROADCAST, WM_GW2LAUNCHER, (UIntPtr)type, (IntPtr)value, _callback, UIntPtr.Zero);

            var message = new NativeMessage();
            var limit   = DateTime.UtcNow.AddMilliseconds(timeout);

            do
            {
                System.Threading.Thread.Sleep(5);
                NativeMethods.PeekMessage(ref message, IntPtr.Zero, 0, 0, 0);
            }while (DateTime.UtcNow < limit && !handled);

            return(handled);
        }
예제 #21
0
 public static extern int XDeviceAddExternalControllerDevice(System.IntPtr name, ControllerStateDelegate converter, SendMessageDelegate sender);
예제 #22
0
 public SendingQueue(RTPSendConnection sender)
 {
     this.m_Sender = sender;
     this.m_SendMessageDelegate = new SendMessageDelegate(this.m_Sender.Send);
     this.m_SendChunkDelegate = new SendChunkDelegate(this.m_Sender.Send);
     this.m_SendNACKDelegate = new SendNACKDelegate(this.m_Sender.Send);
 }
예제 #23
0
 private static extern bool SendMessageCallback(WindowHandle hWnd, WindowMessages message, GetIconSize wParam, IntPtr lParam,
                                                SendMessageDelegate lpCallBack, IntPtr dwData);
예제 #24
0
 internal static extern bool SendMessageCallback(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam, SendMessageDelegate lpCallBack, UIntPtr dwData);
예제 #25
0
파일: Alert.cs 프로젝트: IharHrunt/RSend
        private void SendMessage()
        {
            try
            {
                List <String> ListClientsInfo = new List <string>();
                List <String> ListSend        = new List <string>();
                List <String> ListSendServer  = new List <string>();

                String ipAddressServer = ConfigurationSettings.AppSettings["ipAddressServer"].Trim();
                int    portServer      = Convert.ToInt32(ConfigurationSettings.AppSettings["portServer"].Trim());
                String to   = ConfigurationSettings.AppSettings["to"].Trim();
                String text = ConfigurationSettings.AppSettings["Text"].Trim();

                if (ipAddressServer == "")
                {
                    Console.Write("Parameter 'ipAddressServer' cannot be empty! Please check configuration file!");
                    return;
                }
                if (to == "")
                {
                    Console.Write("Parameter 'to' cannot be empty! Please check configuration file!");
                    return;
                }
                if (text == "")
                {
                    Console.Write("Parameter 'text' cannot be empty! Please check configuration file!");
                    return;
                }
                String hostName = Dns.GetHostName().ToLower();
                if (hostName != "")
                {
                    if (hostName.Length > 1)
                    {
                        hostName = hostName.ToLower();
                        hostName = hostName.Remove(1).ToUpper() + hostName.Substring(1);
                    }
                    else
                    {
                        hostName = hostName.ToUpper();
                    }
                }

                String userName = "******" + hostName + ")";

                String        serverURL = "tcp://" + ipAddressServer + ":" + portServer.ToString() + "/ServerObject.rem";
                IServerObject ServerObj = (IServerObject)Activator.GetObject(typeof(IServerObject), serverURL);
                ListClientsInfo = ServerObj.GetClientsInfo();

                if (to == "*")
                {
                    ListSendServer = ListClientsInfo;
                    if (ListSendServer.Count == 0)
                    {
                        Console.Write("Sorry. There is nobody to send this message.");
                        return;
                    }
                }
                else
                {
                    String[] arrayTo = to.Split(';');
                    foreach (String arr in arrayTo)
                    {
                        String tmp = arr.Trim();
                        if (tmp == "")
                        {
                            continue;
                        }
                        ListSend.Add(tmp);
                    }


                    for (int i = 0; i < ListSend.Count; i++)
                    {
                        for (int j = 0; j < ListClientsInfo.Count; j++)
                        {
                            if (Regex.IsMatch(ListClientsInfo[j].ToString(), ListSend[i].ToString(), RegexOptions.IgnoreCase))
                            {
                                ListSendServer.Add(ListClientsInfo[j].ToString().Split(')')[0].Trim() + ")");
                            }
                        }
                    }
                    if (ListSendServer.Count > 0)
                    {
                        ListSendServer.Sort();
                        int index = 0;
                        while (index < ListSendServer.Count - 1)
                        {
                            if (ListSendServer[index] == ListSendServer[index + 1])
                            {
                                ListSendServer.RemoveAt(index);
                            }
                            else
                            {
                                index++;
                            }
                        }
                    }
                    else
                    {
                        Console.Write("Sorry. There is nobody to send this message.");
                        return;
                    }
                }

                AsyncCallback       SendMessageCallBack = new AsyncCallback(SendMessageReturned);
                SendMessageDelegate SMDel = new SendMessageDelegate(ServerObj.SendMessageToServer);
                IAsyncResult        SendMessageAsyncResult = SMDel.BeginInvoke(userName, ListSendServer, text, false, SendMessageCallBack, SMDel);
                Console.Write("The message has been sent.");
            }
            catch (Exception ex)
            {
                Console.Write("Cannot send this message. Either RSend server is offline or incorrect parameters in configuration file."); // + ex.ToString());
            }
        }
예제 #26
0
 /// <summary>
 /// Constructor Parametrizado
 /// </summary>
 /// <param name="remoteNetUser">El usuario remoto con el cual se intercambiará el archivo</param>
 /// <param name="sendMessageDelegate">Un método con el cual se puedan envíar mensajes a la MANET</param>
 /// <param name="fileInformation">La información del archivo</param>
 /// <param name="fileData">Los parámetros de configuración</param>
 public FileMessageReceiver(NetUser remoteNetUser, SendMessageDelegate sendMessageDelegate, FileInformation fileInformation, FileData fileData) : base(remoteNetUser, sendMessageDelegate, fileInformation, fileData)
 {
     thisLock         = new Object();
     this.Type        = FileMessageHandlerType.DOWNLOAD;
     this.downloadDir = fileData.DownloadDir;
 }
예제 #27
0
 public void UnregisterReporter(SendMessageDelegate sendMessageDelegate)
 {
     reporter -= sendMessageDelegate;
 }
예제 #28
0
 /// <summary>
 /// Initializes a new instance of the ExampleBase class, and sets the default output status message.
 /// </summary>
 protected ExampleBase()
 {
     OutputStatusMessage = OutputStatusMessageDefault;
 }
 public CustomerBillingExampleHelper(SendMessageDelegate OutputStatusMessageDefault)
 {
     OutputStatusMessage = OutputStatusMessageDefault;
 }
예제 #30
0
 /// <summary>
 /// Initializes a new instance of the ExampleBase class, and sets the default output status message.
 /// </summary>
 protected ExampleBase()
 {
     OutputStatusMessage = OutputStatusMessageDefault;
 }
 public BulkExampleHelper(SendMessageDelegate OutputStatusMessageDefault)
 {
     OutputStatusMessage = OutputStatusMessageDefault;
 }
예제 #32
0
 public void RegisterReporter(SendMessageDelegate sendMessageDelegate)
 {
     reporter += sendMessageDelegate;
 }
예제 #33
0
        /// <summary>
        /// Add an external controller device to X-Device SDK.
        /// </summary>
        public static int AddExternalControllerDevice(string name, ControllerStateDelegate converter, SendMessageDelegate sender)
        {
            System.IntPtr ptr = Marshal.StringToHGlobalAnsi(name);
            int           ret = NativeMethods.XDeviceAddExternalControllerDevice(ptr, converter, sender);

            Marshal.FreeHGlobal(ptr);
            return(ret);
        }
예제 #34
0
 /// <summary>
 /// 异步向服务器发送数据
 /// </summary>
 /// <param name="message"></param>
 private void AsyncSendMessage(CilentInfo message)
 {
     SendMessageDelegate d = new SendMessageDelegate(SendMessage);
     IAsyncResult result = d.BeginInvoke(message, null, null);
     while (!result.IsCompleted)
     {
         if (isExit)
             return;
         Thread.Sleep(50);
     }
     SendMessageStates states = new SendMessageStates();
     states.d = d;
     states.result = result;
     Thread t = new Thread(FinishAsyncSendMessage);
     t.IsBackground = true;
     t.Start(states);
 }
 public FileMessageHandler(NetUser remoteNetUser, SendMessageDelegate sendMessage, FileInformation fileInformation, FileData fileData)
 {
     this.Id = Guid.NewGuid();
     this.RemoteNetUser = remoteNetUser;
     this.sendMessage = sendMessage;
     this.FileInformation = fileInformation;
     this.PartSize = fileData.PartSize;
     State = FileMessageHandlerState.WAITING;
     MaxTimeOut = fileData.FileTimeOut;
     resetTimeOut();
 }
예제 #36
0
파일: BaseNet.cs 프로젝트: Venbb/Games
 public void setDelegate(SendMessageDelegate p_delegate)
 {
     this.m_delegate += p_delegate;
 }
예제 #37
0
 public Int32 SendMessage( Int32 ConnectionHandle, Hashtable InParameters, ref Hashtable OutParameters )
 {
     Int32 ReturnCode = Constants.ERROR_CONNECTION_DISCONNECTED;
     if( RemoteInterfaceAlive )
     {
         try
         {
             SendMessageDelegate DSendMessage = new SendMessageDelegate( RemoteInterface.SendMessage );
             IAsyncResult Result = DSendMessage.BeginInvoke( ConnectionHandle, InParameters, ref OutParameters, null, null );
             WaitHandle.WaitAny( new WaitHandle[2] { Result.AsyncWaitHandle, RemoteInterfaceDropped } );
             if( Result.IsCompleted )
             {
                 ReturnCode = DSendMessage.EndInvoke( ref OutParameters, Result );
             }
         }
         catch( Exception )
         {
             SignalConnectionDropped();
         }
     }
     return ReturnCode;
 }
 public CustomerManagementExampleHelper(SendMessageDelegate OutputStatusMessageDefault)
 {
     OutputStatusMessage = OutputStatusMessageDefault;
 }
예제 #39
0
파일: SMTP_Client.cs 프로젝트: dioptre/nkd
        public IAsyncResult BeginSendMessage(Stream message,AsyncCallback callback,object state)
        {
            if(this.IsDisposed){
                throw new ObjectDisposedException(this.GetType().Name);
            }
            if(!this.IsConnected){
                throw new InvalidOperationException("You must connect first.");
            }
            if(message == null){
                throw new ArgumentNullException("message");
            }

            SendMessageDelegate asyncMethod = new SendMessageDelegate(this.SendMessage);
            AsyncResultState asyncState = new AsyncResultState(this,asyncMethod,callback,state);
            asyncState.SetAsyncResult(asyncMethod.BeginInvoke(message,new AsyncCallback(asyncState.CompletedCallback),null));

            return asyncState;
        }
예제 #40
0
 public static extern bool SendMessageCallbackW(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam, SendMessageDelegate lpCallBack, IntPtr dwData);