Ejemplo n.º 1
0
        private void MakeComboItems()
        {
            IUICollection itemsSource = ComboSelect.ItemsSource;

            if (DataManager.Instance.Session == null)
            {
                ComboSelect.SelectedItem = Constants.UI_Collection_InvalidIndex;
                itemsSource.Clear();
                return;
            }
            itemsSource.Add(new GalleryItemPropertySet()
            {
                Label = "Session", CategoryID = Constants.UI_Collection_InvalidIndex
            });
            if (DataManager.Instance.LapManager.Count > 1)
            {
                for (int i = 0; i < DataManager.Instance.LapManager.Count; i++)
                {
                    itemsSource.Add(new GalleryItemPropertySet()
                    {
                        Label = "Lap " + (i + 1).ToString(), CategoryID = Constants.UI_Collection_InvalidIndex
                    });
                }
            }
            ComboSelect.SelectedItem = 0;
        }
Ejemplo n.º 2
0
        private void SetComboValues(RibbonComboBox comboBox)
        {
            IUICollection itemsSource = comboBox.ItemsSource;

            itemsSource.Add(new GalleryItemPropertySet()
            {
                Label = "0", CategoryID = Constants.UI_Collection_InvalidIndex
            });
            itemsSource.Add(new GalleryItemPropertySet()
            {
                Label = "3", CategoryID = Constants.UI_Collection_InvalidIndex
            });
            itemsSource.Add(new GalleryItemPropertySet()
            {
                Label = "10", CategoryID = Constants.UI_Collection_InvalidIndex
            });
            itemsSource.Add(new GalleryItemPropertySet()
            {
                Label = "15", CategoryID = Constants.UI_Collection_InvalidIndex
            });
            itemsSource.Add(new GalleryItemPropertySet()
            {
                Label = "30", CategoryID = Constants.UI_Collection_InvalidIndex
            });
            comboBox.SelectedItem = GetSelectedItem(comboBox);
        }
Ejemplo n.º 3
0
        void _comboBox2_CategoriesReady(object sender, EventArgs e)
        {
            // set _comboBox2 categories
            IUICollection categories2 = _comboBox2.Categories;

            categories2.Clear();
            categories2.Add(new GalleryItemPropertySet()
            {
                Label = "Category 1", CategoryID = 1
            });
            categories2.Add(new GalleryItemPropertySet()
            {
                Label = "Category 2", CategoryID = 2
            });
        }
        public int LoadItemsSource(GalleryItems items, PropVariantRef currentValue, ref PropVariant newValue)
        {
            if (currentValue != null && currentValue.PropVariant.Value is IUICollection)
            {
                IUICollection collection = (IUICollection)currentValue.PropVariant.Value;
                collection.Clear();

                foreach (GalleryItem item in items)
                {
                    SimplePropertySet sps;
                    LoadSimplePropertySet(item, out sps);
                    collection.Add(sps);
                }
                newValue.SetIUnknown(collection);
                return(HRESULT.S_OK);
            }

            List <IUISimplePropertySet> list = new List <IUISimplePropertySet>();

            foreach (GalleryItem item in items)
            {
                SimplePropertySet sps;
                LoadSimplePropertySet(item, out sps);
                list.Add(sps);
            }
            newValue.SetIUnknown(new BasicCollection(list));
            return(HRESULT.S_OK);
        }
Ejemplo n.º 5
0
        private void InRibbonGallery_ItemsSourceReady(object sender, EventArgs e)
        {
            // set _inRibbonGallery items
            IUICollection itemsSource = InRibbonGallery.ItemsSource;

            InRibbonGallery.ExecuteEvent += InRibbonGallery_ExecuteEvent;
            itemsSource.Clear();
            Font font = new Font("Segoe UI", 9f);

            for (int i = 0; i < 64; i++)
            {
                Bitmap   image = new Bitmap(32, 32);
                Graphics g     = Graphics.FromImage(image);
                g.FillRectangle(Brushes.Red, new Rectangle(new Point(3, 3), new Size(26, 26)));
                g.DrawString((i + 1).ToString(), font, Brushes.White, 10f, 10f);
                g.Dispose();

                itemsSource.Add(new GalleryItemPropertySet()
                {
                    ItemImage  = Ribbon.ConvertToUIImage((Bitmap)image),
                    CategoryID = (uint)(i + 1),
                    //Label = (i + 1).ToString(),
                });
                uint count;
                itemsSource.GetCount(out count);
                object item;
                itemsSource.GetItem(count - 1, out item);
                GalleryItemPropertySet set = item as GalleryItemPropertySet;
                if (set != null)
                {
                }
            }
        }
Ejemplo n.º 6
0
        void _splitButtonGallery_ItemsSourceReady(object sender, EventArgs e)
        {
            // set label
            _splitButtonGallery.Label = "Brushes";

            // prepare helper classes for commands
            _buttons = new RibbonButton[imageListBrushes.Images.Count];
            uint i;

            for (i = 0; i < _buttons.Length; ++i)
            {
                _buttons[i] = new RibbonButton(_ribbon, 2000 + i)
                {
                    Label      = "Label " + i.ToString(),
                    LargeImage = _ribbon.ConvertToUIImage((Bitmap)imageListBrushes.Images[(int)i])
                };
            }

            // set _splitButtonGallery items
            IUICollection itemsSource = _splitButtonGallery.ItemsSource;

            itemsSource.Clear();
            i = 0;
            foreach (Image image in imageListBrushes.Images)
            {
                itemsSource.Add(new GalleryCommandPropertySet()
                {
                    CommandID   = 2000 + i++,
                    CommandType = CommandType.Action,
                    CategoryID  = 1
                });
            }
        }
