Example #1
0
 void Counter()
 {
     a = System.Convert.ToInt32(walletAll.text);
     if (a < PlayerPrefs.GetInt("cash") - 200)
     {
         a += 300;
         walletAll.fontSize = 28;
         Invoke("fountStyle", 0.05f);
     }
     else
     {
         a = PlayerPrefs.GetInt("cash");
         CancelInvoke("Counter");
         Invoke("animatoreValueSet", 3f);
         walletAll.gameObject.GetComponent <Animator>().SetInteger("Coinscounted", 1);
         dontDestroy.instance.sound[8].Stop();
     }
     walletAll.text = a.ToString();
     if (a > 3000)
     {
         NotificationIcon.SetActive(true);
     }
     else
     {
         NotificationIcon.SetActive(false);
     }
 }
 Rectangle2D CalculateIconSourceRectangle(NotificationIcon notificationIcon)
 {
     return(new Rectangle2D((int)notificationIcon % 8 * 20,
                            (int)notificationIcon / 8 * 20,
                            20,
                            20));
 }
Example #3
0
 public override void CloseForm(MainForm form)
 {
     if (_icon != null) {
         _icon.Dispose();
         _icon = null;
     }
 }
Example #4
0
        private void Main_Load(object sender, EventArgs e)
        {
            if (Settings.Default.MinimizeToTray)
            {
                ThreadPool.QueueUserWorkItem((_) => {
                    Thread.Sleep(100);                     // HACK: Work around issue where minimizing to tray keeps icon in taskbar.
                    Invoke(new Action(() => {
                        this.WindowState         = FormWindowState.Minimized;
                        this.Visible             = false;
                        NotificationIcon.Visible = true;
                        NotificationIcon.ShowBalloonTip(2000, "Whisper Notifier Started Minimized", "PoEWhisperNotifier started minimized. Double click the icon to show the window.", ToolTipIcon.Info);
                    }));
                });
            }
            else if (Settings.Default.StartMinimized)
            {
                this.WindowState = FormWindowState.Minimized;
            }
            else
            {
                this.WindowState = FormWindowState.Normal;
            }

            StartMonitoring(true);
        }
Example #5
0
        public static void NotifyMessage(string title, string message, NotificationIcon icon = NotificationIcon.None, ImageSource image = null)
        {
            NotificationType type;

            switch (icon)
            {
            case NotificationIcon.None:
                type = NotificationType.None;
                break;

            case NotificationIcon.Information:
                type = NotificationType.Information;
                break;

            case NotificationIcon.Warning:
                type = NotificationType.Warning;
                break;

            case NotificationIcon.Question:
                type = NotificationType.Question;
                break;

            case NotificationIcon.Error:
                type = NotificationType.Error;
                break;

            default:
                type = NotificationType.None;
                break;
            }
            Application.Current.Dispatcher.BeginInvoke((Action)(() =>
                                                                _toast.AddNotification(new KongariToast.Notification {
                Title = title, Message = message, Image = image, NotificationType = type
            })));
        }
Example #6
0
        /// <summary>
        /// Schedule simple notification without app icon.
        /// </summary>
        /// <param name="smallIcon">List of build-in small icons: notification_icon_bell (default), notification_icon_clock, notification_icon_heart, notification_icon_message, notification_icon_nut, notification_icon_star, notification_icon_warning.</param>
        public static int Send(double delay, NotificationType notificationType, NotificationIcon smallIcon = 0)
        {
            if (GetLastNotificationSendId(notificationType) >= 0)
            {
                Cancel(notificationType);
            }

            int id = SendCustom(new NotificationParams
            {
                Id             = UnityEngine.Random.Range(0, int.MaxValue),
                Delay          = TimeSpan.FromSeconds(delay),
                Title          = GetTitle(notificationType),
                Message        = GetMessage(notificationType),
                Ticker         = GetMessage(notificationType),
                Sound          = true,
                Vibrate        = true,
                Light          = true,
                SmallIcon      = smallIcon,
                SmallIconColor = new Color(.8f, 0, 0),
                LargeIcon      = ""
            });

            SetLastNotificationSendId(notificationType, id);
            return(id);
        }
