コード例 #1
0
        public static KnockStateMachine GetMachine()
        {
            if (KnockStateMachine.singleton == null)
            {
                KnockStateMachine.singleton = new KnockStateMachine();
            }

            return(KnockStateMachine.singleton);
        }
コード例 #2
0
        public MainWindow()
        {
            InitializeComponent();

            this.vm = new MainWindowViewModel();
            this.vm.ScreenBounds = this.GetScreenSize();
            this.DataContext     = this.vm;

            this.mouseOutsideMargin = Math.Floor(this.vm.ScreenBounds.Width * 0.15d);

            this.ksm          = KnockStateMachine.GetMachine();
            this.ksm.OnKnock += Ksm_OnKnock;

            this.mouseTimer          = new DispatcherTimer();
            this.mouseTimer.Interval = new TimeSpan(0, 0, 0, 0, 50);
            this.mouseTimer.Tick    += MouseTimer_Tick;
            this.mouseTimer.Start();

            SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged;
        }