Пример #1
0
        private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            foreach (var button in BussinessApplication.Current.Buttons)
            {
                TitleButton.Items.Add(button);
            }
            BussinessApplication.Current.Buttons.CollectionChanged += Buttons_CollectionChanged;

            StartMenu         = new StartMenu();
            StartMenuItem.Tag = StartMenu;
            foreach (var flow in Flows)
            {
                StartMenuGroup group = new StartMenuGroup();
                Label          name  = new Label();
                name.FontSize   = 48;
                name.Content    = flow.Name;
                name.Foreground = Brushes.Black;
                group.Header    = name;

                foreach (var item in flow.Items.OrderBy(t => t.Order))
                {
                    Tile tile = new Tile();
                    tile.Title      = item.Name;
                    tile.Background = Brushes.Green;
                    if (item.SmallSize)
                    {
                        tile.Width = 120;
                    }
                    else
                    {
                        tile.Width = 248;
                    }
                    tile.Height = 120;
                    tile.Click += Tile_Click;
                    tile.Tag    = item;
                    if (item.Icon != null)
                    {
                        tile.Content = new Rectangle {
                            Fill = new VisualBrush(item.Icon)
                            {
                                Stretch = Stretch.Uniform
                            }, Width = item.IconSize.Width, Height = item.IconSize.Height
                        }
                    }
                    ;
                    tile.Margin = new Thickness(4);

                    group.Items.Add(tile);
                }

                StartMenu.Items.Add(group);
            }
            ContentControl.Content = StartMenu;
        }
Пример #2
0
        private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            foreach (var button in BussinessApplication.Current.Buttons)
                TitleButton.Items.Add(button);
            BussinessApplication.Current.Buttons.CollectionChanged += Buttons_CollectionChanged;

            StartMenu = new StartMenu();
            StartMenuItem.Tag = StartMenu;
            foreach (var flow in Flows)
            {
                StartMenuGroup group = new StartMenuGroup();
                Label name = new Label();
                name.FontSize = 48;
                name.Content = flow.Name;
                name.Foreground = Brushes.Black;
                group.Header = name;

                foreach (var item in flow.Items.OrderBy(t => t.Order))
                {
                    Tile tile = new Tile();
                    tile.Title = item.Name;
                    tile.Background = Brushes.Green;
                    if (item.SmallSize)
                        tile.Width = 120;
                    else
                        tile.Width = 248;
                    tile.Height = 120;
                    tile.Click += Tile_Click;
                    tile.Tag = item;
                    if (item.Icon != null)
                        tile.Content = new Rectangle { Fill = new VisualBrush(item.Icon) { Stretch = Stretch.Uniform }, Width = item.IconSize.Width, Height = item.IconSize.Height };
                    tile.Margin = new Thickness(4);

                    group.Items.Add(tile);
                }

                StartMenu.Items.Add(group);
            }
            ContentControl.Content = StartMenu;
        }