Example #7
0
 private void MenuItem_OnClick(object sender, RoutedEventArgs e)
 {
     _managementEventWatcher.Stop();
     _managementEventWatcher.Dispose();
     NotificationIcon.Dispose();
     Application.Current.Shutdown(0);
 }
Example #8
0
 public void Setup()
 {
     am = MonoBehaviour.Instantiate(TestConstants.GetResource("Managers/Achievement Manager")).GetComponent <AchievementManager>();
     gs = MonoBehaviour.Instantiate(TestConstants.GetResource("Managers/Game Settings")).GetComponent <GameSettingsManager>();
     hm = MonoBehaviour.Instantiate(TestConstants.GetResource("Managers/Highscore Manager")).GetComponent <HighscoreManager>();
     notificationIcon = MonoBehaviour.Instantiate(TestConstants.GetResource("Notification Icon").GetComponent <NotificationIcon>());
 }
        private static void TrayIcon_NotificationIconSelected(NotificationIcon icon)
        {
            if (icon.MenuItems.Count > 0)
            {
                return;
            }

            var checkMenuItem = new NotificationMenuItem("Set Check On Clicked");

            checkMenuItem.NotificationMenuItemSelected += CheckMenuItem_NotificationMenuItemSelected;

            var disableMenuItem = new NotificationMenuItem("Disable On Clicked");

            disableMenuItem.NotificationMenuItemSelected += DisableMenuItem_NotificationMenuItemSelected;

            var setTextMenuItem = new NotificationMenuItem("Set Text On Click");

            setTextMenuItem.NotificationMenuItemSelected += SetTextMenuItem_NotificationMenuItemSelected;

            var subMenuMenuItem = new NotificationMenuItem("Create Sub Menu On Click");

            subMenuMenuItem.NotificationMenuItemSelected += SubMenuMenuItem_NotificationMenuItemSelected;

            icon.AddMenuItem(checkMenuItem);
            icon.AddMenuItem(disableMenuItem);
            icon.AddMenuItem(setTextMenuItem);
            icon.AddMenuItem(subMenuMenuItem);
        }
Example #10
0
 /// <inheritdoc />
 public void Dispose()
 {
     lock (_lock)
     {
         NotificationIcon?.Dispose();
         NotificationIcon = null;
     }
 }
Example #11
0
 public override void CloseForm(MainForm form)
 {
     if (_icon != null)
     {
         _icon.Dispose();
         _icon = null;
     }
 }
 private void ThemeControl_Resize(object sender, EventArgs e)
 {
     if (WindowState == FormWindowState.Minimized)
     {
         NotificationIcon.ShowBalloonTip(500);
         Hide();
     }
 }
Example #13
0
        public void TestCreateTime()
        {
            var now = DateTime.Now;

            var newTime = NotificationIcon.CreateDate(now, "22:00:00");

            Assert.AreEqual(newTime, new DateTime(now.Year, now.Month, now.Day, 22, 0, 0), "Failed to create date time");
        }
Example #14
0
        private void Exit_Click(object sender, EventArgs e)
        {
            NotificationIcon.Visible = false;
            NotificationIcon.Dispose();

            _cts.Cancel();

            Application.Exit();
        }
Example #15
0
 /// <inheritdoc />
 public void ShowBalloonTipFor(int timeoutInMilliseconds, string title, string text, ToolTipIcon icon,
                               Action clickAction = null, Action closeAction = null)
 {
     lock (this)
     {
         _balloonTipClickHandlers = new BalloonTipClickHandlerRegistration(clickAction, closeAction);
     }
     NotificationIcon.ShowBalloonTip(timeoutInMilliseconds, title, text, icon);
 }
