public static void Generate() { var message = new NativeMessage { Content = "Hello from native sender", SendOnUtc = DateTime.UtcNow }; var serializedMessage = JsonConvert.SerializeObject(message); Debug.WriteLine("Serialized message to paste in code:\n"); Debug.WriteLine($"@\"{serializedMessage.Replace("\"", "\"\"")}\""); }
public void Execute( ) { m_Running = true; #region Windows specific #if WINDOWS m_Form.Show( ); NativeMessage PeekedMessage = new NativeMessage( ); #endif #endregion while ( m_Running ) { #region Windows specific #if WINDOWS if ( !m_Form.Created ) { break; } if( Win32.PeekMessage( out PeekedMessage, m_Form.Handle, 0, 0, ( uint )PM.REMOVE ) ) { Win32.TranslateMessage( ref PeekedMessage ); Win32.DispatchMessage( ref PeekedMessage ); } else { #endif #endregion this.Update( ); this.Render( ); #region Windows specific #if WINDOWS } #endif #endregion } if( m_NetworkSession != null ) { m_NetworkSession.Dispose( ); m_NetworkSession = null; } #region Windows specific #if WINDOWS Application.Exit( ); #endif #endregion }
public static extern bool TranslateMessage([In] ref NativeMessage lpMsg);
private static extern bool PeekMessage(out NativeMessage lpMsg, HandleRef hWnd, uint wMsgFilterMin, uint wMsgFilterMax, uint wRemoveMsg);
private static extern bool PeekMessage(out NativeMessage msg, IntPtr hWnd, uint messageFilterMin, uint messageFilterMax, uint flags);
static extern bool PeekMessage(out NativeMessage lpMsg, IntPtr hWnd, uint wMsgFilterMin, uint wMsgFilterMax, uint wRemoveMsg);
public static extern int PeekMessage(out NativeMessage lpMsg, IntPtr hWnd, int wMsgFilterMin, int wMsgFilterMax, int wRemoveMsg);
private static extern int GetMessage( out NativeMessage msg, IntPtr hWnd, uint wMsgFilterMin, uint wMsgFilterMax);
public static extern int TranslateMessage(ref NativeMessage lpMsg);
private static extern int TranslateMessage(ref NativeMessage lpMsg);
private static extern bool PeekMessage(out NativeMessage pMsg, IntPtr pHWnd, uint pMessageFilterMin, uint pMessageFilterMax, uint pFlags);
public static extern IntPtr DispatchMessage(ref NativeMessage lpmsg);
private static extern bool PeekMessage(out NativeMessage message, IntPtr handle, uint filterMin, uint filterMax, uint removeMsg);
protected virtual void OnHandleMessage(NativeMessage windowsMessage) { }
public static extern bool PeekMessage(out NativeMessage message, IntPtr handle, uint filterMin, uint filterMax, uint flags);
public static extern int PeekMessage( out NativeMessage lpMsg, IntPtr hWnd, int wMsgFilterMin, int wMsgFilterMax, int wRemoveMsg);
private static extern int DispatchMessage(ref NativeMessage lpMsg);
internal void RunLoop() { // https://bugzilla.novell.com/show_bug.cgi?id=487896 // Since there's existing bug from implementation with mono WinForms since 09' // Application.Idle is not working as intended // So we're just going to emulate Application.Run just like Microsoft implementation _form.Show(); var nativeMsg = new NativeMessage(); while (_form != null && _form.IsDisposed == false) { if (PeekMessage(out nativeMsg, IntPtr.Zero, 0, 0, 0)) { Application.DoEvents(); if (nativeMsg.msg == WM_QUIT) break; continue; } UpdateWindows(); Game.Tick(); } // We need to remove the WM_QUIT message in the message // pump as it will keep us from restarting on this // same thread. // // This is critical for some NUnit runners which // typically will run all the tests on the same // process/thread. var msg = new NativeMessage(); do { if (msg.msg == WM_QUIT) break; Thread.Sleep(100); } while (PeekMessage(out msg, IntPtr.Zero, 0, 0, 1)); }
public static extern int DispatchMessage(ref NativeMessage lpMsg);
internal static extern bool PeekMessage(out NativeMessage message, IntPtr hwnd, uint messageFilterMin, uint messageFilterMax, uint flags);
[DllImport("user32.dll", SetLastError = true, EntryPoint = "DispatchMessage"), SuppressUnmanagedCodeSecurity] private static extern int DispatchMessage(ref NativeMessage lpMsg);
public static extern sbyte GetMessage(out NativeMessage lpMsg, IntPtr hWnd, uint wMsgFilterMin, uint wMsgFilterMax);
private static extern int PeekMessage(out NativeMessage message, IntPtr window, uint filterMin, uint filterMax, uint remove);
// Message Button click event public void OnMessagePopUp() { NativeMessage msg = new NativeMessage("TheAppGuruz", "Welcome To TheAppGuruz"); }
public static extern bool PeekMessage(ref NativeMessage lpMsg, IntPtr hWnd, uint wMsgFilterMin, uint wMsgFilterMax, PeekMessageRemoval wRemoveMsg);
public static extern IntPtr DispatchMessage([In] ref NativeMessage lpMsg);
public static extern bool PeekMessage(out NativeMessage lpMsg, IntPtr hwnd, uint wMsgFilterMin, uint wMsgFilterMax, uint wRemoveMsg);
public static extern int PeekMessage(out NativeMessage message, IntPtr window, uint filterMin, uint filterMax, uint remove);
internal static extern bool PeekMessage(out NativeMessage lpMsg, int window, uint msgFilterMin, uint msgFilterMax, uint wRemoveMsg);
public static extern int GetMessage( out NativeMessage lpMsg, IntPtr hWnd, int wMsgFilterMin, int wMsgFilterMax);
internal static extern bool GetMessage(out NativeMessage lpMsg, int window, uint msgFilterMin, uint msgFilterMax);
public static extern bool PeekMessage(out NativeMessage message, IntPtr window, uint filterMin, uint filterMax, uint remove);
public static extern int PeekMessage(out NativeMessage lpMsg, IntPtr window, uint wMsgFilterMin, uint wMsgFilterMax, uint wRemoveMsg);
/// <summary> /// Responds to the Android plugin side with an error. /// </summary> /// <param name="message"> /// A <see cref="NativeMessage"> object used to respond /// to the Android plugin side about the error. /// </param> /// <param name="error"> /// A <see cref="ShopifyError"> object that will be sent /// to the Android plugin side. /// </param> private void RespondError(NativeMessage message, ShopifyError error) { message.Respond(error.ToJsonString()); }
private static extern bool PeekMessage( out NativeMessage msg, IntPtr hWnd, uint wMsgFilterMin, uint wMsgFilterMax, uint wRemoveMsg);
public static extern int GetMessage(out NativeMessage lpMsg, IntPtr hWnd, int wMsgFilterMin, int wMsgFilterMax);
[DllImport("user32.dll", SetLastError = true, EntryPoint = "GetMessage"), SuppressUnmanagedCodeSecurity] private static extern int GetMessage(out NativeMessage lpMsg, IntPtr hWnd, int wMsgFilterMin, int wMsgFilterMax);