/*private void Timer_Tick(object sender, EventArgs e)
         * {
         *  bool called = false;
         *  if (DateTime.Now.Second==0 && !called)
         *  {
         *      CallSecondTick(DateTime.Now.Minute);
         *      called = true;
         *  }//ha gyorsabb a tick mint 1 mp akkor többször is meg hívódna mint kell
         *  if (called && DateTime.Now.Second == 10)
         *  {
         *      called = false;
         *  }
         * }*/

        private void CreateMainMenu()
        {
            Log.Message("Menü létrehozva.");
            gm      = null;
            ovm     = null;
            gevm    = null;
            spvm    = null;
            mpvm    = null;
            mmvm    = null;
            players = null;
            players = new List <Gamer>();
            mmvm    = new MainMenuViewModel();
            g.Children.Clear();
            //play gomb
            Button play = new Button();

            play.Margin   = new Thickness(0, -250, 0, 0);
            play.Height   = 50;
            play.Width    = 200;
            play.FontSize = 20;
            play.Content  = "Játék";
            play.Click   += Play_Click;
            //exit gomb
            Button exit = new Button();

            exit.Height   = 50;
            exit.Margin   = new Thickness(0, 100, 0, 0);
            exit.Width    = 200;
            exit.FontSize = 20;
            exit.Content  = "Kilépés";
            exit.Click   += Exit_Click;
            //options
            Button options = new Button();

            options.Height   = 50;
            options.Margin   = new Thickness(0, -10, 0, 0);
            options.Width    = 200;
            options.FontSize = 20;
            options.Content  = "Beállítások";
            options.Click   += Options_Click;
            //gamemode
            Label gml = new Label();

            gml.Height   = 30;
            gml.Width    = 100;
            gml.Content  = "Játékmód";
            gml.Margin   = new Thickness(0, -160, 0, 0);
            gml.FontSize = 15;
            //játékmód
            ComboBox cb = new ComboBox();

            cb.Height      = 30;
            cb.Width       = 200;
            cb.Margin      = new Thickness(0, -100, 0, 0);
            cb.BorderBrush = Brushes.Black;
            cb.FontSize    = 15;
            cb.SetBinding(ComboBox.SelectedItemProperty, new Binding("SelectedGamemode"));
            cb.SetBinding(ComboBox.ItemsSourceProperty, new Binding("GameModeList"));

            g.Children.Add(cb);
            g.Children.Add(gml);
            g.Children.Add(options);
            g.Children.Add(play);
            g.Children.Add(exit);

            DataContext = mmvm;
        }
        private void Multi_Click(object sender, RoutedEventArgs e)
        {
            Log.Message("Multiplayer Létrehozva.");
            mpvm = new MultiPlayerViewModel();
            g.Children.Clear();

            //play btn
            Button play = new Button();

            play.Height   = 50;
            play.Margin   = new Thickness(220, 270, 0, 0);
            play.Width    = 100;
            play.FontSize = 20;
            play.Content  = "Játék";
            play.Click   += Play_Click2;
            //menü btn
            Button menu = new Button();

            menu.Height   = 50;
            menu.Margin   = new Thickness(-220, 270, 0, 0);
            menu.Width    = 100;
            menu.FontSize = 20;
            menu.Content  = "Menü";
            menu.Click   += Back_Click;
            //következő játékos felvétele btn
            Button next = new Button();

            next.Height   = 50;
            next.Margin   = new Thickness(0, 270, 0, 0);
            next.Width    = 100;
            next.FontSize = 20;
            next.Content  = "Következő";
            next.Click   += mpvm.AddNext;
            //név felirat
            Label nam = new Label();

            nam.Foreground = Brushes.White;
            nam.Content    = "Név: ";
            nam.Height     = 40;
            nam.Width      = 50;
            nam.Margin     = new Thickness(-100, -500, 0, 0);
            nam.FontSize   = 20;
            //név box
            TextBox name = new TextBox();

            name.SetBinding(TextBox.TextProperty, "Name");
            name.Height   = 30;
            name.Width    = 200;
            name.Margin   = new Thickness(100, -450, 0, 0);
            name.FontSize = 20;
            //jobb-bal karakter váltó btn
            Button left  = new Button();
            Button right = new Button();

            left.Content  = "<";
            right.Content = ">";
            left.Margin   = new Thickness(-200, -200, 0, 0);
            right.Margin  = new Thickness(200, -200, 0, 0);
            left.Height   = 200;
            right.Height  = 200;
            left.Width    = 20;
            right.Width   = 20;
            right.Click  += mpvm.Right;
            left.Click   += mpvm.Left;
            //karakter kép
            Image   im = new Image();
            Binding b  = new Binding("Selected.Alak");

            b.Converter = (IValueConverter)FindResource("StringToImageConverter");
            im.SetBinding(Image.SourceProperty, b);
            im.Width  = 96;
            im.Height = 160;
            im.Margin = new Thickness(0, -200, 0, 0);
            //bal mozgás box
            TextBox leftk = new TextBox();

            leftk.SetBinding(TextBox.TextProperty, new Binding("Leftk"));
            leftk.Height    = 30;
            leftk.Width     = 100;
            leftk.Margin    = new Thickness(500, -200, 0, 0);
            leftk.FontSize  = 20;
            leftk.MaxLength = 1;
            //ugrás box
            TextBox jumpk = new TextBox();

            jumpk.SetBinding(TextBox.TextProperty, new Binding("Jumpk"));
            jumpk.Height    = 30;
            jumpk.Width     = 100;
            jumpk.Margin    = new Thickness(500, -100, 0, 0);
            jumpk.FontSize  = 20;
            jumpk.MaxLength = 1;
            //jobb box
            TextBox rightk = new TextBox();

            rightk.SetBinding(TextBox.TextProperty, new Binding("Rightk"));
            rightk.Height    = 30;
            rightk.Width     = 100;
            rightk.Margin    = new Thickness(500, 0, 0, 0);
            rightk.FontSize  = 20;
            rightk.MaxLength = 1;
            if (mmvm.SelectedGamemode == gamemode_type.Extrém)
            {//csak ha extrém a játékmód tehát szükséges
                //buff használat box
                TextBox buf = new TextBox();
                buf.SetBinding(TextBox.TextProperty, new Binding("Buf"));
                buf.Height    = 30;
                buf.Width     = 100;
                buf.Margin    = new Thickness(500, 100, 0, 0);
                buf.FontSize  = 20;
                buf.MaxLength = 1;
                g.Children.Add(buf);
            }
            /*statok kiírása*/
            //élet felirat
            Label health = new Label();

            health.ContentStringFormat = "Élet: {0}";
            health.SetBinding(Label.ContentProperty, new Binding("Selected.Health"));
            health.Foreground = Brushes.Black;
            health.Height     = 30;
            health.Width      = 100;
            health.Margin     = new Thickness(-100, 90, 0, 0);
            //sebesség felirat
            Label speed = new Label();

            speed.SetBinding(Label.ContentProperty, new Binding("Selected.Speed"));
            speed.Foreground          = Brushes.Black;
            speed.ContentStringFormat = "Sebesség: {0}";
            speed.Height = 30;
            speed.Width  = 100;
            speed.Margin = new Thickness(-100, 140, 0, 0);
            //ugrás magasság felirat
            Label jump = new Label();

            jump.SetBinding(Label.ContentProperty, new Binding("Selected.JumpHeight"));
            jump.Foreground          = Brushes.Black;
            jump.ContentStringFormat = "Ugrás magasság: {0}";
            jump.Height = 30;
            jump.Width  = 150;
            jump.Margin = new Thickness(-55, 190, 0, 0);

            g.Children.Add(rightk);
            g.Children.Add(leftk);
            g.Children.Add(jumpk);
            g.Children.Add(next);
            g.Children.Add(menu);
            g.Children.Add(play);
            g.Children.Add(jump);
            g.Children.Add(speed);
            g.Children.Add(health);
            g.Children.Add(im);
            g.Children.Add(left);
            g.Children.Add(right);
            g.Children.Add(name);
            g.Children.Add(nam);

            DataContext = mpvm;
        }