本文整理汇总了C#中Memory.WriteInt32方法的典型用法代码示例。如果您正苦于以下问题:C# Memory.WriteInt32方法的具体用法?C# Memory.WriteInt32怎么用?C# Memory.WriteInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Memory
的用法示例。
在下文中一共展示了Memory.WriteInt32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DatePicker
public DatePicker()
{
mDatePicker = new Microsoft.Phone.Controls.DatePicker();
mView = mDatePicker;
mMaxDate = DateTime.MaxValue;
mMinDate = DateTime.MinValue;
mDatePicker.ValueChanged += new EventHandler<DateTimeValueChangedEventArgs>(
delegate(object from, DateTimeValueChangedEventArgs args)
{
Memory eventData = new Memory(20);
const int MAWidgetEventData_eventType = 0;
const int MAWidgetEventData_widgetHandle = 4;
const int MAWidgetEventDate_value_dayOfMonth = 8;
const int MAWidgetEventDate_value_month = 12;
const int MAWidgetEventDate_value_year = 16;
eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_DATE_PICKER_VALUE_CHANGED);
eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);
eventData.WriteInt32(MAWidgetEventDate_value_dayOfMonth, mDatePicker.Value.Value.Day);
eventData.WriteInt32(MAWidgetEventDate_value_month, mDatePicker.Value.Value.Month);
eventData.WriteInt32(MAWidgetEventDate_value_year, mDatePicker.Value.Value.Year);
mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
});
}
示例2: ToggleButton
/**
* Constructor
*/
public ToggleButton()
{
mToggleButton = new Microsoft.Phone.Controls.ToggleSwitch();
mView = mToggleButton;
/**
* implementation of the Click event
*/
mToggleButton.Click += new EventHandler<RoutedEventArgs>(
delegate(Object from, RoutedEventArgs evt)
{
//click event needs a memory chunk of 8 bytes
Memory eventData = new Memory(12);
//starting with the 0 Byte we write the eventType
const int MAWidgetEventData_eventType = 0;
//starting with the 4th Byte we write the widgetHandle
const int MAWidgetEventData_widgetHandle = 4;
//starting with the 8th Byte write the selectedIndex
const int MAWidgetEventData_checked = 8;
int state = mToggleButton.IsChecked.Value ? 1 : 0;
eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_CLICKED);
eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);
eventData.WriteInt32(MAWidgetEventData_checked, state);
//posting a CustomEvent
mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
});
}
示例3: ListView
/**
* Constructor
*/
public ListView()
{
mList = new System.Windows.Controls.ListBox();
mView = mList;
mList.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(
delegate(Object from, System.Windows.Input.GestureEventArgs evt)
{
//create a Memory object of 8 Bytes
Memory eventData = new Memory(12);
//starting with the 0 Byte we write the eventType
const int MAWidgetEventData_eventType = 0;
//starting with the 4th Byte we write the widgetHandle
const int MAWidgetEventData_widgetHandle = 4;
//starting with the 8th Byte we write the selectedIndex
const int MAWidgetEventData_selectedIndex = 8;
int selIndex = mList.SelectedIndex;
eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_ITEM_CLICKED);
eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);
if (selIndex > -1)
{
eventData.WriteInt32(MAWidgetEventData_selectedIndex, selIndex);
//posting a CustomEvent
mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
}
});
}
示例4: TimePicker
public TimePicker()
{
mTimePicker = new Microsoft.Phone.Controls.TimePicker();
CurrentHour = 0;
CurrentMinute = 0;
View = mTimePicker;
mTimePicker.ValueChanged += new EventHandler<Microsoft.Phone.Controls.DateTimeValueChangedEventArgs>(
delegate(object sender, Microsoft.Phone.Controls.DateTimeValueChangedEventArgs args)
{
Memory eventData = new Memory(16);
const int MAWidgetEventData_eventType = 0;
const int MAWidgetEventData_widgetHandle = 4;
const int MAWidgetEventDate_value_hours = 8;
const int MAWidgetEventDate_value_minutes = 12;
eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_TIME_PICKER_VALUE_CHANGED);
eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);
eventData.WriteInt32(MAWidgetEventDate_value_hours, mTimePicker.Value.Value.Hour);
eventData.WriteInt32(MAWidgetEventDate_value_minutes, mTimePicker.Value.Value.Minute);
mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
});
}
示例5: Button
/**
* The button constructor
*/
public Button()
{
//Initializing the button controll
mButton = new System.Windows.Controls.Button();
//Set the view of the current widget as the previously instantiated button controll
View = mButton;
mButton.HorizontalAlignment = HorizontalAlignment.Left;
mButton.VerticalAlignment = VerticalAlignment.Top;
this.Width = MoSync.Constants.MAW_CONSTANT_WRAP_CONTENT;
this.Height = MoSync.Constants.MAW_CONSTANT_WRAP_CONTENT;
//The click handle the button component
mButton.Click += new RoutedEventHandler(
delegate(Object from, RoutedEventArgs evt)
{
//Click event needs a memory chunk of 8 bytes
Memory eventData = new Memory(8);
const int MAWidgetEventData_eventType = 0;
const int MAWidgetEventData_widgetHandle = 4;
eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_CLICKED);
eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);
//Posting a CustomEvent
mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
});
}
示例6: VideoView
/**
* Constructor
*/
public VideoView()
{
mMediaElement = new MediaElement();
mView = mMediaElement;
/**
* the delegates that respond to the widget's events
*/
// MAW_VIDEO_VIEW_STATE_FINISHED
mMediaElement.MediaEnded += new RoutedEventHandler(
delegate(object from, RoutedEventArgs args)
{
// post the event to MoSync runtime
Memory eventData = new Memory(8);
const int MAWidgetEventData_eventType = 0;
const int MAWidgetEventData_widgetHandle = 4;
eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_VIDEO_VIEW_STATE_FINISHED);
eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);
mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
}
); // end of mMediaElement.MediaEnded
// MAW_VIDEO_VIEW_STATE_SOURCE_READY
mMediaElement.MediaOpened += new RoutedEventHandler(
delegate(object from, RoutedEventArgs args)
{
// post the event to MoSync runtime
Memory eventData = new Memory(8);
const int MAWidgetEventData_eventType = 0;
const int MAWidgetEventData_widgetHandle = 4;
eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_VIDEO_VIEW_STATE_SOURCE_READY);
eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);
mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
}
); // end of mMediaElement.MediaOpened
// MAW_VIDEO_VIEW_STATE_INTERRUPTED
mMediaElement.MediaFailed += new EventHandler<ExceptionRoutedEventArgs>(
delegate(object from, ExceptionRoutedEventArgs args)
{
// post the event to MoSync runtime
Memory eventData = new Memory(8);
const int MAWidgetEventData_eventType = 0;
const int MAWidgetEventData_widgetHandle = 4;
eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_VIDEO_VIEW_STATE_INTERRUPTED);
eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);
mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
}
); // end of mMediaElement.MediaFailed
}
示例7: CheckBox
/**
* Constructor
*/
public CheckBox()
{
mCheckBox = new System.Windows.Controls.CheckBox();
mView = mCheckBox;
mCheckBox.Click += new RoutedEventHandler(
delegate(Object from, RoutedEventArgs evt)
{
Memory eventData = new Memory(12);
const int MAWidgetEventData_eventType = 0;
const int MAWidgetEventData_widgetHandle = 4;
const int MAWidgetEventData_checked = 8;
eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_CLICKED);
eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);
eventData.WriteInt32(MAWidgetEventData_checked, mCheckBox.IsChecked.Value ? 1 : 0);
mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
});
}
示例8: MapPin
/**
* Constructor
*/
public MapPin()
{
mPushpin = new Microsoft.Phone.Controls.Maps.Pushpin();
mPushpin.Location = new System.Device.Location.GeoCoordinate();
View = mPushpin;
mPushpin.MouseLeftButtonDown += new MouseButtonEventHandler(
delegate(object from, MouseButtonEventArgs args)
{
/**
* post the event to MoSync runtime
*/
Memory eventData = new Memory(8);
const int MAWidgetEventData_eventType = 0;
const int MAWidgetEventData_widgetHandle = 4;
eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_MAP_PIN_CLICKED);
eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);
mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
}
);
}
示例9: Slider
//the constructor
public Slider()
{
mSlider = new System.Windows.Controls.Slider();
mSlider.Maximum = DEFAULT_MAX_VALUE;
mSlider.Minimum = DEFAULT_MIN_VALUE;
mMaxValue = DEFAULT_MAX_VALUE;
mMinValue = DEFAULT_MIN_VALUE;
mProgressValue = DEFAULT_MIN_VALUE;
mView = mSlider;
//the event handler
mSlider.ValueChanged += new RoutedPropertyChangedEventHandler<double>(
delegate(Object from, RoutedPropertyChangedEventArgs<double> arg)
{
mProgressValue = (Int32)arg.NewValue;
if (mProgressValue != (Int32)arg.OldValue)
{
////click event needs a memory chunk of 12 bytes
Memory eventData = new Memory(12);
//starting with the 0 Byte we write the eventType
const int MAWidgetEventData_eventType = 0;
//starting with the 4 Byte we write the widgetHandle
const int MAWidgetEventData_widgetHandle = 4;
//starting with the 8 Byte we write the sliderValue
const int MAWidgetEventData_sliderValue = 8;
eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_SLIDER_VALUE_CHANGED);
eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);
eventData.WriteInt32(MAWidgetEventData_sliderValue, mProgressValue);
//posting a CustomEvent
mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
}
});
}
示例10: NumberPicker
// 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);
});
}
示例11: DatePicker
public DatePicker()
{
// Initialization.
mDatePicker = new Microsoft.Phone.Controls.DatePicker();
mView = mDatePicker;
mUriString = new DatePickerPageCustomUriString();
mMaxDate = new DateTime(_maxYear, 12, 31);
mMinDate = new DateTime(_minYear, 1, 1);
mUriString.MaxDate = mMaxDate;
mUriString.MinDate = mMinDate;
mDatePicker.PickerPageUri = new Uri(mUriString.UriString, UriKind.Relative);
// The ValueChanged event handler. This is when the MoSync event is triggered.
mDatePicker.ValueChanged += new EventHandler<DateTimeValueChangedEventArgs>(
delegate(object from, DateTimeValueChangedEventArgs args)
{
Memory eventData = new Memory(20);
const int MAWidgetEventData_eventType = 0;
const int MAWidgetEventData_widgetHandle = 4;
const int MAWidgetEventDate_value_dayOfMonth = 8;
const int MAWidgetEventDate_value_month = 12;
const int MAWidgetEventDate_value_year = 16;
eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_DATE_PICKER_VALUE_CHANGED);
eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);
eventData.WriteInt32(MAWidgetEventDate_value_dayOfMonth, mDatePicker.Value.Value.Day);
eventData.WriteInt32(MAWidgetEventDate_value_month, mDatePicker.Value.Value.Month);
eventData.WriteInt32(MAWidgetEventDate_value_year, mDatePicker.Value.Value.Year);
mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
});
}
示例12: OrientationChangedHandler
/**
* The Orientation changed event handler.
* Currently it contains the functionality for the orientation changed event.
* @param from Object the object that triggers the event.
* @param args Microsoft.Phone.Controls.OrientationChangedEventArgs the event arguments.
*/
public void OrientationChangedHandler(object from, Microsoft.Phone.Controls.OrientationChangedEventArgs args)
{
PhoneApplicationPage currentPage = (((PhoneApplicationFrame)Application.Current.RootVisual).Content as PhoneApplicationPage);
// change the current page in regard to the current orientaion.
if (args.Orientation == PageOrientation.Landscape |
args.Orientation == PageOrientation.LandscapeLeft |
args.Orientation == PageOrientation.LandscapeRight)
{
currentPage.Height = Application.Current.Host.Content.ActualWidth;
currentPage.Width = Application.Current.Host.Content.ActualHeight;
}
else if (args.Orientation == PageOrientation.Portrait |
args.Orientation == PageOrientation.PortraitDown |
args.Orientation == PageOrientation.PortraitUp)
{
currentPage.Height = Application.Current.Host.Content.ActualHeight;
currentPage.Width = Application.Current.Host.Content.ActualWidth;
}
// send the event to the mosync runtime.
Memory eventData = new Memory(8);
const int MAWidgetEventData_eventType = 0;
const int MAWidgetEventData_widgetHandle = 4;
eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_SCREEN_ORIENTATION_DID_CHANGE);
eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);
mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
}
示例13: SearchBar
/**
* Constructor
*/
public SearchBar()
{
mSearchBar = new System.Windows.Controls.TextBox();
mView = mSearchBar;
mIsWatermarkMode = false;
mPlaceholderText = "";
// by default, the placeholder font color is gray
mWaterMarkBrush = new SolidColorBrush();
mWaterMarkBrush.Color = Colors.Gray;
mForegroundColor = mSearchBar.Foreground;
/**
* @brief Sent from the Search bar when it gains focus(the user selects the widget).
* The virtual keyboard is shown.
*/
mSearchBar.GotFocus += new RoutedEventHandler(
delegate(object from, RoutedEventArgs args)
{
/**
* simulating the placeholder/watermark
*/
// if watermark present and no user char has been entered
if (mIsWatermarkMode && mFirstChar)
{
// move the cursor to the first position
mSearchBar.Select(0, 0);
}
}
); // end of mEditBox.GotFocus
/**
* @brief Sent from the Search bar when it loses focus.
* The virtual keyboard is hidden.
*/
mSearchBar.LostFocus += new RoutedEventHandler(
delegate(object from, RoutedEventArgs args)
{
/**
* simulating the placeholder/watermark
*/
// if no text has been entered by the user than leave the watermark text
if (mSearchBar.Text.Equals(""))
{
setWatermarkMode(true);
}
}
); // end of mEditBox.LostFocus
/**
* @brief Sent from the Search bar when the text was changed.
* As the search bar allows searching while the user types, this is
* the place where we send the search event (the MAW_EVENT_CLICKED with
* the search button click 0 (0 = OK, 1 = CANCEL).
* The cancel search is not handled on the windows phone platform.
*/
mFirstChar = true;
mSearchBar.TextInputStart += new TextCompositionEventHandler(
delegate(object from, TextCompositionEventArgs args)
{
/**
* simulating the placeholder/watermark
*/
if (mFirstChar)
{
setWatermarkMode(false);
}
/**
* post the event to MoSync runtime
* MAW_EVENT_CLICKED + search button clicked = 0 (0 = OK, 1 = CANCEL)
*/
Memory eventData = new Memory(12);
const int MAWidgetEventData_eventType = 0;
const int MAWidgetEventData_widgetHandle = 4;
const int MAWidgetEventData_searchButtonClicked = 8;
eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_CLICKED);
eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);
eventData.WriteInt32(MAWidgetEventData_searchButtonClicked, 0);
mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
}
); // end of TextInputStart
}
示例14: stopVideo
// stop the video and MAW_VIDEO_VIEW_STATE_STOPPED
private void stopVideo()
{
// stop it
mMediaElement.Stop();
// post the event to MoSync runtime
Memory eventData = new Memory(12);
// set the main event type: MAW_EVENT_VIDEO_STATE_CHANGED
const int MAWidgetEventData_widgetEventType = 0;
const int MAWidgetEventData_widgetHandle = 4;
// set the banner event type: MAW_VIDEO_VIEW_STATE_STOPPED
const int MAWidgetEventData_eventType = 8;
eventData.WriteInt32(MAWidgetEventData_widgetEventType, MoSync.Constants.MAW_EVENT_VIDEO_STATE_CHANGED);
eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);
eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_VIDEO_VIEW_STATE_STOPPED);
mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
}
示例15: Pop
/**
* The pop implementation
*/
public void Pop()
{
/**
* If the stack has more than one item pop it and post the MAW_EVENT_STACK_SCREEN_POPPED event
*/
if (1 < mStack.Count)
{
/**
* STACK_SCREEN_POPPED event needs a memory chunk of 16 bytes
*/
Memory eventData = new Memory(16);
const int MAWidgetEventData_eventType = 0;
const int MAWidgetEventData_widgetHandle = 4;
const int MAWidgetEventData_fromHandle = 8;
const int MAWidgetEventData_toHandle = 12;
eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_STACK_SCREEN_POPPED);
eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle);
eventData.WriteInt32(MAWidgetEventData_fromHandle, (mStack.Pop() as Screen).GetHandle());
eventData.WriteInt32(MAWidgetEventData_toHandle, (mStack.Peek() as Screen).GetHandle());
/**
* posting a CustomEvent
*/
mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData);
}
/**
* If the stack is not empty show the top element of the stack
*/
if (0 < mStack.Count)
{
//MoSync.Util.RunActionOnMainThreadSync(() =>
//{
(View as Microsoft.Phone.Controls.PhoneApplicationPage).Content = (mStack.Peek() as NativeUI.WidgetBaseWindowsPhone).View;
//});
}
}