Esempio n. 1
0
//*********  USER METHODS **************///
        #region User Methods
        /// <summary>
        /// Main method of the CircularNotifier. Adds a slice to specified ring in specified sector.
        /// </summary>
        /// <param name="sector">Chosen sector where the event will be placed.</param>
        /// <param name="ring">Chosen ring where the event will be placed.</param>
        /// <param name="color">Color of the event's slice.</param>
        public void AddEvent(int sector, int ring, Color color)
        {
            if (ring < 0 || ring >= rings.Length)
            {
                return;
            }
            if (sector < 0 || sector >= Sectors)
            {
                return;
            }

            RingSlice slice = slices.SingleOrDefault((x) => x.SectorIndex == sector && x.RingIndex == ring);

            if (slice == null)
            {
                slices.Add(rings[ring].GetSlice(sector, color));
            }
            else
            {
                slice.FillColor = color;
            }
            Invalidate();
            if (AutoStart && !IsRunning)
            {
                Start();
            }
        }
Esempio n. 2
0
        private void MeasureSlices()
        {
            List <RingSlice> newSlices = new List <RingSlice>();

            for (int i = 0; i < slices.Count; i++)
            {
                RingSlice tmp     = slices[i];
                int       ringI   = tmp.RingIndex;
                int       sectorI = tmp.SectorIndex;

                if (ringI < visibleRingsCount)
                {
                    newSlices.Add(rings[ringI].GetSlice(sectorI, tmp.FillColor));
                }
            }
            slices.Clear();
            slices.AddRange(newSlices);
        }