Ejemplo n.º 1
0
        private void dispatcher_Tick(object state)         //sender, EventArgs e)
        {
            ReadWorkHours();
            ContactAvailability availability;
            string activityId;
            var    ok = AvailabilityMonitor.TryGetSelfAvailability(out availability, out activityId);

            if (ok)
            {
                if (InWorkHours())
                {
                    if (availability == ContactAvailability.Away && string.Equals("off-work", activityId))
                    {
                        _icon.ShowBalloonTip(5000, "Available", "Updating your presence to free", ToolTipIcon.Info);
                        AvailabilityMonitor.SetSelfAvailability(ContactAvailability.Free);
                    }
                }
                else
                {
                    // make sure we aren't available
                    if (availability != ContactAvailability.Away || !string.Equals("off-work", activityId))
                    {
                        _icon.ShowBalloonTip(5000, "Off Work", "Updating your presence to off-work", ToolTipIcon.Info);
                        AvailabilityMonitor.SetSelfAvailability(ContactAvailability.Away, "off-work");
                    }
                }
            }
            // else we don't know what the availability is so it doesn't matter
        }
Ejemplo n.º 2
0
        public LyncHue(NotifyIcon icon, MenuItem bridgeMenu, MenuItem lightMenu, ILyncHueConfig config)
        {
            _icon       = icon;
            _bridgeMenu = bridgeMenu;
            _lightMenu  = lightMenu;
            _config     = config;

            _monitor = new AvailabilityMonitor();
            _monitor.AvailabilityChanged += monitor_AvailabilityChanged;
            _monitor.Initialize();
        }