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
# syno-vpn-keepalive.sh | |
# --- | |
# Script to keep VPN alive on Synology DSM. | |
# Checks if IP is pingable and if not: | |
# disconnect VPN, reconnect VPN & add routes | |
# --- | |
# Modify vars: | |
# - CHECKIP: IP to check to be pingable before reconnecting VPN | |
# - NAME (Synology VPN name), | |
# - ID (Synology VPN ID), SSH to NAS & run this to find ID |
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.Windows; | |
using System.Windows.Controls; | |
public partial class CustomUserControlView : UserControl, INotifyPropertyChanged | |
{ | |
public CustomUserControlView() | |
{ | |
InitializeComponent(); | |
} |
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.Windows.Input; | |
public class RelayCommand : ICommand | |
{ | |
private Action<object> _execute; | |
private Func<object, bool> _canExecute; | |
public event EventHandler CanExecuteChanged | |
{ |
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.Generic; | |
using System.ComponentModel; | |
using System.Runtime.CompilerServices; | |
public abstract class ObservableObject : INotifyPropertyChanged | |
{ | |
public event PropertyChangedEventHandler PropertyChanged; | |
protected void OnPropertyChanged([CallerMemberName] string name = 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
[DllImport("user32.dll")] | |
[return: MarshalAs(UnmanagedType.Bool)] | |
static extern bool GetCursorPos(ref Win32Point pt); | |
[StructLayout(LayoutKind.Sequential)] | |
struct Win32Point | |
{ | |
public Int32 X; | |
public Int32 Y; | |
}; |
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 EditableProperty<T> : EditablePropertyBase<T> where T : IComparable | |
{ | |
protected override Dictionary<Func<bool>, T> ValidationRules { get; } = new Dictionary<Func<bool>, T>(); | |
public EditableProperty() | |
: base(default(T)) | |
{ | |
} | |
public EditableProperty(T value) |