示例#1
0
        public scene()
        {
            InitializeComponent();

            SceneConnection scene = new SceneConnection();

            List <Scene> scenes = scene.getAll();


            foreach (var item in scenes)
            {
                Button but = new Button();
                but.Content             = item.name;
                but.Tag                 = item.id;
                but.Width               = 100;
                but.HorizontalAlignment = HorizontalAlignment.Left;
                but.Margin              = new Thickness(5);
                but.Click              += new RoutedEventHandler(scene_click);
                StackPanelScene.Children.Add(but);
            }
        }
示例#2
0
        public void divadloTable(int scene_id)
        {
            TheatreConnection Theatre = new TheatreConnection();
            UsersConnection   User    = new UsersConnection();
            SceneConnection   Scene   = new SceneConnection();

            Theatre.updateX(10);

            /* StackPanel */
            StackPanel sp = new StackPanel();

            sp.Margin = new Thickness(5);

            /*Text Block*/
            TextBlock tb = new TextBlock();

            tb.Text = "Divadlo";

            Console.WriteLine();

            Grid sal = new Grid();

            /*sal.HorizontalAlignment = HorizontalAlignment.Center;*/
            sal.VerticalAlignment = VerticalAlignment.Center;
            int radku   = Theatre.getY();
            int sloupcu = Theatre.getX();

            int velikost = 30;             // velikost ctverce - sedadlo


            this.Width  = sloupcu * velikost;
            this.Height = radku * velikost;

            int radek, sloupec;

            for (radek = 0; radek < radku; radek++)
            {
                sal.RowDefinitions.Add(new RowDefinition());
                for (sloupec = 0; sloupec < sloupcu; sloupec++)
                {
                    if (radek == 0)
                    {
                        sal.ColumnDefinitions.Add(new ColumnDefinition());
                    }

                    Button sedadlo = new Button()
                    {
                        Height = velikost,
                        Width  = velikost,
                    };

                    sedadlo.Click += new RoutedEventHandler(sedadlo_Click);

                    sedadlo.Background = Brushes.Green;
                    sedadlo.Tag        = radek + "-" + sloupec;

                    sedadlo.SetValue(Grid.ColumnProperty, sloupec);
                    sedadlo.SetValue(Grid.RowProperty, radek);
                    sedadlo.Margin = new Thickness(5);

                    sal.Children.Add(sedadlo);
                }
            }
            sp.Children.Add(tb);
            sp.Children.Add(sal);

            contentControl.Content = sp;
        }