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
<?xml version="1.0" encoding="utf-8" ?> | |
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | |
x:Class="MauiBorders.MainPage"> | |
<Grid Padding="16" | |
RowDefinitions="60,60,60,60,60" | |
ColumnDefinitions="*,*" | |
ColumnSpacing="16" | |
RowSpacing="16"> |
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 static class BrightnessHelper | |
{ | |
public static void SetBrightness(uint brightness) | |
{ | |
if (brightness > 100) | |
{ | |
throw new ArgumentOutOfRangeException("brightness"); | |
} | |
// get handle to primary display |
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 static bool TryGetCurrentActivity(out Activity activity) | |
{ | |
activity = null; | |
#if NET6_0_OR_GREATER | |
// check for Uno without taking a hard dependency | |
var t = Type.GetType("Uno.UI.ContextHelper, Uno, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null", false, true); | |
if (t != 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.Collections.Generic; | |
using System.Diagnostics; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
namespace BluetoothDiagnostics | |
{ | |
public sealed class BluetoothComPort | |
{ |
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
namespace Microsoft.Toolkit.Mvvm.Messaging.Messages | |
{ | |
public sealed class NotificationMessage<T> | |
{ | |
public NotificationMessage(T content, string notification) | |
{ | |
Content = content; | |
Notification = notification; | |
} |
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
var devices = DeviceInformation.FindAll(RfcommDeviceService.GetDeviceSelector(RfcommServiceId.SerialPort)); | |
var deviceInfo = devices[0]; // this makes some assumptions about your paired devices so really the results should be enumerated and checked for the correct device | |
var device = BluetoothDevice.FromDeviceInformation(deviceInfo); | |
var serResults = device.GetRfcommServices(BluetoothCacheMode.Cached); | |
foreach(RfcommDeviceService serv in serResults.Services) | |
{ | |
if(serv.ServiceId == RfcommServiceId.SerialPort) | |
{ | |
var stream = serv.OpenStream(); | |
byte[] buff = System.Text.Encoding.ASCII.GetBytes("Testing\r\n"); |
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; | |
namespace Xamarin.Forms.Platform.WinRT | |
{ | |
public static class ColorExtensions | |
{ | |
public static Windows.UI.Color ToWindows(this Xamarin.Forms.Color color) | |
{ | |
return Windows.UI.Color.FromArgb(Convert.ToByte(color.A * 255), Convert.ToByte(color.R * 255), Convert.ToByte(color.G * 255), Convert.ToByte(color.B * 255)); | |
} |
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 App() | |
{ | |
this.InitializeComponent(); | |
this.Suspending += OnSuspending; | |
_watcher = new BluetoothLEAdvertisementWatcher(); | |
_watcher.Received += _watcher_Received; | |
_watcher.Start(); | |
} |
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 Windows.Devices.Bluetooth; | |
namespace InTheHand.Devices.Bluetooth | |
{ | |
/// <summary> | |
/// Defines missing values in the <see cref="BluetoothMinorClass"/> enumeration for devices with a <see cref="BluetoothClassOfDevice.MajorClass"/> of Imaging. | |
/// </summary> | |
[Flags] | |
public enum BluetoothImagingMinorClass |
NewerOlder