예제 #1
0
            // The constructor.
            public NumberPicker()
            {
                mPicker = new CustomNumberPicker();
                View = mPicker;

                Value = 0;

                // The ValueChanged event handler. This is when the MoSync event is triggered.
                mPicker.ValueChanged += new EventHandler<NumberPickerValueChangedEventArgs>(
                    delegate(object from, NumberPickerValueChangedEventArgs args)
                    {
                        Memory eventData = new Memory(12);

                        const int MAWidgetEventData_eventType = 0;
                        const int MAWidgetEventData_widgetHandle = 4;
                        const int MAWidgetEventDate_value = 8;
                        eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_NUMBER_PICKER_VALUE_CHANGED);
                        eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);
                        eventData.WriteInt32(MAWidgetEventDate_value, mPicker.Value.Value);

                        mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
                    });
            }
예제 #2
0
            // The constructor.
            public NumberPicker()
            {
                mPicker = new CustomNumberPicker();
                View = mPicker;

                Value = 0;

                // The ValueChanged event handler. This is when the MoSync event is triggered.
                mPicker.ValueChanged += new EventHandler<NumberPickerValueChangedEventArgs>(
                    delegate(object from, NumberPickerValueChangedEventArgs args)
                    {
                        Memory eventData = new Memory(12);

                        const int MAWidgetEventData_eventType = 0;
                        const int MAWidgetEventData_widgetHandle = 4;
                        const int MAWidgetEventDate_value = 8;
                        eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_NUMBER_PICKER_VALUE_CHANGED);
                        eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);
                        eventData.WriteInt32(MAWidgetEventDate_value, mPicker.Value.Value);

                        mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
                    });
            }