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
string[] arr = ... | |
List<string> list = new List<string>(arr); |
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
string str = "Hello World1"; | |
str = str.Remove(str.Length - 1); | |
//str is now "Hello World" |
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
private string CapitalizedString(string input) | |
{ | |
string[] arr = input.Split(' '); | |
string result = string.Empty; | |
foreach (string a in arr) | |
{ | |
result += a.First().ToString().ToUpper() + a.Substring(1) + " "; | |
} | |
return result.Trim(); |
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
private int CountChar(string src, char x) | |
{ | |
int count = 0; | |
for (int i = 0; i < src.Length; i++) | |
{ | |
//.ToString().ToUpper(): CaSe sensitive or not | |
if (x.ToString().ToUpper() == src[i].ToString().ToUpper()) count++; | |
} |
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
private void SaveImageClicked(object sender, GestureEventArgs e) | |
{ | |
var webClient = new WebClient(); | |
webClient.OpenReadCompleted += WebClientOpenReadCompleted; | |
webClient.OpenReadAsync(new Uri(IMAGE_URL, UriKind.Absolute)); | |
} | |
void WebClientOpenReadCompleted(object sender, OpenReadCompletedEventArgs e) | |
{ | |
const string tempJpeg = "TempJPEG"; |
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
webBrowser.ScriptErrorsSuppressed = true; |
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
MarketplaceReviewTask marketplaceReviewTask = new MarketplaceReviewTask(); | |
marketplaceReviewTask.Show(); |
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
// Put all file names in root directory into array. | |
string[] array1 = Directory.GetFiles(@"C:\"); | |
// Put all txt files in root directory into array. | |
string[] array2 = Directory.GetFiles(@"C:\", "*.TXT"); // <-- Case-insensitive |
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
private double CalculateConstraintScale(double rotation, int pixelWidth, int pixelHeight) | |
{ | |
double PiDiv180 = Math.PI / 180; | |
// Convert angle to radians for the math lib | |
double rotationRadians = rotation * PiDiv180; | |
// Centre is half the width and height | |
double width = pixelWidth / 2.0; |
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
The 3 screen resolutions for your reference are: | |
WVGA - 480x800 or 800x480 (15:9 ratio) | |
WXGA - 768x1280 or 1280x768 (15:9 ratio) | |
720p - 720x1280 or 1280x720 (16:9 ratio) | |
if(App.Current.Host.Content.ScaleFactor == 100) | |
{ | |
// WVGA | |
} |