Skip to content

Instantly share code, notes, and snippets.

View constructor-igor's full-sized avatar

Igor Ziselman constructor-igor

View GitHub Profile
$Outlook = New-Object -ComObject Outlook.Application
PM> $Mail = $Outlook.CreateItem(0)
PM> $Mail.to = "<email>"
PM> $Mail.Body = $dte.Debugger.CurrentStackFrame.Locals | ForEach-Object {$_.Name, $_.Type}
PM> $Mail.Send()
@constructor-igor
constructor-igor / Send email (outlook) from cake
Created October 16, 2016 08:52
Sending email (Outlook) from cake script.
#addin "Microsoft.Office.Interop.Outlook"
using Outlook = Microsoft.Office.Interop.Outlook;
// ...
Task("Send-email")
.Does(()=>
{
//https://msdn.microsoft.com/en-us/library/office/bb644320.aspx
var reportFilePath = MakeAbsolute(File("testReport.html")).ToString();
@constructor-igor
constructor-igor / AssemblyDirectory
Created October 24, 2016 21:40
AssemblyDirectory
//
// http://stackoverflow.com/questions/52797/how-do-i-get-the-path-of-the-assembly-the-code-is-in
//
private static string AssemblyDirectory
{
get
{
string codeBase = Assembly.GetExecutingAssembly().CodeBase;
UriBuilder uri = new UriBuilder(codeBase);
string path = Uri.UnescapeDataString(uri.Path);
function obj = LoadNetDll()
dllPath = '<full path to folder with .NET dll>\';
if isdir(dllPath)
dllPath = fullfile(dllPath,'<.NET dll name>.dll');
end
a = NET.addAssembly(dllPath);
@constructor-igor
constructor-igor / UnhandledException.cs
Created December 27, 2016 09:26
UnhandledException in WPF
Dispatcher.CurrentDispatcher.UnhandledException += CurrentDispatcher_UnhandledException;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
[HandleProcessCorruptedStateExceptions]
[SecurityCritical]
void CurrentDispatcher_UnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
var ex = e.Exception;
string message = ex.NameAndMessage();
string details = ex.GetDetailedMessage();