Example #16
0
        /// <summary>
        /// Creates a more advanced (SMS-alike) <see cref="Notification"/> above the minimap showing a sender icon, subject and the message.
        /// </summary>
        /// <param name="icon">The notification icon.</param>
        /// <param name="sender">The sender name.</param>
        /// <param name="subject">The subject line.</param>
        /// <param name="message">The message itself.</param>
        /// <param name="fadeIn">If <c>true</c> the message will fade in.</param>
        /// <param name="blinking">if set to <c>true</c> the notification will blink.</param>
        /// <returns>The handle of the <see cref="Notification"/> which can be used to hide it using <see cref="Notification.Hide(int)"/>.</returns>
        public static int Show(NotificationIcon icon, string sender, string subject, string message, bool fadeIn = false, bool blinking = false)
        {
            string iconName = iconNames[(int)icon];

            Function.Call(Hash.BEGIN_TEXT_COMMAND_THEFEED_POST, SHVDN.NativeMemory.CellEmailBcon);
            SHVDN.NativeFunc.PushLongString(message);
            Function.Call(Hash.END_TEXT_COMMAND_THEFEED_POST_MESSAGETEXT, iconName, iconName, fadeIn, 1, sender, subject);

            return(Function.Call <int>(Hash.END_TEXT_COMMAND_THEFEED_POST_TICKER, blinking, true));
        }
Example #17
0
        public Notification getNotification(bool generateHaveToAct)
        {
            int  sourceIndex = random.Next(0, sourcesNumber);
            bool isSilent    = random.Next(0, 2) == 0;

            if (generateHaveToAct)
            {
                sourceIndex = mapNameToIndex();
                isSilent    = false;
            }
            string             id = Guid.NewGuid().ToString();
            NotificationSource notificationSource = (NotificationSource)Enum.GetValues(typeof(NotificationSource)).GetValue(sourceIndex);
            string             sourceName         = EnumDescription.getDescription(notificationSource);
            NotificationImage  notificationImage  = (NotificationImage)Enum.GetValues(typeof(NotificationImage)).GetValue(sourceIndex);
            string             sourceImage        = EnumDescription.getDescription(notificationImage);
            NotificationColor  notificationColor  = (NotificationColor)Enum.GetValues(typeof(NotificationColor)).GetValue(sourceIndex);
            Color sourceColor = EnumDescription.getColor(EnumDescription.getDescription(notificationColor));
            Array values      = Enum.GetValues(typeof(NotificationAuthor));
            int   authorIndex = random.Next(values.Length);

            if (generateHaveToAct)
            {
                authorIndex = mapAuthorToIndex();
            }
            NotificationAuthor notificationAuthor = (NotificationAuthor)values.GetValue(authorIndex);
            string             author             = EnumDescription.getDescription(notificationAuthor);

            values = Enum.GetValues(typeof(NotificationIcon));
            NotificationIcon notificationIcon = (NotificationIcon)values.GetValue(authorIndex);
            string           icon             = EnumDescription.getDescription(notificationIcon);
            string           text;

            if (sourceIndex == 2 || sourceIndex == 3) // post or youtube
            {
                values = Enum.GetValues(typeof(NotificationHeader));
                NotificationHeader notificationHeader = (NotificationHeader)values.GetValue(random.Next(values.Length));
                text = EnumDescription.getDescription(notificationHeader);
            }
            else // messengers
            {
                values = Enum.GetValues(typeof(NotificationText));
                NotificationText notificationText = (NotificationText)values.GetValue(random.Next(values.Length));
                text = EnumDescription.getDescription(notificationText);
            }
            if (isSilent)
            {
                sourceColor = EnumDescription.getColor(EnumDescription.getDescription(NotificationColor.Silent));
                sourceImage = "_silent_";
            }
            long         timestamp    = DateTime.Now.Ticks;
            Notification notification = new Notification(id, sourceImage, sourceName, author, icon, text, timestamp, isSilent, sourceColor, generateHaveToAct);

            Debug.Log(string.Format("Notification which is {0} and has the following data: {1} was created", generateHaveToAct ? "correct" : "incorrect", notification));
            return(notification);
        }
