Ejemplo n.º 1
0
 public static void Open(NotificationArea notificationArea, Point position)
 {
     if (_instance == null)
     {
         _instance      = new NotificationPropertiesWindow(notificationArea);
         _instance.Left = position.X + 10;
         _instance.Top  = position.Y + 10;
         _instance.Show();
     }
     else
     {
         _instance.Activate();
     }
 }
Ejemplo n.º 2
0
        private static List <NotificationArea> BuildNotificationAreas(IOptions <NotificationOptions> options)
        {
            var ignored = new HashSet <int>();
            var areas   = new List <NotificationArea>();

            foreach (var areaOptions in options.Value.NotificationAreas)
            {
                // Build the set of ignored pokemon IDs
                foreach (var pokemon in areaOptions.Pokemon ?? new IgnoredPokemon[0])
                {
                    if (pokemon.Ignore)
                    {
                        ignored.Add(pokemon.Id);
                    }
                    else
                    {
                        ignored.Remove(pokemon.Id);
                    }
                }

                // Build the polygon
                var points = areaOptions
                             .Polygon
                             .Select(x => new Point(x.Longitude, x.Latitude))
                             .ToArray();
                var polygon = new Polygon(points);

                var area = new NotificationArea
                {
                    IgnoredPokemon = new HashSet <int>(ignored),
                    Polygon        = polygon
                };

                areas.Add(area);
            }

            return(areas);
        }
Ejemplo n.º 3
0
        private async Task ShowOneNotification(string text)
        {
            this.IsVisible        = true;
            NotificationText.Text = text;
            await Task.WhenAll(
                NotificationArea.TranslateTo(0, 0, 333, Easing.CubicOut),
                NotificationText.TranslateTo(0, 0, 500, Easing.CubicOut)
                );

            await Task.Delay(2833);

            const uint endAnimMs    = 500;
            var        endAnimation = new Animation
            {
                { 0, 1, new Animation(t => { NotificationText.TranslationX = t; }, 0, _textOffset, Easing.CubicIn, () => NotificationText.TranslationX = -_textOffset) },
                { 0.6, 1, new Animation(a => { NotificationArea.TranslationY = a; }, 0, _controlHeight, Easing.CubicIn) }
            };

            endAnimation.Commit(this, "NotifierClose", 16, endAnimMs);
            await Task.Delay((int)endAnimMs + 32); // Plus an extra two ticks to make sure the onFinish callbacks have time to run.

            this.IsVisible = false;
        }
        public SystemTray(IMenuBar host, NotificationArea notificationArea)
        {
            InitializeComponent();

            _notificationArea = notificationArea;
            DataContext       = _notificationArea;
            Host = host;

            Settings.Instance.PropertyChanged += Settings_PropertyChanged;

            ((INotifyCollectionChanged)PinnedItems.Items).CollectionChanged   += PinnedItems_CollectionChanged;
            ((INotifyCollectionChanged)UnpinnedItems.Items).CollectionChanged += UnpinnedItems_CollectionChanged;

            if (Settings.Instance.SysTrayAlwaysExpanded)
            {
                UnpinnedItems.Visibility = Visibility.Visible;
            }

            // Don't allow showing both the Windows TaskBar and the Cairo tray
            if (Settings.Instance.EnableSysTray && (Settings.Instance.EnableTaskbar || EnvironmentHelper.IsAppRunningAsShell) && _notificationArea.Handle == IntPtr.Zero)
            {
                _notificationArea.Initialize();
            }
        }
Ejemplo n.º 5
0
 internal static void AddArea(NotificationArea area)
 {
     Areas.Add(area);
 }
 internal static void RemoveArea(NotificationArea area)
 {
     Areas.Remove(area);
 }
 private void AchievementEarned(GameSparks.Api.Messages.AchievementEarnedMessage obj)
 {
     NotificationArea.Show(obj.AchievementName);
 }
Ejemplo n.º 8
0
        public TrayIcon(Gtk.Window window)
        {
            player_window = window;

            popup = new TrackInfoPopup ();
            trayicon = new NotificationArea ("last-exit");

            event_box = new EventBox ();
            trayicon_image = new Image ();
            trayicon_image.FromPixbuf = new Gdk.Pixbuf (null, "last-exit-16.png");
            event_box.Add (trayicon_image);
            trayicon_image.Visible = true;
            trayicon.Add(event_box);

            Driver.Actions.UIManager.AddUiFromResource ("TrayIcon.xml");
            menu = (Menu) Driver.Actions.UIManager.GetWidget ("/Menu");
            menu.Deactivated += new EventHandler (OnMenuDeactivated);

                        // Watch the GConf show_notifications key and fire an event
                        string NotifyKey = "/apps/lastexit/show_notifications";
                        Driver.config.GConfAddNotify (NotifyKey, OnGConfShowNotificationsChanged);

                        trayicon.ShowAll();

            // Setting callback procs
            event_box.ButtonPressEvent += OnNotificationAreaIconClick;
            event_box.EnterNotifyEvent += OnEnterNotifyEvent;
            event_box.LeaveNotifyEvent += OnLeaveNotifyEvent;
            event_box.ScrollEvent += OnNotificationAreaIconScroll;
        }
Ejemplo n.º 9
0
 internal SystemTrayMenuBarExtension(NotificationArea notificationArea)
 {
     _notificationArea = notificationArea;
 }
 internal static void AddArea(NotificationArea area) => Areas?.Add(area);