This file contains hidden or 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 ProfileService | |
{ | |
private static readonly Dictionary<string, int> _starValues | |
= new Dictionary<string, int> { | |
{"Star Empty", 0}, | |
{"Star Quarter", 25}, | |
{"Star Half", 50}, | |
{"Star ThreeQuarter", 75}, | |
{"Star Full", 100} | |
}; |
This file contains hidden or 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 ControlExtensions | |
{ | |
public static void Invoke(this Control control, MethodInvoker method) | |
{ | |
if (control.InvokeRequired == false) | |
{ | |
// The executing thread _is_ the thread that owns the control's underlying | |
// handle and as such, there is no need to marshall the method invocation. | |
method.Invoke(); | |
} |
This file contains hidden or 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
USE Musical; | |
CREATE TABLE dbo.Customer( | |
CustomerID INT PRIMARY KEY NOT NULL, | |
Title NVARCHAR(8), | |
FirstName NVARCHAR(50) NOT NULL, | |
LastName NVARCHAR(50) NOT NULL, | |
); | |
CREATE TABLE dbo.CustomerAddress( |
This file contains hidden or 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 static readonly HttpClient _client = new HttpClient(); | |
private async static void ObtainProfileData(string gamertag, string region) | |
{ | |
var response = await _client.GetAsync("http://live.xbox.com/" + region + "/Profile?gamertag=" + gamertag); | |
if (!response.IsSuccessStatusCode) | |
{ | |
Console.WriteLine("{0} Gamertag not found.", response.StatusCode); | |
return; |
This file contains hidden or 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 HotkeyTextBox : TextBox | |
{ | |
public Keys Modifier { get; private set; } | |
public Keys Key { get; private set; } | |
public HotkeyTextBox() | |
{ | |
Text = "None"; | |
GotFocus += delegate { NativeMethods.HideCaret(Handle); }; | |
} |
This file contains hidden or 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
http://i.imgur.com/mBZr0lv.png |
This file contains hidden or 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
Database.SetInitializer(new DropCreateDatabaseAlways<ApplicationDbContext>()); | |
Database.SetInitializer(new DropCreateDatabaseIfModelChanges<ApplicationDbContext>()); | |
Database.SetInitializer(new CreateDatabaseIfNotExists<ApplicationDbContext>()); | |
public class Doohickey : DropCreateDatabaseIfModelChanges<ApplicationDbContext> | |
{ | |
} |
This file contains hidden or 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 MainForm : Form | |
{ | |
private readonly YouTubeDownloadService _service = new YouTubeDownloadService(); | |
public class MainForm() | |
{ | |
_serivce.DownloadProgressChanged += OnDownloadProgressChanged; | |
} | |
private void DownloadVideo(string videoLocation, VideoResolution resoloution, VideoCodec codec) |
This file contains hidden or 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 ImgurService : IDisposable | |
{ | |
private HttpClient _client; | |
public string ClientID { get; private set; } | |
public ImgurService(string clientId) | |
{ | |
ClientID = clientId; | |
InitializeHttpClient(); | |
} |
This file contains hidden or 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 ContentTypeIdentifier | |
{ | |
public static ContentType IdentifyType(Stream contentStream) | |
{ | |
byte[] contentHeader = new byte[4]; | |
contentStream.Read(contentHeader, 0, 4); | |
return ResolveContentTypeBasedOnHeader(contentHeader); | |
} |