Пример #1
0
        //Wissenstest StartPage --> Bezirk, Feuerwehr, Stufe
        public IActionResult Start()
        {
            //Datenbankobjekte brauchen Zeit zum initialisieren
            //System.Threading.Thread.Sleep(3000);

            //DB-ConnectionTest + TestLog
            //var test_bezirke_count = test_db.Bezirk.Count();
            //logger.LogInformation($"DB Bezirke: {test_bezirke_count}");

            //Main-DB-ConetionTest
            var main_test_bezirke_count = main_db.Bezirk.Count();

            logger.LogInformation($"DB Main Bezirke: {main_test_bezirke_count}");

            //Bezirksnamen in SelectListItems umwandeln --> Value: Bezirksname  --> eventuell auf BezirksID umändern
            List <DB_lib.Bezirk>  bezirke     = main_db.Bezirk.OrderBy(x => x.BezirkName).ToList();
            List <SelectListItem> bezirkeList = new List <SelectListItem>();
            SelectListItem        kein_bezirk = new SelectListItem {
                Text = "kein Bezirk ausgewählt", Value = "noBezirkSelected"
            };

            kein_bezirk.Selected = true;
            bezirkeList.Add(kein_bezirk);
            foreach (DB_lib.Bezirk b in bezirke)
            {
                SelectListItem bezirkItem = new SelectListItem {
                    Text = b.BezirkName, Value = b.BezirkName
                };
                bezirkeList.Add(bezirkItem);
            }

            List <SelectListItem> standorteList = new List <SelectListItem>();
            SelectListItem        kein_stadort  = new SelectListItem {
                Text = "kein Standort ausgewählt", Value = "noStandortSelected"
            };

            kein_stadort.Selected = true;
            standorteList.Add(kein_stadort);


            //Datenübergabe an Model / Modelübergabe an View
            var start_Model = new Start_Model();

            start_Model.BezikeList    = bezirkeList;
            start_Model.StandorteList = standorteList;
            return(View(start_Model));
        }
Пример #2
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            this.InitializeComponent();
            this.Suspending += OnSuspending;

 
            MainEventRouter.InitFrameNavigator(ref  m_MainFrame);
            MainFrame.GetFrameNavigator().PageInitActions = new Dictionary<Type, Action<MVVMSidekick.Views.LayoutAwarePage, IDictionary<string, object>>> 
                { 
                    {
                        typeof (Start) , 
                        ( (p,pars)=>
                        {
                            var st = Constants.Storages.Instance.GameInfomationsStorage;

                            var vm = new Start_Model(st);
                      
                            p.DefaultViewModel = vm;
                    
                        })
                    },
                    {
                      typeof (  NewGame ), 
                        ( (p,pars)=>
                        {
                            var vm = new NewGame_Model(Constants.Storages.Instance.GameInfomationsStorage);
                            p.DefaultViewModel = vm;
                    
                        })
                    },
                    {
                        typeof (  GamePlay) , 
                        ( async (p,pars)=>
                        {

                            var gi=pars[NavigateParameterKeys.GameInfomation_ChosenGame] as GameInfomation;
                            var gameKey=gi.GameType == GameType.Advanced ? gi.AdvanceGameKey :gi.GameType.ToString ();
                            var fac = Constants.Games.Factories[gameKey] as GameFactoryBase;
                            var game = await fac.CreateGame(gi,((GamePlay )p).GameFrame );
                            p.DefaultViewModel = new GamePlay_Model()
                            {
                                GameData  = (BindableBase)game.DefaultViewModel,
                                CurrentGameInfomation = gi,                                
                            };



                            var gplayp = p as GamePlay;
                            gplayp.GamePage = game;


                        })
                    },
                    {
                        typeof (SelectPlayers) ,
                        (p,pars)=>
                            {}

                    
                    }
                };

        }