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("\"", "\"\"")}\"");
 }
Пример #2
0
        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
        }
Пример #3
0
 public static extern bool TranslateMessage([In] ref NativeMessage lpMsg);
Пример #4
0
 private static extern bool PeekMessage(out NativeMessage lpMsg, HandleRef hWnd, uint wMsgFilterMin, uint wMsgFilterMax, uint wRemoveMsg);
Пример #5
0
 private static extern bool PeekMessage(out NativeMessage msg, IntPtr hWnd, uint messageFilterMin, uint messageFilterMax, uint flags);
Пример #6
0
 static extern bool PeekMessage(out NativeMessage lpMsg, IntPtr hWnd, uint wMsgFilterMin, uint wMsgFilterMax, uint wRemoveMsg);
Пример #7
0
 public static extern int PeekMessage(out NativeMessage lpMsg, IntPtr hWnd, int wMsgFilterMin,
                                       int wMsgFilterMax, int wRemoveMsg);
Пример #8
0
        private static extern int GetMessage(
			out NativeMessage msg, IntPtr hWnd, uint wMsgFilterMin, uint wMsgFilterMax);
Пример #9
0
 public static extern int TranslateMessage(ref NativeMessage lpMsg);
Пример #10
0
 private static extern int TranslateMessage(ref NativeMessage lpMsg);
Пример #11
0
 private static extern bool PeekMessage(out NativeMessage pMsg, IntPtr pHWnd, uint pMessageFilterMin, uint pMessageFilterMax, uint pFlags);
Пример #12
0
 public static extern IntPtr DispatchMessage(ref NativeMessage lpmsg);
Пример #13
0
 private static extern bool PeekMessage(out NativeMessage message, IntPtr handle, uint filterMin, uint filterMax, uint removeMsg);
Пример #14
0
 protected virtual void OnHandleMessage(NativeMessage windowsMessage)
 {
 }
Пример #15
0
 public static extern bool PeekMessage(out NativeMessage message, IntPtr handle, uint filterMin, uint filterMax, uint flags);
Пример #16
0
 public static extern int PeekMessage(
     out NativeMessage lpMsg,
     IntPtr hWnd,
     int wMsgFilterMin,
     int wMsgFilterMax,
     int wRemoveMsg);
Пример #17
0
 private static extern int DispatchMessage(ref NativeMessage lpMsg);
Пример #18
0
        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));
        }
Пример #19
0
 private static extern bool PeekMessage(out NativeMessage message, IntPtr handle, uint filterMin, uint filterMax, uint removeMsg);
Пример #20
0
 public static extern int DispatchMessage(ref NativeMessage lpMsg);
Пример #21
0
 internal static extern bool PeekMessage(out NativeMessage message, IntPtr hwnd, uint messageFilterMin, uint messageFilterMax, uint flags);
Пример #22
0
 [DllImport("user32.dll", SetLastError = true, EntryPoint = "DispatchMessage"), SuppressUnmanagedCodeSecurity] private static extern int DispatchMessage(ref NativeMessage lpMsg);
Пример #23
0
 public static extern sbyte GetMessage(out NativeMessage lpMsg, IntPtr hWnd, uint wMsgFilterMin,
   uint wMsgFilterMax);
Пример #24
0
 private static extern int PeekMessage(out NativeMessage message, IntPtr window, uint filterMin, uint filterMax, uint remove);
Пример #25
0
 // Message Button click event
 public void OnMessagePopUp()
 {
     NativeMessage msg = new NativeMessage("TheAppGuruz", "Welcome To TheAppGuruz");
 }
Пример #26
0
 public static extern int DispatchMessage(ref NativeMessage lpMsg);
Пример #27
0
 private static extern int GetMessage(
     out NativeMessage msg, IntPtr hWnd, uint wMsgFilterMin, uint wMsgFilterMax);
Пример #28
0
 public static extern bool PeekMessage(ref NativeMessage lpMsg, IntPtr hWnd, uint wMsgFilterMin, uint wMsgFilterMax, PeekMessageRemoval wRemoveMsg);
Пример #29
0
 private static extern bool PeekMessage(out NativeMessage lpMsg, HandleRef hWnd, uint wMsgFilterMin, uint wMsgFilterMax, uint wRemoveMsg);
Пример #30
0
 public static extern IntPtr DispatchMessage([In] ref NativeMessage lpMsg);
Пример #31
0
 public static extern bool PeekMessage(out NativeMessage lpMsg, IntPtr hwnd, uint wMsgFilterMin, uint wMsgFilterMax, uint wRemoveMsg);
Пример #32
0
 public static extern int PeekMessage(out NativeMessage message, IntPtr window, uint filterMin, uint filterMax, uint remove);
Пример #33
0
 internal static extern bool PeekMessage(out NativeMessage lpMsg, int window, uint msgFilterMin, uint msgFilterMax, uint wRemoveMsg);
Пример #34
0
 public static extern int GetMessage(
     out NativeMessage lpMsg,
     IntPtr hWnd,
     int wMsgFilterMin,
     int wMsgFilterMax);
Пример #35
0
 internal static extern bool GetMessage(out NativeMessage lpMsg, int window, uint msgFilterMin, uint msgFilterMax);
Пример #36
0
 public static extern bool PeekMessage(out NativeMessage message, IntPtr window, uint filterMin, uint filterMax, uint remove);
Пример #37
0
 public static extern int PeekMessage(out NativeMessage lpMsg, IntPtr window, uint wMsgFilterMin, uint wMsgFilterMax, uint wRemoveMsg);
Пример #38
0
 private static extern bool PeekMessage(out NativeMessage msg, IntPtr hWnd, uint messageFilterMin, uint messageFilterMax, uint flags);
Пример #39
0
 /// <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());
 }
Пример #40
0
        private static extern bool PeekMessage(
			out NativeMessage msg, IntPtr hWnd,
			uint wMsgFilterMin, uint wMsgFilterMax, uint wRemoveMsg);
Пример #41
0
 public static extern sbyte GetMessage(out NativeMessage lpMsg, IntPtr hWnd, uint wMsgFilterMin,
                                       uint wMsgFilterMax);
Пример #42
0
 public static extern int GetMessage(out NativeMessage lpMsg, IntPtr hWnd, int wMsgFilterMin,
                                      int wMsgFilterMax);
 public static extern bool PeekMessage(out NativeMessage message, IntPtr handle, uint filterMin, uint filterMax, uint flags);
Пример #44
0
 public static extern int TranslateMessage(ref NativeMessage lpMsg);
Пример #45
0
 [DllImport("user32.dll", SetLastError = true, EntryPoint = "GetMessage"), SuppressUnmanagedCodeSecurity] private static extern int GetMessage(out NativeMessage lpMsg, IntPtr hWnd, int wMsgFilterMin, int wMsgFilterMax);