Example #18
0
        public override void PostHandleFormInit(MainForm form)
        {
            //Do not show in task bar, but display notify icon
            //NOTE: this effectively makes Windows ignore the Flip 3D policy set above (on Windows 7)
            //NOTE: this also makes HotKey registration critically fail on Windows 7
            form.ShowInTaskbar = false;

            DwmManager.SetWindowFlip3dPolicy(form, Flip3DPolicy.ExcludeAbove);

            _icon = new NotificationIcon(form);
        }
Example #19
0
        public void TestCreateShutdownTimer()
        {
            var  ni            = new NotificationIcon();
            var  delegateFired = false;
            long millisToWait;

            var shutdownTimer = ni.CreateShutdownTime(DateTime.Now, delegate { delegateFired = true; }, out millisToWait);

            Assert.IsNotNull(shutdownTimer, "Timer not created");
            Assert.IsTrue(millisToWait > 0 && !delegateFired, "Time to wait is less than 1 second");
        }
Example #20
0
 internal void DisplayNotification(string name)
 {
     try
     {
         NotificationIcon.BalloonTipText = $"Wallpaper changed to {name}";
         NotificationIcon.ShowBalloonTip(1000);
     }
     catch (Exception ex)
     {
     }
 }
Example #21
0
        public override void PostHandleFormInit(MainForm form)
        {
            //Do not show in task bar, but display notify icon
            //NOTE: this effectively makes Windows ignore the Flip 3D policy set above (on Windows 7)
            //NOTE: this also makes HotKey registration critically fail on Windows 7
            form.ShowInTaskbar = false;

            DwmManager.SetWindowFlip3dPolicy(form, WindowsFormsAero.Flip3DPolicy.ExcludeAbove);

            _icon = new NotificationIcon(form);
        }
Example #22
0
        private void BindStatusIconProperties(NotificationIcon sbIcon)
        {
            var aBinding = CreateBindingForRunStateProperty <RunStateToAnimationStateConverter>();

            sbIcon.SetBinding(NotificationIcon.AnimateProperty, aBinding);
            var cBinding = CreateBindingForRunStateProperty <RunStateToIconColorConverter>();

            sbIcon.SetBinding(NotificationIcon.IconColorProperty, cBinding);
            var tBinding = CreateBindingForRunStateProperty <RunStateToIconTextConverter>();

            sbIcon.SetBinding(NotificationIcon.IconTextProperty, tBinding);
        }
Example #23
0
 private void OnResize(object sender, EventArgs e)
 {
     if (FormWindowState.Minimized == base.WindowState)
     {
         NotificationIcon.Visible = true;
         NotificationIcon.ShowBalloonTip(2);
         base.Hide();
     }
     else if (base.WindowState == FormWindowState.Normal)
     {
         NotificationIcon.Visible = false;
     }
 }
