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
namespace DataGridDummy | |
{ | |
/// <summary> | |
/// Interaction logic for MainWindow.xaml | |
/// </summary> | |
public partial class MainWindow : Window | |
{ | |
public MainWindow() | |
{ | |
Names= new ObservableCollection<string>(new List<string>(){"Johan"}); |
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
/// <summary> | |
/// Interaction logic for MainWindow.xaml | |
/// </summary> | |
public partial class MainWindow : Window | |
{ | |
public MainWindow() | |
{ | |
Names= new ObservableCollection<Person>(new List<Person>(){new Person(){Name = "Johan"}}); | |
this.DataContext = Names; | |
InitializeComponent(); |
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 A : IXmlSerializable | |
{ | |
public XmlSchema GetSchema() | |
{ | |
throw new NotImplementedException(); | |
} | |
public void ReadXml(XmlReader reader) | |
{ | |
throw new NotImplementedException(); |
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
<UserControl x:Class="Whitepad.Views.ColorButtons" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
xmlns:ViewModels="clr-namespace:Whitepad.ViewModels" | |
mc:Ignorable="d" d:DataContext="{d:DesignInstance IsDesignTimeCreatable=true, Type={x:Type ViewModels:ColorButtonsViewModel}}" d:DesignHeight="32" d:DesignWidth="128"> | |
<UserControl.Resources> | |
<Style x:Key="MyFocusVisual"> | |
<Setter Property="Control.Template"> |
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
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
this.scanDir=1; | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.fire(); | |
robot.ahead(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
public class DummyVm : INotifyPropertyChanged | |
{ | |
public DummyVm() | |
{ | |
this.Items= new ObservableCollection<DummyItem>(new List<DummyItem> | |
{ | |
new DummyItem(){Name = "Maverick", Country = "England"}, | |
new DummyItem(){Name = "Johan", Country = "SwedenLand"}, | |
new DummyItem(){Name = "Gregory", Country = "England"}, | |
new DummyItem(){Name = "Jackomel", Country = "Unknown"} |
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 DummyViewModel : INotifyPropertyChanged | |
{ | |
public DummyViewModel() | |
{ | |
Values= new ObservableCollection<Reading>(); | |
_timer = new Timer((o) => | |
{ | |
this.TextFromSerialPort = DateTime.Now.ToString(); | |
App.Current.Dispatcher.Invoke(()=>this.Values.Add(new Reading(DateTime.Now,"FakeValue " + DateTime.Now.ToString()))); | |
}, null, TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(0.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
[Test] | |
public void RegexTest() | |
{ | |
var pattern = @"^(CONNECT|DELETE|HEAD|GET|OPTIONS|POST|PUT|TRACE) (\/[\S]*) HTTP\/(1.0|1.1)$"; | |
var line = "test"; | |
var stopWatch = Stopwatch.StartNew(); | |
for (int i = 0; i < 2; i++) | |
{ | |
stopWatch.Restart(); |
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 KeyState | |
{ | |
public static bool IsKeyDown(VirtualKeyStates key) | |
{ | |
return GetKeyState(VirtualKeyStates.VK_LBUTTON) < 0; | |
} | |
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] | |
public static extern short GetKeyState(VirtualKeyStates nVirtKey); | |
} |
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
namespace Enum.Extensions { | |
/// http://stackoverflow.com/a/1086742/1069200 | |
public static class EnumerationExtensions { | |
public static bool Has<T>(this System.Enum type, T value) { | |
try { | |
return (((int)(object)type & (int)(object)value) == (int)(object)value); | |
} | |
catch { | |
return false; |
OlderNewer