Ejemplo n.º 1
0
        public bool PushSelectedItem()
        {
            dumpItems(cb, "push");
            int idx = cb.SelectedIndex;

            if (idx >= 0)
            {
                int    list_ix;
                Object item = cb.Items[idx];
                var    elt  = item as Autocompleter_Elt;
                if (elt != null)
                {
                    list_ix = list.IndexOf(elt);
                }
                else
                {
                    String arg = item.ToString();
                    for (list_ix = list.Count - 1; list_ix >= 0; list_ix--)
                    {
                        if (arg == list[list_ix].ToString())
                        {
                            break;
                        }
                    }
                }
                if (list_ix >= 0)
                {
                    Autocompleter_Elt x = list[list_ix];
                    list.RemoveAt(list_ix);
                    list.Insert(0, x);
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 2
0
 protected virtual void Push(List <Autocompleter_Elt> list, int ix)
 {
     if (ix > 0)
     {
         Autocompleter_Elt x = list[ix];
         list.RemoveAt(ix);
         list.Insert(0, x);
     }
 }
Ejemplo n.º 3
0
        private static int sortScoreCb(Autocompleter_Elt a, Autocompleter_Elt b)
        {
            int ret = Comparer <float> .Default.Compare(b.score, a.score);

            if (ret != 0)
            {
                return(ret);
            }
            return(0);
        }
Ejemplo n.º 4
0
        protected override void Push(List <Autocompleter_Elt> list, int ix)
        {
            Autocompleter_Elt x      = list[ix];
            String            argDir = Path.GetDirectoryName(x.ToString());

            int j;

            for (j = 0; j < list.Count; j++)
            {
                if (argDir == Path.GetDirectoryName(list[j].ToString()))
                {
                    break;
                }
            }

            if (j < ix)
            {
                var tmp = list[j];
                list[j]  = list[ix];
                list[ix] = tmp;
                ix       = j;
            }
            base.Push(list, ix);
        }