Skip to content

Instantly share code, notes, and snippets.

View abfo's full-sized avatar
☁️
Working on an LLM experiment called https://shopstories.us/

Robert Ellison abfo

☁️
Working on an LLM experiment called https://shopstories.us/
View GitHub Profile
private XImage ScanOne()
{
XImage ximage = null;
try
{
// find our device (scanner previously selected with commonDialog.ShowSelectDevice)
DeviceManager manager = new DeviceManager();
DeviceInfo deviceInfo = null;
foreach (DeviceInfo info in manager.DeviceInfos)
<Window x:Class="WpfFocusScopeTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
<Window.CommandBindings>
<CommandBinding Command="Paste" x:Name="bindingPaste" PreviewCanExecute="bindingPaste_PreviewCanExecute" />
</Window.CommandBindings>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" /><RowDefinition Height="Auto" /><RowDefinition />
public partial class MainWindow : Window
{
private DependencyObject _menuFocusScope;
private DependencyObject _toolbarFocusScope;
public MainWindow()
{
InitializeComponent();
}
static class NativeMethods
{
///
/// Reboot the computer
///
public static void Reboot()
{
IntPtr tokenHandle = IntPtr.Zero;
@abfo
abfo / Geo.html
Created September 30, 2018 17:11
<span class="geo">
<span class="latitude">37.754849</span>,
<span class="longitude">-122.446607</span>
</span>
@abfo
abfo / Shield.cs
Created September 30, 2018 17:14
BitmapSource shieldSource = null;
if (Environment.OSVersion.Version.Major >= 6)
{
SHSTOCKICONINFO sii = new SHSTOCKICONINFO();
sii.cbSize = (UInt32) Marshal.SizeOf(typeof(SHSTOCKICONINFO));
Marshal.ThrowExceptionForHR(SHGetStockIconInfo(SHSTOCKICONID.SIID_SHIELD,
SHGSI.SHGSI_ICON | SHGSI.SHGSI_SMALLICON,
ref sii));
@abfo
abfo / App.xaml
Created September 30, 2018 17:16
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="MasterResources.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="MasterResources.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/MyDll;component/ExternalResources.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
using (SmtpClient smtp = new SmtpClient())
{
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.UseDefaultCredentials = false;
smtp.EnableSsl = true;
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.Credentials = new NetworkCredential("email@gmail.com", "password");
// send the email
}