Exemplo n.º 1
0
        /// <summary>
        /// タイマー終了時イベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void TimeOverEvent(object sender, EventArgs e)
        {
            TimerDataViewModel vm = TimerButton.DataContext as TimerDataViewModel;

            vm.TimerOn = false;
            mTimer.Stop();
            //		MessageBox.Show("Time Over", "Timer Notify");
            mNotifyIcon.ShowBalloonTip(1000);
        }
Exemplo n.º 2
0
        /// <summary>
        /// タイマー用ボタンクリック時イベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TimerButton_Click(object sender, RoutedEventArgs e)
        {
            Button             button = sender as Button;
            TimerDataViewModel vm     = button.DataContext as TimerDataViewModel;

            vm.TimerOn = (vm.TimerOn ? false : true);

            // タイマー設定
            mTimer.Tick += TimeOverEvent;
            int hour    = HourList.SelectedIndex;
            int minutes = MinutesList.SelectedIndex;

            mTimer.Interval = new TimeSpan(0, hour, minutes, 0);
            mTimer.Start();
        }
Exemplo n.º 3
0
        public MainWindow()
        {
            InitializeComponent();

            System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer();

            timer.Tick    += DispTime;
            timer.Interval = new TimeSpan(0, 0, 0, 1);                  // 一秒おきにデリゲート実行
            timer.Start();

            TimerDataViewModel timervm = new TimerDataViewModel();

            TimerButton.DataContext = timervm;
            HourList.DataContext    = timervm;
            MinutesList.DataContext = timervm;

            mNotifyIcon                 = new System.Windows.Forms.NotifyIcon();
            mNotifyIcon.Text            = "Timer";
            mNotifyIcon.Icon            = new System.Drawing.Icon("Watch.ico");
            mNotifyIcon.Visible         = true;
            mNotifyIcon.BalloonTipText  = "タイマーが終了しました";
            mNotifyIcon.BalloonTipTitle = "Timer";
            mNotifyIcon.BalloonTipIcon  = System.Windows.Forms.ToolTipIcon.Info;
        }