Ejemplo n.º 7
0
        void _buttonNew_ExecuteEvent(object sender, ExecuteEventArgs e)
        {
            // changing QAT commands list
            IUICollection itemsSource = _ribbonQuickAccessToolbar.ItemsSource;

            itemsSource.Clear();
            itemsSource.Add(new GalleryCommandPropertySet()
            {
                CommandID = (uint)RibbonMarkupCommands.cmdButtonNew
            });
            itemsSource.Add(new GalleryCommandPropertySet()
            {
                CommandID = (uint)RibbonMarkupCommands.cmdButtonOpen
            });
            itemsSource.Add(new GalleryCommandPropertySet()
            {
                CommandID = (uint)RibbonMarkupCommands.cmdButtonSave
            });
        }
Ejemplo n.º 8
0
        void _comboBox3_ItemsSourceReady(object sender, EventArgs e)
        {
            // set combobox3 items
            IUICollection itemsSource3 = _comboBox3.ItemsSource;

            itemsSource3.Clear();
            itemsSource3.Add(new GalleryItemPropertySet()
            {
                Label = "Label 1", CategoryID = Constants.UI_Collection_InvalidIndex
            });
            itemsSource3.Add(new GalleryItemPropertySet()
            {
                Label = "Label 2", CategoryID = Constants.UI_Collection_InvalidIndex
            });
            itemsSource3.Add(new GalleryItemPropertySet()
            {
                Label = "Label 3", CategoryID = Constants.UI_Collection_InvalidIndex
            });
        }
Ejemplo n.º 9
0
        void _comboBox2_ItemsSourceReady(object sender, EventArgs e)
        {
            // set _comboBox2 items
            IUICollection itemsSource2 = _comboBox2.ItemsSource;

            itemsSource2.Clear();
            itemsSource2.Add(new GalleryItemPropertySet()
            {
                Label = "Label 1", CategoryID = 1
            });
            itemsSource2.Add(new GalleryItemPropertySet()
            {
                Label = "Label 2", CategoryID = 1
            });
            itemsSource2.Add(new GalleryItemPropertySet()
            {
                Label = "Label 3", CategoryID = 2
            });
        }
Ejemplo n.º 10
0
        void _splitButtonGallery_CategoriesReady(object sender, EventArgs e)
        {
            // set _splitButtonGallery categories
            IUICollection categories = _splitButtonGallery.Categories;

            categories.Clear();
            categories.Add(new GalleryItemPropertySet()
            {
                Label = "Category 1", CategoryID = 1
            });
        }
Ejemplo n.º 11
0
        void _buttonDropE_ExecuteEvent(object sender, ExecuteEventArgs e)
        {
            IUICollection itemsSource1 = _comboBox1.ItemsSource;
            uint          count;

            itemsSource1.GetCount(out count);
            ++count;
            itemsSource1.Add(new GalleryItemPropertySet()
            {
                Label = "Label " + count.ToString(), CategoryID = Constants.UI_Collection_InvalidIndex
            });
        }
Ejemplo n.º 12
0
        void _inRibbonGallery_ItemsSourceReady(object sender, EventArgs e)
        {
            // set _inRibbonGallery items
            IUICollection itemsSource = _inRibbonGallery.ItemsSource;

            itemsSource.Clear();
            foreach (Image image in imageListShapes.Images)
            {
                itemsSource.Add(new GalleryItemPropertySet()
                {
                    ItemImage = _ribbon.ConvertToUIImage((Bitmap)image)
                });
            }
        }
Ejemplo n.º 13
0
        void _dropDownGallery_ItemsSourceReady(object sender, EventArgs e)
        {
            // set label
            _dropDownGallery.Label = "Size";

            // set _dropDownGallery items
            IUICollection itemsSource = _dropDownGallery.ItemsSource;

            itemsSource.Clear();
            foreach (Image image in imageListLines.Images)
            {
                itemsSource.Add(new GalleryItemPropertySet()
                {
                    ItemImage = _ribbon.ConvertToUIImage((Bitmap)image)
                });
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        ///
        /// </summary>
        public HRESULT UpdateProperty(ref PropertyKey key, PropVariantRef currentValue, ref PropVariant newValue)
        {
            if (key == RibbonProperties.ItemsSource)
            {
                if (_itemsSource != null)
                {
                    IUICollection itemsSource = (IUICollection)currentValue.PropVariant.Value;

                    itemsSource.Clear();
                    uint count;
                    _itemsSource.GetCount(out count);
                    for (uint i = 0; i < count; ++i)
                    {
                        object item;
                        _itemsSource.GetItem(i, out item);
                        itemsSource.Add(item);
                    }
                }
            }
            return(HRESULT.S_OK);
        }