// 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); } } }
/// <summary> /// Creates a new toolbar item attribute. Selecting the item in the toolbar will trigger the callback. /// </summary> /// <param name="name">Path that determines where in the menu to add the element. All path elements must be /// separated by /, for example "View/Toolbars/Find".</param> /// <param name="icon">Type of builtin icon to display on the toolbar entry.</param> /// <param name="tooltip">Optional tooltip to display when the user hovers over the toolbar entry.</param> /// <param name="priority">Priority determines the position of the toolbar item relative to its siblings. /// Higher priority means it will be placed earlier.</param> /// <param name="separator">Determines should a separator be inserted just before this element.</param> internal ToolbarItem(string name, ToolbarIcon icon, string tooltip = "", int priority = 0, bool separator = false) { this.name = name; this.icon = null; this.tooltip = tooltip; this.priority = priority; this.separator = separator; this.builtinIcon = (int)icon; }
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); }
private void setIconBinding() { string bindingPath = "SmallIcon"; bool useLargeIcons = Application.Current.FindResource("UseLargeIcons") as bool? ?? false; if (useLargeIcons) { bindingPath = "LargeIcon"; } Binding iconBinding = new Binding(bindingPath); iconBinding.Mode = BindingMode.OneWay; ToolbarIcon.SetBinding(Image.SourceProperty, iconBinding); }
/// <summary>Retrieves an icon that may be displayed on the main window's toolbar.</summary> public static SpriteTexture GetToolbarIcon(ToolbarIcon icon) { return(Internal_getToolbarIcon(icon)); }
private static extern SpriteTexture Internal_getToolbarIcon(ToolbarIcon icon);
// Displays a balloon message public void ShowBalloon(string Title, string Message, System.Windows.Forms.ToolTipIcon Icon) { ToolbarIcon.ShowBalloonTip(MessageDuration, Title, Message, Icon); }
private static extern SpriteTexture Internal_GetToolbarIcon(ToolbarIcon icon);
/// <summary> /// Retrieves an icon that may be displayed on the main window's toolbar. /// </summary> /// <param name="icon">Type of icon to retrieve.</param> /// <returns>Sprite texture of the icon.</returns> public static SpriteTexture GetToolbarIcon(ToolbarIcon icon) { return Internal_GetToolbarIcon(icon); }