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.ComponentModel; | |
using System.Runtime.CompilerServices; | |
using System.Windows.Forms; | |
public class BatteryStatus : INotifyPropertyChanged | |
{ | |
public BatteryChargeStatus BatteryChargeStatus => SystemInformation.PowerStatus.BatteryChargeStatus; // Flag | |
public int BatteryFullLifetime => SystemInformation.PowerStatus.BatteryFullLifetime; |
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.Concurrent; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Threading; | |
using System.Threading.Tasks; | |
public class StreamCopy | |
{ | |
private const int bufferSize = 1024 * 1024; // 1MiB |
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.Linq; | |
public static class BytesExtension | |
{ | |
public static byte[] SequenceReplace(this byte[] source, byte[] oldValue, byte[] newValue, int maxCount = -1) | |
{ | |
var sourceIndices = SequenceIndicesOf(source, oldValue, maxCount).ToArray(); |
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
// Add reference to WindowsBase and System.Xaml. | |
using System; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows.Media.Imaging; | |
public class ExifDate |
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.Collections.Generic; | |
using System.ComponentModel; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Runtime.InteropServices; | |
using System.Text.RegularExpressions; | |
using System.Windows; | |
using System.Windows.Interop; |
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.ObjectModel; | |
using System.Linq; | |
using System.Reactive.Linq; | |
using System.Threading.Tasks; | |
using Reactive.Bindings; | |
using Reactive.Bindings.Extensions; | |
public class Operation : BindableBase | |
{ | |
public ObservableCollection<ProfileItem> Profiles |
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 partial class App : Application | |
{ | |
protected override void OnStartup(StartupEventArgs e) | |
{ | |
base.OnStartup(e); | |
MessageBox.Show( | |
String.Format("IsProcessDPIAware: {0}", IsProcessDPIAware()) + Environment.NewLine + | |
String.Format("GetDpiAwareness: {0}", GetDpiAwareness())); | |
} |
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.Windows; | |
using System.Windows.Interop; | |
using System.Windows.Media; | |
public static class DisplayManager | |
{ |
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 ObservableCollection<Person> People = new ObservableCollection<Person>(); | |
public ReactiveProperty<bool> IsAnyRemoved; | |
// 元のメソッド | |
private void SubscribePeople0() | |
{ | |
Func<Person, bool> predicate = x => x.IsRemoved; | |
var peopleRemoved = new ObservableCollection<Person>(); |
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
// http://okazuki.hatenablog.com/entry/2015/03/17/025940 | |
var filtered = source.ToFilteredReadOnlyObservableCollection(x => x.IsRemoved); | |
ReactiveProperty<bool> IsAnyRemoved = filtered | |
.CollectionChangedAsObservable() | |
.Select(_ => 0 < filtered.Count) | |
.ToReactiveProperty(); |