Example #24
0
        public void TestWithinRuntime()
        {
            var now = DateTime.Now;

            var before = new DateTime(now.Year, now.Month, now.Day, 1, 0, 0);
            var after  = new DateTime(now.Year, now.Month, now.Day, 23, 0, 0);
            var middle = new DateTime(now.Year, now.Month, now.Day, 10, 0, 0);

            var ni = new NotificationIcon();

            Assert.IsFalse(ni.WithinRuntime(before), "Time is not within limit");
            Assert.IsFalse(ni.WithinRuntime(after), "Time is not within limit");
            Assert.IsTrue(ni.WithinRuntime(middle), "Time is within limit");
        }
        /// <summary>
        /// Creates a more advanced (SMS-alike) <see cref="Notification"/> above the minimap showing a sender icon, subject and the message.
        /// </summary>
        /// <param name="icon">The notification icon.</param>
        /// <param name="sender">The sender name.</param>
        /// <param name="subject">The subject line.</param>
        /// <param name="message">The message itself.</param>
        /// <param name="fadeIn">If <c>true</c> the message will fade in.</param>
        /// <param name="blinking">if set to <c>true</c> the notification will blink.</param>
        /// <returns>The handle of the <see cref="Notification"/> which can be used to hide it using <see cref="Notification.Hide(int)"/>.</returns>
        public static int Show(NotificationIcon icon, string sender, string subject, string message, bool fadeIn, bool blinking = false)
        {
            Function.Call(Hash._SET_NOTIFICATION_TEXT_ENTRY, "STRING");

            const int maxStringLength = 99;

            for (int i = 0; i < message.Length; i += maxStringLength)
            {
                Function.Call(Hash.ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME, message.Substring(i, System.Math.Min(maxStringLength, message.Length - i)));
            }

            Function.Call(Hash._SET_NOTIFICATION_MESSAGE_2, "CHAR_" + icon.ToString(), "CHAR_" + icon.ToString(), fadeIn, 1, sender, subject);

            return(Function.Call <int>(Hash._DRAW_NOTIFICATION_4, blinking, true));
        }
Example #26
0
        // TODO: Handle this better
        /// <summary>
        /// Adds the notification.
        /// </summary>
        /// <param name="icon">Icon.</param>
        public GuiNotificationIndicator AddNotification(NotificationIcon icon)
        {
            GuiNotificationIndicator notificationButton = new GuiNotificationIndicator
            {
                Icon     = icon,
                Location = new Point2D(Location.X + GameDefines.GUI_SPACING,
                                       Location.Y + Size.Height - (Children.Count + 1) * (GameDefines.GUI_TILE_SIZE + GameDefines.GUI_SPACING)),
                Size = new Size2D(GameDefines.GUI_TILE_SIZE, GameDefines.GUI_TILE_SIZE)
            };

            notificationButton.LoadContent();
            Children.Add(notificationButton);

            return(notificationButton);
        }
Example #27
0
 private void HeadForm_Resize(object sender, EventArgs e)
 {
     NotificationIcon.BalloonTipTitle = "Onions";
     NotificationIcon.BalloonTipText  = "Service Database is working";
     if (FormWindowState.Minimized == this.WindowState)
     {
         NotificationIcon.Visible = true;
         NotificationIcon.ShowBalloonTip(500);
         this.ShowInTaskbar = false;
         this.Hide();
     }
     else if (FormWindowState.Normal == this.WindowState)
     {
         NotificationIcon.Visible = false;
     }
 }
Example #28
0
 /// <summary>
 ///     Schedule notification with app icon.
 /// </summary>
 /// <param name="smallIcon">
 ///     List of build-in small icons: notification_icon_bell (default), notification_icon_clock,
 ///     notification_icon_heart, notification_icon_message, notification_icon_nut, notification_icon_star,
 ///     notification_icon_warning.
 /// </param>
 public static int SendWithAppIcon(TimeSpan delay, string title, string message, Color smallIconColor,
                                   NotificationIcon smallIcon = 0)
 {
     return(SendCustom(new NotificationParams {
         Id = Random.Range(0, int.MaxValue),
         Delay = delay,
         Title = title,
         Message = message,
         Ticker = message,
         Sound = true,
         Vibrate = true,
         Light = true,
         SmallIcon = smallIcon,
         SmallIconColor = smallIconColor,
         LargeIcon = "app_icon"
     }));
 }
