Ejemplo n.º 1
0
        public void SetWarning(Guid g, CourseWarning w)
        {
            CourseWarning tmp;
            ConcurrentDictionary <CourseWarning.WarningType, CourseWarning> tmpL;

            if (w.Type == CourseWarning.WarningType.Reset)
            {
                this.warnings.TryRemove(g, out tmpL);
            }
            else if (w.Message == "")
            {
                if (this.warnings.TryGetValue(g, out tmpL))
                {
                    tmpL.TryRemove(w.Type, out tmp);
                }
            }
            else
            {
                this.warnings.TryAdd(g, new ConcurrentDictionary <CourseWarning.WarningType, CourseWarning>());
                if (this.warnings.TryGetValue(g, out tmpL))
                {
                    if (tmpL.TryGetValue(w.Type, out tmp))
                    {
                        tmpL.TryUpdate(w.Type, w, tmp);
                    }
                    else
                    {
                        tmpL.TryAdd(w.Type, w);
                    }
                }
            }

            this.onChange();
        }
Ejemplo n.º 2
0
 private void handleWarningChain(Guid g, CourseWarning w)
 {
     this.warnings.SetWarning(g, w);
 }