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
[STAThread] | |
static void Main() | |
{ | |
ACTCTXW context = new ACTCTXW(); | |
context.cbSize = Marshal.SizeOf<ACTCTXW>(); | |
context.lpSource = "YourManifestFile.manifest"; | |
var handle = Win32.CreateActCtxW(ref context); | |
if (handle == IntPtr.Zero) | |
throw new Win32Exception(); |
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
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] | |
private static extern int MsgWaitForMultipleObjectsEx(int nCount, IntPtr pHandles, int dwMilliseconds, int dwWakeMask, int dwFlags); | |
private static Action _modalDoEvents; | |
// WinForms doesn't have a proper modal loop outside ShowDialog | |
// Sometimes we don't want ShowDialog, eg. for filter bar popups | |
// There we want the popup to close if we click outside of it, which doesn't work with ShowDialog | |
// | |
// The replacement would be message pumping with Application.DoEvents and waiting for new messages |
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 sealed class ArrayBinder : IBindingList, ITypedList | |
{ | |
private sealed class ArrayColumn : PropertyDescriptor | |
{ | |
public ArrayBinder Owner { get; } | |
public int ColumnIndex { get; } | |
public ArrayColumn(ArrayBinder owner, int index) | |
: base($"[{index}]", null) | |
{ |
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
using System; | |
using System.Reflection; | |
using System.Reflection.Emit; | |
namespace TestProgram | |
{ | |
delegate ref int GetRefIntoArrayDelegate(int[] array, int index); | |
class Program | |
{ |
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
try | |
{ | |
var script = CSharpScript.Create<int>("42", globalsType: typeof(Record)); | |
int count = 0; | |
var start = DateTime.UtcNow; | |
var now = start; | |
for (;;) | |
{ | |
for (int i = 0; i < 100; i++) |
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
using System; | |
using System.Runtime.InteropServices; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Interop; | |
using Microsoft.Wpf.Interop.DirectX; | |
using SharpDX; | |
using SharpDX.D3DCompiler; | |
using SharpDX.Direct3D; | |
using SharpDX.Direct3D11; |
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
private static async Task<CompletionResult> GetCompletionData(ScriptEditorControl parent, CancellationToken cancellationToken = default(CancellationToken)) | |
{ | |
if (!parent.ContainsScript) | |
return null; | |
var doc = parent.GetScriptDocument(); | |
var model = await doc.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); | |
var syntax = await doc.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); | |
var text = parent.GetScriptView().CurrentText; |