Exemplo n.º 1
0
 internal void TimeBoxClear()
 {
     TimeBoxCollection.Clear();
 }
Exemplo n.º 2
0
        internal void ExtractAndApplySetting(List <string> savedProjectSettings)
        {
            try
            {
                // find the right place
                bool           found    = false;
                bool           viz      = true;
                bool           gotColor = false;
                Color          color    = Color.Gray;
                List <TimeBox> tboxes   = new List <TimeBox>();
                foreach (var line in savedProjectSettings)
                {
                    string path = _extract("PATH:", line);
                    if (path != null && path == Path)
                    {
                        found = true; continue;
                    }
                    if (!found)
                    {
                        continue;
                    }
                    if (line == "END")
                    {
                        break;
                    }
                    string txt = _extract("VISIBLE:", line);
                    if (txt != null)
                    {
                        viz = bool.Parse(txt); continue;
                    }

                    txt = _extract("COLOR:", line);
                    if (txt != null)
                    {
                        color = ColorTranslator.FromHtml(txt); gotColor = true; continue;
                    }

                    txt = _extract("TIMEBOX:", line);
                    if (txt != null)
                    {
                        TimeBox trb = TimeBox.FromSetting(txt);
                        if (trb != null)
                        {
                            tboxes.Add(trb);
                        }
                    }
                }

                if (found)
                {
                    Visible = viz;
                    if (gotColor)
                    {
                        _color = color; _brush = null;
                    }
                    TimeBoxCollection.Clear();
                    TimeBoxAdd(tboxes);
                }
            }
            catch
            {
                // ignored
            }
        }