Пример #1
0
        public FolderSettingsDialog(Data.Folder Folder, IconsFolder FolderIcons)
        {
            InitializeComponent();
            _FolderIcons = FolderIcons;
            _Folder = Folder;

            ImageList imgL = new ImageList();
            imgL.ColorDepth = ColorDepth.Depth32Bit;
            imgL.ImageSize = new System.Drawing.Size(32, 32);
            foreach (var kvp in _FolderIcons.IconDictionary)
            {
                imgL.Images.Add(kvp.Key.ToString(), kvp.Value);

                ListViewItem lvi = new ListViewItem();
                lvi.ImageKey = kvp.Key.ToString();
                lvi.Tag = kvp.Key;
                lvImages1.Items.Add(lvi);
                if (Folder.SymbolID == kvp.Key)
                    lvi.Selected = true;
            }
            lvImages1.SmallImageList = imgL;
            lvImages1.LargeImageList = imgL;

            textBox1.Text = _Folder.Title;
            textBox2.Text = _Folder.Language;
            panel1.BackColor = _Folder.Color ?? SystemColors.Control;
            panel2.BackColor = _Folder.ColorRecursive ?? SystemColors.Control;
            if (null == _Folder.Color)
                panel1.BackgroundImage = Properties.Resources.button_cancel_256x256_32;
            if (null == _Folder.ColorRecursive)
                panel2.BackgroundImage = Properties.Resources.button_cancel_256x256_32;
            label5.Text = _Folder.LanguageRecursive;
            lvImages1.SelectedIndices.Clear();
            if (lvImages1.Items.Count > _Folder.SymbolID)
            {
                int index = imgL.Images.IndexOfKey(_Folder.SymbolID.ToString());
                if (index < 0)
                    lvImages1.Items[0].Selected = true;
                else
                    lvImages1.Items[index].Selected = true;
            }
        }
Пример #2
0
 /// <summary>
 /// Überprüft, ob f in diesem Ordner enthalten ist.<para/>
 /// Ergebnisse:<para/>
 /// f == this -&gt; true<para/>
 /// f == null -&gt; false
 /// </summary>
 public bool Contains(Folder f)
 {
     return Contains(this, f);
 }
Пример #3
0
        /// <summary>
        /// Kopiert den Ordner
        /// </summary>
        /// <param name="cloneResults">Gibt an, ob die Ergebnisse der Wörter mitkopiert werden sollen<para/>Werden die Ergebnisse mitkopiert, wird auch das Änderungs- und Erstellungsdatum übernommen.</param>
        public Folder Clone(bool cloneResults)
        {
            Folder f = new Folder();

            f._Title = _Title;
            f._SymbolID = _SymbolID;
            f._Language = _Language;
            f._Color = _Color;

            foreach (Folder f1 in _Folders)
                f1.Clone(cloneResults).Parent = f;
            foreach (Word w1 in _Words)
                w1.Clone(cloneResults).Parent = f;

            return f;
        }
Пример #4
0
 /// <summary>
 /// Überprüft, ob w in f enthalten ist.
 /// </summary>
 public static bool Contains(Folder f, Word w)
 {
     if (f == null || w == null)
         return false;
     if (w.Parent == null)
         return false;
     return Contains(f, w.Parent);
 }
Пример #5
0
        /// <summary>
        /// Überprüft, ob f2 in f1 enthalten ist.<para/>
        /// Ergebnisse:<para/>
        /// f1 == f2 -&gt; true<para/>
        /// f1 == null -&gt; false<para/>
        /// f2 == null -&gt; false
        /// </summary>
        public static bool Contains(Folder f1, Folder f2)
        {
            //Sonderfälle:
            //-Ein Order ist null -> false
            if (f1 == null || f2 == null)
                return false;
            //-Beide Ordner sind Gleich -> true
            if (f1 == f2)
                return true;

            Folder tmp = f2;

            while (tmp._Parent != null)
            {
                //Einen Order nach oben:
                tmp = tmp._Parent;
                //Überprüfen, ob nun beim mögl. enthaltenden O. angekommen
                if (tmp == f1)
                    return true;
            }
            return false;

            #region //Suche
            //if (f == null)
            //    return false;
            //if (_Folders.Contains(f))
            //    return true;
            //foreach (Folder f1 in _Folders)
            //    if (f1.Contains(f))
            //        return true;
            //return false;
            #endregion
        }