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
// Example #1 | |
// Read the file as one string. | |
string text = System.IO.File.ReadAllText(@"C:\Users\Public\TestFolder\WriteText.txt"); | |
// Example #2 | |
// Read each line of the file into a string array. Each element | |
// of the array is one line of the file. | |
string[] lines = System.IO.File.ReadAllLines(@"C:\Users\Public\TestFolder\WriteLines2.txt"); |
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
// Compose a string that consists of three lines. | |
string lines = "First line.\r\nSecond line.\r\nThird line."; | |
// Write the string to a file. | |
System.IO.StreamWriter file = new System.IO.StreamWriter("c:\\test.txt"); | |
file.WriteLine(lines); | |
file.Close(); | |
//In order to append an existing file, set the Boolean parameter to true, as follows: |
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 HtmlSrc(string url) | |
{ | |
try | |
{ | |
HttpWebRequest myWebRequest = (HttpWebRequest)WebRequest.Create(url); | |
myWebRequest.Timeout = 5000; // Set time out | |
myWebRequest.ReadWriteTimeout = 6000; // Set Read Write time out | |
myWebRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1);Accept-Language:vi"; | |
WebResponse myWebResponse = myWebRequest.GetResponse(); | |
Stream ReceiveStream = myWebResponse.GetResponseStream(); |
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 struct SearchType | |
{ | |
public string url; | |
public string title; | |
public string content; | |
public FindingEngine engine; | |
public enum FindingEngine { Google, Bing, GoogleAndBing }; | |
} | |
public interface ISearchResult |
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 | |
} |
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
// 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
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
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
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"; |
OlderNewer