Example #29
0
        private void haleyNotification()
        {
            NotificationIcon _image = NotificationIcon.Info;

            if (rbtnError.IsChecked.HasValue && rbtnError.IsChecked.Value)
            {
                _image = NotificationIcon.Error;
            }

            if (rbtnWarn.IsChecked.HasValue && rbtnWarn.IsChecked.Value)
            {
                _image = NotificationIcon.Warning;
            }

            if (rbtnSuccess.IsChecked.HasValue && rbtnSuccess.IsChecked.Value)
            {
                _image = NotificationIcon.Success;
            }

            DialogMode dialogMode = DialogMode.Notification;

            if (rbtnTypeConfirm.IsChecked.HasValue && rbtnTypeConfirm.IsChecked.Value)
            {
                dialogMode = DialogMode.Confirmation;
            }
            if (rbtnTypeGetInput.IsChecked.HasValue && rbtnTypeGetInput.IsChecked.Value)
            {
                dialogMode = DialogMode.GetInput;
            }

            if (rbtnModeNotify.IsChecked.Value)
            {
                var _blur   = cbxBlur.IsChecked.Value;
                var result  = _ds.ShowDialog(tbxTitle.Text, tbxMessage.Text, _image, dialogMode, blurWindows: _blur);
                var dresult = result.DialogResult;
                tblckDialogResult.Text = dresult.ToString();
                var uinput = result.UserInput;
                tblckUserInput.Text = uinput;
            }
            else
            {
                _ds.SendToast(tbxTitle.Text, tbxMessage.Text, _image);
            }
        }
 protected string GetCodeByIcon(NotificationIcon icon)
 {
     string iconCode = "InfoIcon";
     switch (icon)
     {
         case NotificationIcon.Info:
             iconCode = "InfoIcon";
             break;
         case NotificationIcon.Error:
             iconCode = "ErrorIcon";
             break;
         case NotificationIcon.Warning:
             iconCode = "WarningIcon";
             break;
         default:
             throw new ArgumentOutOfRangeException("icon", icon, null);
     }
     return iconCode;
 }
        public MainWindow()
        {
            InitializeComponent();
            NotificationIcon.Setup(this);

            var ioc = Nancy.TinyIoc.TinyIoCContainer.Current;

            var successSound = new SoundPlayer(Properties.Resources.sm64_mario_here_we_go);
            var failSound    = new SoundPlayer(Properties.Resources.sm64_mario_falling);

            hub = ioc.Resolve <ITinyMessengerHub>();
            hub.Subscribe <Notification>(notification =>
            {
                var item = itemContainer.Update(notification);

                if (notification.Build.State == State.Finalized)
                {
                    if (notification.Build.Result == Result.Success)
                    {
                        if (item.AlertSuccess)
                        {
                            successSound.Play();
                        }
                    }
                    else
                    {
                        if (item.AlertFailure)
                        {
                            failSound.Play();
                        }
                    }
                }
            },
                                         new DispatcherTinyMessageProxy(Dispatcher));

            itemContainer = new ItemContainer();

            DataContext = new MainWindowModel()
            {
                Items = itemContainer.GetItems()
            };
        }
        static void Main(string[] args)
        {
            NotificationManager.Initialize("com.app.test", "App Test", icon_path);
            NotificationManager.SendNotification("My New Notification", "Isn't This Handy", "ActionId", icon_path);
            NotificationManager.NotificationIconSelectedEvent += NotificationManager_NotificationIconSelectedEvent;
            var trayIcon = new NotificationIcon(icon_path);

            trayIcon.NotificationIconSelected += TrayIcon_NotificationIconSelected;

            while (true)
            {
                trayIcon?.DoMessageLoop(true);

                if (destroy)
                {
                    trayIcon?.Dispose();
                    trayIcon = null;
                }
            }
        }
