Пример #1
0
        private void ListViewMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            GridMain.Children.Clear();

            switch (((ListViewItem)((ListView)sender).SelectedItem).Name)
            {
            case "AdminPanel":
                PanelsWrapper.GetUserControlWrapper().TryGetPanelByType(typeof(AdminPanel), out UserControl adminPanel);
                GridMain.Children.Add(adminPanel);
                break;

            case "PlayPanel":
                PanelsWrapper.GetUserControlWrapper().TryGetPanelByType(typeof(PlayPanel), out UserControl playPanel);
                GridMain.Children.Add(playPanel);
                break;

            default:
                break;
            }

            if (ButtonCloseMenu.Visibility == Visibility.Visible)
            {
                ButtonCloseMenu.Visibility = Visibility.Collapsed;
                ButtonOpenMenu.Visibility  = Visibility.Visible;
            }
            else
            {
                e.Handled = true;
            }
        }
Пример #2
0
 internal void MainWindowInit()
 {
     if (PanelsWrapper.GetUserControlWrapper().TryGetPanelByType(typeof(PlayPanel), out UserControl playPanel))
     {
         GridMain.Children.Add(playPanel);
     }
 }
Пример #3
0
        public async static Task AddDemoData()
        {
            await Task.Run(() =>
            {
                using (var dataContext = new DataContext())
                {
                    var greetings = new Subject()
                    {
                        SubjectName = "Greetings"
                    };
                    dataContext.Subjects.Add(greetings);
                    dataContext.Frases.Add(new Frase()
                    {
                        Text = "Hello my dear", Subject = greetings, IsLeft = true
                    });
                    dataContext.Frases.Add(new Frase()
                    {
                        Text = "friend ! ", Subject = greetings, IsLeft = false
                    });

                    var badWords = new Subject()
                    {
                        SubjectName = "Funny stuff"
                    };
                    dataContext.Subjects.Add(badWords);
                    dataContext.Frases.Add(new Frase()
                    {
                        Text = "You are a", Subject = badWords, IsLeft = true
                    });
                    dataContext.Frases.Add(new Frase()
                    {
                        Text = "giant elefant", Subject = badWords, IsLeft = false
                    });
                    dataContext.SaveChanges();
                }
            }).ConfigureAwait(true);

            if (PanelsWrapper.GetUserControlWrapper().TryGetPanelByType(typeof(PlayPanel), out UserControl playPanel) &&
                playPanel is PlayPanel ourPlayPanel)
            {
                ourPlayPanel.GameWrapperVM.LoadData();
            }
        }