示例#1
0
        /// <summary>
        /// Handles notification messages from the native control
        /// </summary>
        /// <param name="m">Message</param>
        protected override void OnNotifyMessage(ref Microsoft.WindowsCE.Forms.Message m)
        {
            if (OpenNETCF.Windows.Forms.StaticMethods.IsDesignMode(this))
            {
                return;
            }

            //marshal data to custom nmhtml struct
            //Marshal.PtrToStructure doesn't work so marshalling items individually
            NM_VOICERECORDER nmvr = new NM_VOICERECORDER();

            nmvr.hwndFrom = (IntPtr)Marshal.ReadInt32(m.LParam, 0);
            nmvr.idFrom   = Marshal.ReadInt32(m.LParam, 4);
            nmvr.code     = (VoiceRecorderNotification)Marshal.ReadInt32(m.LParam, 8);
            nmvr.dwExtra  = Marshal.ReadInt32(m.LParam, 12);

            //check the incoming message code and process as required
            switch (nmvr.code)
            {
            case VoiceRecorderNotification.VRN_PLAY_START:
                OnPlay(EventArgs.Empty);
                break;

            case VoiceRecorderNotification.VRN_PLAY_STOP:
            case VoiceRecorderNotification.VRN_RECORD_STOP:
                OnStop(EventArgs.Empty);
                break;

            case VoiceRecorderNotification.VRN_RECORD_START:
                OnRecord(EventArgs.Empty);
                break;

            case VoiceRecorderNotification.VRN_OK:
                OnOk(EventArgs.Empty);
                break;

            case VoiceRecorderNotification.VRN_CANCEL:
                OnCancel(EventArgs.Empty);
                break;

            case VoiceRecorderNotification.VRN_ERROR:
                OnError(EventArgs.Empty);
                break;
            }
        }
		/// <summary>
		/// Handles notification messages from the native control
		/// </summary>
		/// <param name="m">Message</param>
		protected override void OnNotifyMessage(ref Microsoft.WindowsCE.Forms.Message m)
		{
			//marshal data to custom nmhtml struct
			//Marshal.PtrToStructure doesn't work so marshalling items individually
			NM_VOICERECORDER nmvr = new NM_VOICERECORDER();
			nmvr.hwndFrom = (IntPtr)Marshal.ReadInt32(m.LParam, 0);
			nmvr.idFrom = Marshal.ReadInt32(m.LParam, 4);
			nmvr.code = (VoiceRecorderNotification)Marshal.ReadInt32(m.LParam, 8);
			nmvr.dwExtra = Marshal.ReadInt32(m.LParam, 12);

			//check the incoming message code and process as required
			switch(nmvr.code)
			{
				case VoiceRecorderNotification.VRN_PLAY_START:
					OnPlay(EventArgs.Empty);
					break;

				case VoiceRecorderNotification.VRN_PLAY_STOP:
				case VoiceRecorderNotification.VRN_RECORD_STOP:
					OnStop(EventArgs.Empty);
					break;

				case VoiceRecorderNotification.VRN_RECORD_START:
					OnRecord(EventArgs.Empty);
					break;

				case VoiceRecorderNotification.VRN_OK:
					OnOk(EventArgs.Empty);
					break;

				case VoiceRecorderNotification.VRN_CANCEL:
					OnCancel(EventArgs.Empty);
					break;

				case VoiceRecorderNotification.VRN_ERROR:
					OnError(EventArgs.Empty);
					break;
			}
		}