Skip to content

Instantly share code, notes, and snippets.

@marckm
marckm / wpf-mvvm-convention-datatemplates.cs
Last active August 29, 2015 14:11
WPF - generate datatemplate to bind VMs to Views using conventions
/// <summary>
/// DEMO CODE !!! TESTING PURPOSE ONLY
/// Generates on the fly the datatemplate to bind VMs to Views
/// </summary>
private void GenerateDataTemplatesForViewModels()
{
// http://www.codeproject.com/Articles/444371/Creating-WPF-Data-Templates-in-Code-The-Right-Way
var assemblyTypes = Assembly.GetExecutingAssembly().GetTypes().ToList();
foreach (var type in assemblyTypes)
@marckm
marckm / ValuesController.cs
Created April 16, 2013 09:45
Very simple API values controller
namespace DataIntegrationService.WebApi.Controllers
{
using System.Collections.Generic;
using System.Web.Http;
/// <summary>
/// Sample Api controller.
/// </summary>
public class ValuesController : ApiController
{
@marckm
marckm / Global.asax
Last active December 16, 2015 06:49
Default Global.asax content for WebApi
namespace DataIntegrationService.WebApi
{
using System;
using System.Web.Http;
/// <summary>
/// Global configuration of the Web Application.
/// </summary>
public class Global : System.Web.HttpApplication
{
@marckm
marckm / WebApiConfig.cs
Last active December 16, 2015 06:49
Default WebApiConfig.cs content
namespace DataIntegrationService
{
using System.Web.Http;
/// <summary>
/// Contains the configuration of Web Api.
/// </summary>
public class WebApiConfig
{
/// <summary>
@marckm
marckm / ProductionOrderDTO.cs
Created October 22, 2012 08:37
A simple ProductionOrderDTO
public class ProductionOrderDTO
{
public int Number { get; set; }
public string Reference { get; set; }
public long TargetQuantity { get; set; }
}
@marckm
marckm / ProductionOrder.cs
Created October 22, 2012 08:35
A simple ProductionOrder
public class ProductionOrder
{
public long ID { get; set; }
public int Number { get; set; }
public string Reference { get; set; }
public long TargetQuantity { get; set; }
}
@marckm
marckm / AssemblyInfo.cs
Created October 17, 2012 20:39
Remaining attributes in AssemblyInfo.cs files
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled
// through the following set of attributes.
// Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DemoApp")]
[assembly: AssemblyCulture("")]
@marckm
marckm / SharedAssemblyInfo.cs
Created October 17, 2012 20:26
Shared Assembly information
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyDescription("My shared AssemblyInfo sample.")]
#if (DEBUG)
[assembly: AssemblyConfiguration("Development version")]
#else
[assembly: AssemblyConfiguration("Release version")]
@marckm
marckm / Program.cs
Created October 17, 2012 10:17
App with no form : program.cs
namespace NoFormApplication
{
using System;
using System.Windows.Forms;
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
@marckm
marckm / CustomContext
Created October 16, 2012 14:18
Custom context managing application context with NotifyIcon
namespace NoFormApplication
{
using System;
using System.Windows.Forms;
using NoFormApplication.Properties;
/// <summary>
/// Application specific context used to create application's main standard loop without form.
/// </summary>
/// <see cref="http://msdn.microsoft.com/en-us/library/ms157901.aspx" />