public void ReloadSearch(string search)
        {
            currentParentFP = treeRoot;
            treeSet.FilterApply(delegate(TD dat)
            {
                return(BaseDat.ToString(dat).Contains(search));
            });

            cardSet.LoadFilter.Reset();
            if (currentParentFP != null)
            {
                cardSet.LoadFilter.AddWhere(new FilterTree(currentParentFP, true));
            }
            List <FilterUnitBase> lf = new List <FilterUnitBase>();

            if (PathCard.IsPathCard(search))
            {
                lf.Add(new FilterCard(new PathCard(search)));
            }
            else if (PathTree.IsPathTree(search))
            {
                lf.Add(new FilterTree(search, true));
            }
            lf.Add(new FilterString("Name", '%' + search + '%', true));
            cardSet.LoadFilter.AddWhere(new FilterOR(lf.ToArray()));
            cardSet.Load();

            AddTreeSet(treeSet, cardSet);
            treeSet.FilterReset();
            Refresh();
        }
Exemplo n.º 2
0
        public void WriteDat()
        {
            string text = BaseDat.ToString(_Value, Format);

            WriteText(text, 0, 0);
            txtMain.ForeColor = Color.Black;
        }
Exemplo n.º 3
0
 protected override void OnValueChanged(object sender, EventArgs e)
 {
     if (ddControl != null && Editor != null)
     {
         ddControl.WriteText(BaseDat.ToString(Editor.Value));
     }
     //Console.WriteLine("OnValueChanged");
 }
Exemplo n.º 4
0
 protected override void OnValueChanged(object sender, EventArgs e)
 {
     if (ddControl != null && Editor != null)
     {
         ddControl.WriteText(BaseDat.ToString(Editor.Value));
     }
     base.OnValueChanged(sender, e);
 }
Exemplo n.º 5
0
        protected override void OnLostFocus(EventArgs e)
        {
            base.OnLostFocus(e);
            if (btnClear.ContainsFocus || btnDropDown.ContainsFocus)
            {
                return;
            }
            btnDropDown.Visible = CanDropDown && !CanHideButtons;
            btnClear.Visible    = CanReset && !CanHideButtons;

            txtMain.Text = (_Value == null) ? "" : ((string.IsNullOrEmpty(Format)) ? _Value.ToString() : _Value.ToString(Format, null));
        }
Exemplo n.º 6
0
 void txtMain_TextChanged(object sender, EventArgs e)
 {
     //            Console.WriteLine("Editor Text=" + Text);
     if (BaseDat.ToString(Value, Format) != Text)
     {
         txtMain.ForeColor = Color.Brown;
         if (_Value != null)
         {
             _Value = null;
             FireValueChanged();
         }
     }
     else
     {
         txtMain.ForeColor = Color.Black;
     }
     if (TextChanged != null)
     {
         TextChanged(this, EventArgs.Empty);
     }
 }
Exemplo n.º 7
0
        void Editor_TextChanged(object sender, EventArgs e)
        {
            ChooserEditor editor = sender as ChooserEditor;

            if (editor != null)
            {
                if (BaseDat.ToString(editor.Value, editor.Format) == editor.Text)
                {
                    return;
                }

                if (editor.AutoCompleteMode != AutoCompleteMode.None)
                {
                    int index = editor.AutoCompleteCustomSource.IndexOf(editor.Text);
                    if (index >= 0)
                    {
                        CD dat = set[index] as CD;
                        editor.Value = dat;
                    }
                }
                else
                {
                    string text = editor.Text.ToLower();

                    for (int i = 0; i < set.Count; i++)
                    {
                        CD     dat  = set[i] as CD;
                        string sdat = dat.ToString(editor.Format, null);
                        if (dat != null && sdat.ToLower().StartsWith(text))
                        {
                            editor.Value           = dat;
                            editor.SelectionStart  = text.Length;
                            editor.SelectionLength = sdat.Length - text.Length;
                            return;
                        }
                    }
                }
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// —оздаетс¤ новый контроллер и прив¤зываетс¤ к заданному ChooserEditor.
        /// Set-класс используетс¤ без загрузки! Ќадо загрузить заранее!
        /// </summary>
        /// <param name="editor"></param>
        /// <param name="setclass"></param>
        public ChooserController(ChooserEditor editor, CS setclass, bool reload)
        {
            editor.ReadOnly      = false;
            editor.ValueChanged += new EventHandler(editor_ValueChanged);
            editor.TextChanged  += new EventHandler(Editor_TextChanged);

            if (setclass == null)
            {
                set = new CS();
                if (reload)
                {
                    set.Load();
                }
            }
            else
            {
                set = setclass;
            }

            if (set.Count > 0)
            {
                CD d = set[0] as CD;
                if (d != null && d is IDat)
                {
                    Dictionary <int, string> dict = new Dictionary <int, string>(set.Count);
                    foreach (CD dat in set)
                    {
                        dict.Add(((IDat)dat).ID, BaseDat.ToString(dat, editor.Format));
                    }

                    set.Sort(delegate(CD dat1, CD dat2)
                    {
                        return(string.Compare(dict[((IDat)dat1).ID], dict[((IDat)dat2).ID]));
                    });
                }
                else
                {
                    set.Sort(delegate(CD dat1, CD dat2)
                    {
                        return(string.Compare(BaseDat.ToString(dat1, editor.Format), BaseDat.ToString(dat2, editor.Format)));
                    });
                }
            }
            if (editor.AutoCompleteMode != AutoCompleteMode.None)
            {
                editor.AutoCompleteSource       = AutoCompleteSource.CustomSource;
                editor.AutoCompleteCustomSource = new AutoCompleteStringCollection();

                List <string> ls = set.ConvertType <string>(delegate(CD dat)
                {
                    return(BaseDat.ToString(dat, editor.Format));
                });
                editor.AutoCompleteCustomSource.AddRange(ls.ToArray());
            }
            else
            {
                editor.PrevValue += new EventHandler(Editor_PrevValue);
                editor.NextValue += new EventHandler(Editor_NextValue);
            }
            editor.Value = null;
        }
Exemplo n.º 9
0
 void ddController_ListReloaded(object sender, EventArgs <TD> e)
 {
     ddControl.WriteText(BaseDat.ToString(e.Data));
 }