- Presentation.WPF - Main path in presentation layer for WPF
- Views - Views xaml to be located here
- Controls - Page xaml like things here
- Converters - UI Converters here
- Validators - Validation code here
- Windows - Window xaml files here
- ViewModels - ViewModels matching names of views/windows here
- Themes - Global themes to be uesd in Views and reused
- Views - Views xaml to be located here
- Resources - Files like StringResources.xaml, StringResources.fr-CA.xaml here
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 Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| var sqlConfig = MsSqlConfiguration.MsSql2008.ConnectionString(@"Server=.\SQLEXPRESS;Database=testdb3;Trusted_Connection=True;"); | |
| var config = PostgreSQLConfiguration.PostgreSQL82.ConnectionString(c => | |
| c.Database("testdb3") | |
| .Host("localhost") | |
| .Port(5432) |
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 DisposableStopwatch: IDisposable { | |
| private readonly Stopwatch sw; | |
| private readonly Action<TimeSpan> f; | |
| public DisposableStopwatch(Action<TimeSpan> f) { | |
| this.f = f; | |
| sw = Stopwatch.StartNew(); | |
| } | |
| public void Dispose() { |
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
| #region Authentication | |
| private List<string> getGroupNames(string userName) | |
| { | |
| using (var pc = new PrincipalContext(ContextType.Domain, _domainUri)) | |
| { | |
| var identity = UserPrincipal.FindByIdentity(pc, userName); | |
| if (identity == null) | |
| return new List<string>(); | |
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
| //original http://stackoverflow.com/a/7472334/518 | |
| var cancellationTokenSource = new CancellationTokenSource(); | |
| var task = Repeat.Interval( | |
| TimeSpan.FromSeconds(15), | |
| () => CheckDatabaseForNewReports(), cancellationTokenSource.Token); | |
| internal static class Repeat | |
| { |
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://stackoverflow.com/a/10407992/51841 | |
| using System; | |
| using System.Linq; | |
| using System.Net; | |
| using System.Web; | |
| public class RequestHelpers | |
| { | |
| public static string GetClientIpAddress(HttpRequestBase request) |
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
| In code: | |
| <Button | |
| Content="{DynamicResource Previous}" | |
| Command="{Binding PrevView}" Grid.Column="0"/> | |
| <Window.Resources> | |
| <ResourceDictionary> | |
| <!--<Selectors:ViewSelector x:Key="ViewSelector"> | |
| </Selectors:ViewSelector>--> | |
| <ResourceDictionary.MergedDictionaries> |
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
| //API | |
| public async Task<HttpResponseMessage> DeployPackage() | |
| { | |
| if (!Request.Content.IsMimeMultipartContent("form-data")) | |
| { | |
| throw new HttpResponseException(HttpStatusCode.BadRequest); | |
| } |
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
| function wait-websiteup($testUrl, $timeoutSeconds){ | |
| $webClient = new-object System.Net.WebClient | |
| $webClient.Headers.Add(“user-agent”, “PowerShell Script”) | |
| $startTime = get-date | |
| while (1 -eq 1) { | |
| $output = “” | |
| try{ |
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
| // C# Comb Guid generation | |
| // Found at http://stackoverflow.com/questions/665417/sequential-guid-in-linq-to-sql/2187898#2187898 | |
| Guid GenerateComb() | |
| { | |
| byte[] destinationArray = Guid.NewGuid().ToByteArray(); | |
| DateTime time = new DateTime(0x76c, 1, 1); | |
| DateTime now = DateTime.Now; | |
| TimeSpan span = new TimeSpan(now.Ticks - time.Ticks); | |
| TimeSpan timeOfDay = now.TimeOfDay; |