Example #33
0
        public static void Show(string title, string text, NotificationIcon notificationIcon, TimeSpan showDuration)
        {
            var model = new NotificationViewModel
            {
                Icon  = notificationIcon,
                Text  = text,
                Title = title
            };

            if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)
            {
                var windowThread = new Thread(() =>
                {
                    SynchronizationContext
                    .SetSynchronizationContext(new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher));
                    var window = new NotificationWindow(showDuration)
                    {
                        DataContext = model, ShowActivated = false
                    };
                    window.Closed += (s, e) =>
                                     Dispatcher.CurrentDispatcher.BeginInvokeShutdown(DispatcherPriority.Background);
                    window.Show();
                    Dispatcher.Run();
                });
                windowThread.SetApartmentState(ApartmentState.STA);
                windowThread.Priority     = ThreadPriority.BelowNormal;
                windowThread.Name         = string.Format("Notifybox \"{0}\" thread", title);
                windowThread.IsBackground = true;
                windowThread.Start();
            }
            else
            {
                var window = new NotificationWindow(showDuration)
                {
                    DataContext = model, ShowActivated = false
                };
                window.Show();
            }
        }
        public void Notify(string message, NotificationIcon icon, int time = 5000)
        {

            Notify(message, GetCodeByIcon(icon), time);
        }
 public void NotifyWithActions(string message, NotificationIcon icon, params NotifyActionItem[] actions)
 {
 
     Notify(message,GetCodeByIcon(icon),0,true,actions);
 }
        protected override void UpdateNotificationIconInternal(NotificationIcon nid, bool updateContextMenu)
        {
            try
            {
                NotificationIconInfo nii = new NotificationIconInfo();
                if (!notificationIconInfo.ContainsKey(nid)) {
                    nii.hIndicator = Internal.AppIndicator.Methods.app_indicator_new(nid.Name, nid.IconNameDefault, Internal.AppIndicator.Constants.AppIndicatorCategory.ApplicationStatus);
                    notificationIconInfo.Add(nid, nii);

                    // Internal.AppIndicator.Methods.app_indicator_set_label(hIndicator, nid.Text, "I don't know what this is for");
                    // Internal.AppIndicator.Methods.app_indicator_set_title(hIndicator, nid.Text);
                }
                else {
                    nii = notificationIconInfo[nid];
                }

                if (updateContextMenu) {
                    IntPtr hMenu = Internal.GTK.Methods.gtk_menu_new();

                    IntPtr hMenuTitle = Internal.GTK.Methods.gtk_menu_item_new();
                    Internal.GTK.Methods.gtk_widget_set_sensitive(hMenuTitle, false);
                    Internal.GTK.Methods.gtk_menu_shell_append(hMenu, hMenuTitle);
                    nii.hMenuItemTitle = hMenuTitle;

                    IntPtr hMenuSeparator = Internal.GTK.Methods.gtk_separator_menu_item_new();
                    Internal.GTK.Methods.gtk_menu_shell_append(hMenu, hMenuSeparator);

                    if (nid.ContextMenu != null) {
                        foreach (MenuItem mi in nid.ContextMenu.Items)
                        {
                            InitMenuItem(mi, hMenu);
                        }
                    }

                    Internal.GTK.Methods.gtk_widget_show_all(hMenu);

                    Internal.AppIndicator.Methods.app_indicator_set_menu(nii.hIndicator, hMenu);
                }

                if (nii.hMenuItemTitle != IntPtr.Zero) {
                    Internal.GTK.Methods.gtk_menu_item_set_label(nii.hMenuItemTitle, nid.Text);
                }

                Internal.AppIndicator.Methods.app_indicator_set_attention_icon(nii.hIndicator, nid.IconNameAttention);
                switch (nid.Status) {
                    case NotificationIconStatus.Hidden:
                    {
                        Internal.AppIndicator.Methods.app_indicator_set_status(nii.hIndicator, Internal.AppIndicator.Constants.AppIndicatorStatus.Passive);
                        break;
                    }
                    case NotificationIconStatus.Visible:
                    {
                        Internal.AppIndicator.Methods.app_indicator_set_status(nii.hIndicator, Internal.AppIndicator.Constants.AppIndicatorStatus.Active);
                        break;
                    }
                    case NotificationIconStatus.Attention:
                    {
                        Internal.AppIndicator.Methods.app_indicator_set_status(nii.hIndicator, Internal.AppIndicator.Constants.AppIndicatorStatus.Attention);
                        break;
                    }
                }
            }
            catch {
            }
        }