示例#1
0
        public void LoadStacks(List <object> register = null)
        {
            if (register == null)
            {
                System.Windows.Controls.Image b = GetImage();
                //stacks.Children.Add(b);
                b = GetImage();
                //stacks.Children.Add(b);
            }
            else
            {
                int i = 0;
                stacks.Children.Clear();
                foreach (var c in register)
                {
                    if (i > 7)
                    {
                        break;
                    }
                    System.Windows.Controls.Image b = GetImage((int)c);
                    System.Windows.Controls.Primitives.ToggleButton button = new ToggleButton();
                    button.Content         = b;
                    button.BorderThickness = new Thickness(0, 0, 0, 0);
                    button.Click          += Button_Click;

                    button.Tag = c;
                    stacks.Children.Add(button);
                    i++;
                }
                foreach (var c in std)
                {
                    if (i > 7)
                    {
                        break;
                    }
                    CsCompletionData d = c as CsCompletionData;
                    System.Windows.Controls.Image b = GetImageData(d.obs);
                    System.Windows.Controls.Primitives.ToggleButton button = new ToggleButton();
                    button.Content         = b;
                    button.BorderThickness = new Thickness(0, 0, 0, 0);
                    button.Click          += Button_Click;

                    button.Tag = c;
                    stacks.Children.Add(button);
                    i++;

                    //System.Windows.Controls.Image b = GetImageExt(d.Image as ImageSource);
                    //System.Windows.Controls.Primitives.ToggleButton button = new ToggleButton();
                    //button.Content = b;
                    //button.BorderThickness = new Thickness(0, 0, 0, 0);
                    //button.Click += Button_Click;

                    //button.Tag = c;
                    //stacks.Children.Add(button);
                }
            }
        }
示例#2
0
        public void AddStandards()
        {
            std = new List <object>();
            string[] items = { "Keywords", "Snippets" };

            CsCompletionData d = new CsCompletionData(items[0]);

            d.Image  = ConvertBitmapToBitmapImage.Convert(WinExplorers.ve.KeywordSnippet_16x);
            d.Search = "";
            d.obs    = "Keywords";
            std.Add(d);
            d        = new CsCompletionData(items[1]);
            d.Image  = ConvertBitmapToBitmapImage.Convert(WinExplorers.ve.Snippet_16x);
            d.Search = "";
            d.obs    = "Snippets";
            std.Add(d);
        }
示例#3
0
        public void FilterByKind(object obs, bool add = true)
        {
            ICSharpCode.AvalonEdit.CodeCompletion.CompletionListBox c = completionList.ListBox;
            var b = completionList.Master;
            List <CsCompletionData> d = new List <CsCompletionData>();

            if (add)
            {
                if (allitems == false)
                {
                    foreach (var bc in c.Items)
                    {
                        d.Add(bc as CsCompletionData);
                    }
                }
                for (int i = 0; i < completionList.Master.Count; i++)
                {
                    CsCompletionData dd = (CsCompletionData)completionList.Master[i];
                    if (CompletionControls.GetHashCode(dd.obs) == (int)obs)
                    {
                        d.Add(dd);
                    }
                    //if (obs is SymbolKind)
                    //{
                    //    SymbolKind s = (SymbolKind)obs;
                    //    if (dd.obs is SymbolKind)
                    //        if (s == (SymbolKind)dd.obs)
                    //            d.Add(dd);

                    //}
                    //else if (obs is TypeKind)
                    //{
                    //    TypeKind s = (TypeKind)obs;
                    //    if (dd.obs is TypeKind)
                    //        if (s == (TypeKind)dd.obs)
                    //            d.Add(dd);
                    //} else if (obs is CsCompletionData)
                    //{
                    //    string s = ((CsCompletionData)obs).obs as string;
                    //    if (dd.obs is string)
                    //        if ( s == (string)dd.obs)
                    //            d.Add(dd);
                    //}
                }
            }
            else
            {
                foreach (var bc in c.Items)
                {
                    d.Add(bc as CsCompletionData);
                }
                for (int i = 0; i < c.Items.Count; i++)
                {
                    CsCompletionData dd = (CsCompletionData)c.Items[i];
                    if (CompletionControls.GetHashCode(dd.obs) == (int)obs)
                    {
                        d.Remove(dd);
                    }
                    //if (obs is SymbolKind)
                    //{
                    //    SymbolKind s = (SymbolKind)obs;

                    //    if (dd.obs is SymbolKind)
                    //        if (s == (SymbolKind)dd.obs)
                    //            d.Remove(dd);

                    //}
                    //else if (obs is TypeKind)
                    //{
                    //    TypeKind s = (TypeKind)obs;
                    //    if (dd.obs is TypeKind)
                    //        if (s == (TypeKind)dd.obs)
                    //            d.Remove(dd);
                    //}
                    //if (obs is CsCompletionData)
                    //{
                    //    string s = ((CsCompletionData)obs).obs as string;
                    //    if (dd.obs is string)
                    //        if (s == (string)dd.obs)
                    //            d.Remove(dd);
                    //}
                }
            }

            c.ItemsSource = d;
        }