Ejemplo n.º 1
0
        public MainPage()
        {
            InitializeComponent();

            CardsAgainstHumility.InitDefaultValues(new SettingsLoader(), new NetServices.NetServices());

            vm = new MainViewModel();
            LayoutRoot.DataContext = vm;

            Loaded += delegate
            {
                ViewModelBase.navService = NavigationService;
                ViewModelBase.dispatcher = Dispatcher;
            };
        }
Ejemplo n.º 2
0
        protected override void OnCreate(Bundle bundle)
        {
            CardsAgainstHumility.InitDefaultValues(new SettingsLoader(this), new NetServices.NetServices());

            dialogBuilder = new AlertDialog.Builder(this, 0);

            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            UIAssets.Initialize(Assets);

            var tv = FindViewById <TextView>(Resource.Id.main_logo1);

            if (tv != null)
            {
                tv.SetTypeface(UIAssets.AppFont, TypefaceStyle.Normal);
                try
                {
                    tv.StartAnimation(logo1Animation);
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine("Error occurred while animating the logo: {0}", ex.Message);
                }
            }
            tv = FindViewById <TextView>(Resource.Id.main_logo2);
            if (tv != null)
            {
                tv.SetTypeface(UIAssets.AppFont, TypefaceStyle.Normal);
                try
                {
                    tv.StartAnimation(logo2Animation);
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine("Error occurred while animating the logo: {0}", ex.Message);
                }
            }
            tv = FindViewById <TextView>(Resource.Id.main_logo3);
            if (tv != null)
            {
                tv.SetTypeface(UIAssets.AppFont, TypefaceStyle.Normal);
                try
                {
                    tv.StartAnimation(logo3Animation);
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine("Error occurred while animating the logo: {0}", ex.Message);
                }
            }
            tv = FindViewById <TextView>(Resource.Id.main_logo4);
            if (tv != null)
            {
                tv.SetTypeface(UIAssets.AppFont, TypefaceStyle.Normal);
                try
                {
                    tv.StartAnimation(logo4Animation);
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine("Error occurred while animating the logo: {0}", ex.Message);
                }
            }
            tv = FindViewById <TextView>(Resource.Id.main_logo5);
            if (tv != null)
            {
                tv.SetTypeface(UIAssets.AppFont, TypefaceStyle.Normal);
                try
                {
                    tv.StartAnimation(logo4Animation);
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine("Error occurred while animating the logo: {0}", ex.Message);
                }
            }

            createButton   = FindViewById <Button>(Resource.Id.main_btnCreateGame);
            joinButton     = FindViewById <Button>(Resource.Id.main_btnJoinGame);
            settingsButton = FindViewById <Button>(Resource.Id.main_btnSettings);
            quitButton     = FindViewById <Button>(Resource.Id.main_btnQuitGame);

            if (createButton != null)
            {
                createButton.Click += delegate
                {
                    StartActivity(typeof(CreateGameActivity));
                };
            }
            else
            {
                Console.WriteLine("Unable to get Create Button");
            }

            if (joinButton != null)
            {
                joinButton.Click += delegate
                {
                    StartActivity(typeof(GameBrowserActivity));
                };
            }
            else
            {
                Console.WriteLine("Unable to get Join Button");
            }

            if (settingsButton != null)
            {
                settingsButton.Click += delegate
                {
                    StartActivity(typeof(SettingsActivity));
                };
            }
            else
            {
                Console.WriteLine("Unable to get Settings Button");
            }

            if (quitButton != null)
            {
                quitButton.Click += delegate
                {
                    Finish();
                };
            }
            else
            {
                Console.WriteLine("Unable to get Quit Button");
            }
        }