Ejemplo n.º 1
0
        public static Icon GetIconForState(PluginBase.IntervalType type, PluginBase.StateChangeType state, bool heartbeat)
        {
            int frame = 0;

            if (type == PluginBase.IntervalType.Rest)
            {
                frame = 8;
            }

            if (state == PluginBase.StateChangeType.Start)
            {
                frame |= 4;
            }

            if (state == PluginBase.StateChangeType.Pause)
            {
                frame |= 2;
            }

            if (heartbeat)
            {
                frame |= 1;
            }

            return(_icons[frame]);
        }
Ejemplo n.º 2
0
        public void RequestStartInterval(PluginManager.Plugin caller, PluginBase.IntervalType type)
        {
            var current = getInterval(_currentIntervalId);

            if (current != null)
            {
                if (current.State != PluginBase.StateChangeType.End)
                {
                    return;
                }
            }

            if (type == PluginBase.IntervalType.Focus)
            {
                if (String.IsNullOrEmpty(_nextName))
                {
                    _nextName = "[name not set]";
                }
                if (_nextTask == null)
                {
                    _nextTask = "";
                }
                beginFocusInterval(_nextName, _nextTask, DateTime.Now);
            }
            else
            {
                beginRestInterval(DateTime.Now);
            }
        }
Ejemplo n.º 3
0
        public void OnIntervalPropertyChange(string id, PluginBase.IntervalType mode, string intervalName = null, string taskName = null)
        {
            if (_knownState.Id != id)
            {
                if (_idsSeen.Contains(id))
                {
                    // This is a modification to an old interval. Ignore it.
                    return;
                }
                else
                {
                    // This is a new interval. Capture it.
                    _idsSeen.Add(id);
                    _knownState.Id = id;
                    _knownState.Reset();
                }
            }

            _knownState.Type = mode;

            if (mode == PluginBase.IntervalType.Focus)
            {
                if (!String.IsNullOrEmpty(intervalName))
                {
                    _nameText.Text   = intervalName;
                    _knownState.Name = intervalName;
                }

                if (!String.IsNullOrEmpty(taskName))
                {
                    noteTaskName(taskName);
                    _knownState.Task = taskName;
                }
            }
        }
Ejemplo n.º 4
0
 public static Bitmap GetBitmapForState(int size, PluginBase.IntervalType type, PluginBase.StateChangeType state, bool heartbeat)
 {
     return(GetBitmapForIcon(GetIconForState(type, state, heartbeat), size));
 }