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 Microsoft.Xaml.Behaviors; | |
using System.ComponentModel; | |
using System.Reflection; | |
using System.Windows; | |
public class ChangeAttachedPropertyAction : TargetedTriggerAction<UIElement> | |
{ | |
public Type? ClassType | |
{ | |
get { return (Type)GetValue(ClassTypeProperty); } |
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.Diagnostics; | |
public class CancelableProcessTask | |
{ | |
private readonly string _filename; | |
private readonly string _arguments; | |
private Process? _process; | |
private TaskCompletionSource? _tcs; |
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 var bus = new MessageBus(); | |
bool isCompleted = false; | |
var reactionDelay = TimeSpan.FromSeconds(0.25); | |
var timReactionDelay = TimeSpan.FromSeconds(0.3); | |
var ronnieSilenceThreshold = TimeSpan.FromSeconds(3); | |
bus.Messages | |
.Subscribe( | |
m => $"[{DateTime.Now:mm:ss.fff}] {m.Sender}: {m.Content}".Dump(), | |
() => isCompleted = true |
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.Windows; | |
using System.Windows.Controls; | |
public class GridHelper | |
{ | |
#region Rows & Columns | |
public static string GetRows(DependencyObject obj) | |
{ | |
return (string)obj.GetValue(RowsProperty); |
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
.md-alert-text { | |
font-size: 1rem; | |
font-weight: 600; | |
} | |
.md-alert-text-container::after { | |
text-transform: uppercase; | |
position: relative; | |
bottom: 1px; | |
} |
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 demo = new Demo(); | |
demo.FieldValue = 10; | |
demo.PropValue = 10; | |
// 修改字段的值 | |
ModifyFieldValue(ref demo.FieldValue, 42); | |
demo.FieldValue.Dump("Field Value"); | |
// 修改属性的值 | |
// ModifyFieldValue(ref demo.PropValue, 42); |
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; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Controls.Primitives; | |
namespace DataGridView | |
{ | |
public class MultiSelectorHelper | |
{ |
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
<Window x:Class="WpfTutorials.NuGetValueConverters.Views.MainWindow" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
xmlns:conv="clr-namespace:ValueConverters;assembly=ValueConverters" | |
Title="登录" | |
Width="800" | |
Height="600" | |
WindowStartupLocation="CenterScreen" |
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
from collections import Counter | |
from itertools import permutations | |
from matplotlib import pyplot as plt | |
COLS = 5 | |
ROWS = 6 | |
x1 = 10 | |
x2 = 10 |
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.Collections; | |
using System.Globalization; | |
using System.Windows.Data; | |
class ElementIndexConverter : IMultiValueConverter | |
{ | |
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) | |
{ | |
if (values.Length == 2 && values[0] is not null && values[1] is IList items) | |
return (items.IndexOf(values[0]) + 1).ToString(); |
NewerOlder