// Every 30 seconds evaluate the bookings to see if a message needs displaying private void Timer_Elapsed(object sender, ElapsedEventArgs e) { DataSnapshot Frame = DataRepository.TakeSnapshot(); // Get the current timeslot TimeSlot CurrentSlot = Frame.Periods.SingleOrDefault(t => t.IsCurrent(DateTime.Now)); if (CurrentSlot == null) { return; } // Get any matching bookings Booking Booking = Frame.Bookings.SingleOrDefault(b => b.MatchesDay(DateTime.Now.Date) && b.TimeSlot == CurrentSlot && b.Rooms.Contains(CurrentRoom)); if (Booking != null) { // If we haven't already shown this message if (LastSlot == null || LastSlot != CurrentSlot) { // Display the message LastSlot = CurrentSlot; ToolbarIcon.Visible = true; ToolbarIcon.ShowBalloonTip(MessageDuration, "Scheduled booking", "A lesson is taking place in this room this period (" + CurrentSlot.Name + ").\n" + "Teacher: " + Booking.Teacher.FormalName + "\n" + "Subject: " + Booking.Subject.SubjectName, System.Windows.Forms.ToolTipIcon.Info); } } }
private void HideToolStripMenuItem_Click(object sender, EventArgs e) { ToolbarIcon.Visible = true; Hide(); ToolbarIcon.BalloonTipIcon = ToolTipIcon.Info; ToolbarIcon.BalloonTipTitle = "OutLoud is still running!"; ToolbarIcon.BalloonTipText = "Double-click the OutLoud icon in the toolbar to re-show the main window!"; ToolbarIcon.ShowBalloonTip(3000); }
// Displays a balloon message public void ShowBalloon(string Title, string Message, System.Windows.Forms.ToolTipIcon Icon) { ToolbarIcon.ShowBalloonTip(MessageDuration, Title, Message, Icon); }