This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public sealed class CustomTextInputDialog : IDialog<string> | |
{ | |
private CustomTextInputDialog() | |
{ } | |
public string InputPrompt { get; private set; } | |
public string WrongInputPrompt { get; private set; } | |
public ICustomInputValidator Validator { get; private set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BookParkingDialogChain : IDialog<object> | |
{ | |
private string selectedName, selectedEmail, selectedPhoneNumber; | |
private string selectedLicensePlate; | |
private ParkingAreaDetails selectedParkingLocationDetails; | |
private DateTime arrivalDateTime, departureDateTime; | |
private ParkingLotDetails selectedParkingLot; | |
ParkAroundBot.Data.ReserveTravelResponse result; | |
private bool finalConfirmation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var api = { | |
"post": function (req, res, next) { | |
var sqlstring = 'UPDATE Highscore SET score=@score,playername=@playername WHERE id=@id'; | |
var query= {sql:sqlstring, | |
parameters:[ | |
{name:'score',value:req.body.score}, | |
{name:'playername',value:req.body.playername}, | |
{name:'id',value:req.body.id}]}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myObjects.Select((v, i) => new {myObject = v, index = i}).First(predicate).index; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static List<int> GetRandomNumbersAroundCorrectOne(int correctOne, int margin, int count) | |
{ | |
List<int> results = new List<int>(); | |
for (int i = 0; i < count; i++) | |
{ | |
//get the prosimo | |
int prosimo = 1;// ((NextRandom(1, 3) % 2) == 0) ? 1 : -1; | |
int number; | |
if (prosimo == 1) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static SoundEffectInstance sei; | |
public async static Task PlaySound(string soundPath, bool delay = true) | |
{ | |
Stream waveFileStream = TitleContainer.OpenStream(soundPath); | |
SoundEffect se = SoundEffect.FromStream(waveFileStream); | |
sei = se.CreateInstance(); | |
FrameworkDispatcher.Update(); | |
sei.Play(); | |
if (delay) | |
await Task.Delay(se.Duration); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Storyboard CreateOpacityStoryboard(FrameworkElement element) | |
{ | |
Storyboard sb = new Storyboard(); | |
DoubleAnimation opacityAnimation = new DoubleAnimation(); | |
opacityAnimation.From = 0; | |
opacityAnimation.To = 1; | |
opacityAnimation.Duration = TimeSpan.FromMilliseconds(300); | |
Storyboard.SetTarget(opacityAnimation, element); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ResolutionHelper | |
{ | |
public static Uri GetScaledImageUri(String imageName) | |
{ | |
int scaleFactor = (int)Application.Current.Host.Content.ScaleFactor; | |
switch (scaleFactor) | |
{ | |
case 100: return new Uri(imageName + "_wvga.png", UriKind.RelativeOrAbsolute); | |
case 150: return new Uri(imageName + "_720p.png", UriKind.RelativeOrAbsolute); | |
case 160: return new Uri(imageName + "_wxga.png", UriKind.RelativeOrAbsolute); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string GetDeviceInfo() | |
{ | |
string returnvalue = string.Empty; | |
try | |
{ | |
returnvalue = string.Format("manufacturer {0}, name {1}, firmware {2}, hardware {3}", | |
DeviceStatus.DeviceManufacturer, DeviceStatus.DeviceName, DeviceStatus.DeviceFirmwareVersion, DeviceStatus.DeviceHardwareVersion); | |
} | |
catch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async static Task CreateSleepStoryboard(int ms) | |
{ | |
Storyboard sb = new Storyboard(); | |
sb.Duration = TimeSpan.FromMilliseconds(ms); | |
await sb.BeginAsync(); | |
} |