public MainWindow() { InitializeComponent(); notifyIcon = new System.Windows.Forms.NotifyIcon(); using (Stream s = Application.GetResourceStream(new Uri("alarm.ico", UriKind.Relative)).Stream) notifyIcon.Icon = new System.Drawing.Icon(s); notifyIcon.Text = "알람"; notifyIcon.MouseDown += NotifyIcon_MouseDown; notifyIcon.DoubleClick += NotifyIcon_DoubleClick; notifyIcon.BalloonTipClicked += NotifyIcon_DoubleClick; notifyIcon.Visible = true; // timer for calculating current time. DispatcherTimer timer = new DispatcherTimer(); timer.Tick += Timer_Tick; timer.Interval = TimeSpan.FromMilliseconds(1000); timer.Start(); // load alarm sound StreamResourceInfo sri = Application.GetResourceStream(new Uri("/Resources/alarm.wav", UriKind.Relative)); if (sri != null) { using (Stream s = sri.Stream) { alarmSound = new SoundPlayer(s); alarmSound.Load(); } } patterns = new AlarmPatternDictionary(); patterns.LoadFromSettings(); btsButtons.Buttons = patterns.Patterns; btsButtons.SelectedIndex = App.Settings.Get("SelectedPatternIndex", 1); itemsAlarm.ItemsSource = Alarms.Collection; for (int i = 1; i <= 12; i++) { cbxAlarmHour.Items.Add(i); } for (int i = 1; i < 60; i++) { cbxAlarmMinute.Items.Add(i < 10 ? ("0" + i) : i.ToString()); } // Initial setting to show current time at first. Timer_Tick(null, null); }
public AlarmManager(AlarmPatternDictionary setting) { Collection = new ObservableCollection <Alarm>(); Settings = setting; }
public AlarmPattern(AlarmPatternDictionary settings) { Manager = new AlarmManager(settings); }