Get The Name Get The Actual Control For Specific Object Types
All posts by
.Checkbox
Checkbox xaml Click Handler Method For Multiple Checkboxes Example Checkbox states checked (IsChecked == true)unchecked (IsChecked == false)indeterminate (IsChecked == null) (only available if IsThreeState property = true)
Playing Audio Files
Playing Audio In A Page Add this to your .axml file <MediaElement Name=”audioplayer1″ AutoPlay=”False” Source = “Assets/audio_song.mp3” /> You can trigger playback like this audioplayer1.Play();
AND, OR and binary operations on variables
C# is not the same as C or C++!!!!! Simple byte operations for example do not result in a byte result, they often result in an Int32 result An example binary operation This will generat the error “Cannot implicitly convert type ‘int’ to ‘byte’. An explicit conversion exists (are you missing a cast)”: TxData[ByteIndex++] = […]
static
Class static variables A static variable shares the value of it among all instances of the class. static Local Variables in C# Nope, you can't have a static local variable in a method in C#, get over it. Declare them in the class. The reason – C# is an Object Oriented programing language, C (which […]
static
Class static variables A static variable shares the value of it among all instances of the class. static Local Variables in C# Nope, you can’t have a static local variable in a method in C#, get over it. Declare them in the class. The reason – C# is an Object Oriented programing language, C (which […]
DispatcherTimer
Using a DispatchedTimer To Call An Event Reguarly Note: A 45mS tick seems to be about the fastest this can be used for in our tests on a RPi 3, lower values don’t make it any faster Using a DispatchedTimer to call async methods
Async, Await, Task, etc
async A Method declared with async (e.g. public async void MyFucntion(… ) will run asnychronously, which means execution of the Method calling it will continue before it is complete. Task If you want to force it to be a waiting to complete use ‘Task’ as its return type (e.g. public async Task MyFucntion(… ) […]
.Arrays
List or Array? If your going to be resizing your array as you add and remove items often using a list is best (resizing an array causes it to be copied). If you need to be able to access array elements by index (rather than using for each) then use an array. If you need […]
Constants
You have to use constants within a class. So like this: public const int MY_NUMBER = 9; You’d need to put it in a class somewhere, and the usage would be ClassName.MY_NUMBER Number Defines public const int SOFTWARE_VERSION = 42; const int SOFTWARE_VERSION = 42; String Defines public const string MY_THINGS_PATH = “c:\\windows\\”; const […]