Example #1
0
        public int FindPositionOf(Begrip gebaar)
        {
            for (int i = 0; i < this.Begrippen.Keys.Count; i++) {
                if (string.Equals(this.Begrippen.Keys.ElementAt(i), gebaar.Naam, StringComparison.InvariantCultureIgnoreCase))
                {
                    return i;
                }
            }

            return 0;
        }
Example #2
0
        public static Begrip Deserialize(string begripDefinition)
        {
            var defParts = begripDefinition.Split(';');

            if (defParts.Length != 8)
                throw new ArgumentException("Begripdefinitie heeft te weinig onderdelen:" + begripDefinition);

            string filmNaam = null;
            if (!string.IsNullOrEmpty(defParts[1]))
            {
                filmNaam = Path.Combine(filmPath, defParts[1]);
            }

            string pictogramNaam = null;
            if (!string.IsNullOrEmpty(defParts[3]))
            {
                pictogramNaam = Path.Combine(pictoPath, defParts[3]);
            }

            var begrip = new Begrip {
                Naam = defParts[0],
                Media = new Medium {
                    FilmNaam = filmNaam,
                    PictogramNaam = pictogramNaam
                }
            };

            begrip.Media.Tekeningen = SplitBegripPart(defParts[2], tekeningPath);
            begrip.Media.Fotos = SplitBegripPart(defParts[4], fotoPath);
            begrip.Media.Kaarten = SplitBegripPart(defParts[5], topoPath);
            begrip.Themas = SplitBegripPart(defParts[6], "");

            var handvormen = SplitBegripPart(defParts[7], handvormPath);
            begrip.Handvormen = new List<Handvorm>();
            begrip.Handvormen.Add(new Handvorm { Plaats = Plaats.Links, Volgorde = 1, Foto = handvormen[0] });
            begrip.Handvormen.Add(new Handvorm { Plaats = Plaats.Rechts, Volgorde = 1, Foto = handvormen[1] });
            begrip.Handvormen.Add(new Handvorm { Plaats = Plaats.Links, Volgorde = 2, Foto = handvormen[2] });
            begrip.Handvormen.Add(new Handvorm { Plaats = Plaats.Rechts, Volgorde = 2, Foto = handvormen[3] });
            return begrip;
        }
Example #3
0
 public void Add(Begrip gebaar)
 {
     this.Begrippen.Add(gebaar.Naam, gebaar);
 }
Example #4
0
        public static string Serialize(Begrip begrip)
        {
            StringBuilder serializedBegrip = new StringBuilder();

            // Naam
            serializedBegrip.Append(begrip.Naam);
            serializedBegrip.Append(";");

            // Film
            if (begrip.Media != null && !string.IsNullOrEmpty(begrip.Media.FilmNaam))
            {
                serializedBegrip.Append(Path.GetFileName(begrip.Media.FilmNaam));
            }
            serializedBegrip.Append(";");

            // Tekeningen
            if (begrip.Media != null && begrip.Media.Tekeningen != null)
            {
                foreach (var tekening in begrip.Media.Tekeningen) {
                    serializedBegrip.Append(Path.GetFileName(tekening)).Append("/");

                }
            }
            serializedBegrip.Append(";");

            // Pictogram
            if (begrip.Media != null && !string.IsNullOrEmpty(begrip.Media.PictogramNaam))
            {
                serializedBegrip.Append(Path.GetFileName(begrip.Media.PictogramNaam));
            }
            serializedBegrip.Append(";");

            // Fotos
            if (begrip.Media != null && begrip.Media.Fotos != null)
            {
                foreach (var foto in begrip.Media.Fotos) {
                    serializedBegrip.Append(Path.GetFileName(foto)).Append("/");

                }
            }
            serializedBegrip.Append(";");

            // Kaarten
            if (begrip.Media != null && begrip.Media.Kaarten != null)
            {
                foreach (var kaart in begrip.Media.Kaarten) {
                    serializedBegrip.Append(Path.GetFileName(kaart)).Append("/");

                }
            }
            serializedBegrip.Append(";");

            // Themas
            if (begrip.Themas != null)
            {
                foreach (var thema in begrip.Themas) {
                    serializedBegrip.Append(thema).Append("/");
                }
            }
            serializedBegrip.Append(";");

            // Handvormen
            if (begrip.Handvormen != null)
            {
                foreach (var handvorm in begrip.Handvormen) {
                    serializedBegrip.Append(Path.GetFileName(handvorm.Foto)).Append("/");
                }
            }

            return serializedBegrip.ToString();
        }
Example #5
0
 public void Remove(Begrip begrip)
 {
     this.Begrippen.Remove(begrip);
     var section = this.FindSectionFor(begrip.Naam[0]);
     section.Begrippen.Remove(begrip.Naam);
 }
Example #6
0
 private void AddHandvorm(int number, Begrip begrip)
 {
     this.Handvormen[number].Image = new NSImage(Path.Combine(this.FilmPath, begrip.Handvormen[number].Foto));
         this.Handvormen[number].Image.Size = new SizeF(100, 100);
 }