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
Example XAML: | |
<ListBox.ItemTemplate> | |
<DataTemplate> | |
<StackPanel> | |
<ProgressBar x:Name="PART_ProgressBar" /> | |
<Image> | |
<Image.Source> | |
<BitmapImage behaviors:ImageDownloadProgress.ProgressBar="{Binding ElementName=PART_ProgressBar}" UriSource="{Binding Image}" /> | |
</Image.Source> |
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
<ItemGroup> | |
<!-- Specify the folder, or files we want to include --> | |
<AdditionalPublishFiles Include="ListAndLabel\*.*"> | |
<Visible>False</Visible> | |
</AdditionalPublishFiles> | |
<!-- Alternative syntax, for individual files --> | |
<!-- | |
<AdditionalPublishFiles Include="ListAndLabel\cmbr15.dll;ListAndLabel\Cmct15.dll"> | |
<Visible>False</Visible> |
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 StringExtensions | |
{ | |
public static bool TryParseInt16(this string source, Func<short, bool> condition) | |
{ | |
short result = 0; | |
if (short.TryParse(source, out result)) | |
return condition(result); | |
else | |
return false; | |
} |
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
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
using System.Diagnostics.Contracts; | |
namespace System.Runtime.InteropServices | |
{ | |
/// <summary> |
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
int startTickCount = Environment.TickCount; | |
int timeout = 10000; | |
var dataSent = false; | |
var socket = tcpClient.Client; | |
while (dataSent == false) | |
{ | |
if (Environment.TickCount > startTickCount + timeout) | |
{ | |
throw new Exception("Timeout."); |
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
int offset = 0; | |
var socket = tcpClient.Client; | |
while (offset != data.Length) | |
{ | |
if (socket.Poll(30, SelectMode.SelectWrite)) | |
{ | |
offset += tcpClient.Client.Send(data, offset, data.Length - offset, SocketFlags.None); | |
} | |
} |
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 GeoLocationHelper | |
{ | |
public static GeoCoordinate ToWGS84(double x, double y) | |
{ | |
var axis = 6378137.0; | |
var flattening = 1.0 / 298.257222101; | |
var centralMeridian = 15.0 + 48.0 / 60.0 + 22.624306 / 3600.0; | |
var scale = 1.00000561024; | |
var falseNorthing = -667.711; | |
var falseEasting = 1500064.274; |
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
#pragma warning disable 0809 | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace ConsoleApplication1 | |
{ | |
public class Base | |
{ |
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 MeterTestDataContext : DbContext, IMeterTestDataContext | |
{ | |
public MeterTestDataContext(string fileOrServerOrConnection) | |
: base(fileOrServerOrConnection) | |
{ | |
} | |
protected override void OnModelCreating(DbModelBuilder modelBuilder) | |
{ | |
base.OnModelCreating(modelBuilder); |
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
class Test<PageType> : DbContext | |
where PageType : class | |
{ | |
private Dictionary<Type, PageType> callbacks = new Dictionary<Type, PageType>(); | |
protected override void OnModelCreating(DbModelBuilder modelBuilder) | |
{ | |
base.OnModelCreating(modelBuilder); | |
foreach (var type in callbacks.Keys) |