Exemplo n.º 1
0
        // GET: Events
        public ActionResult Index()
        {
            var viewModel = new EventPageViewModel {
                AllEvents   = db.Events.ToList(),
                AllBookings = db.EventBookings.ToList()
            };

            return(View(viewModel));
        }
Exemplo n.º 2
0
        public EventPage(int id)
        {
            vm             = new EventPageViewModel(id);
            BindingContext = vm;
            InitializeComponent();
            webView.Navigating += (s, e) =>
            {
                if (e.Url.StartsWith("file:"))
                {
                    try
                    {
                        Regex  ex            = new Regex(@"\/[a-z0-9]+");
                        var    result        = Regex.Matches(e.Url, @"(\/[a-z0-9]+)");
                        string extractedText = "";
                        foreach (var item in result)
                        {
                            extractedText += item.ToString();
                        }


                        var uri = new Uri("https://www.aims.org.au" + extractedText);

                        Device.OpenUri(uri);
                    }
                    catch (Exception ex)
                    {
                        Log.Error("myapp", ex.ToString());
                    }
                }
                else if (e.Url.StartsWith("mailto:"))
                {
                    try
                    {
                        var uri = new Uri(e.Url);
                        Device.OpenUri(uri);
                    }
                    catch (Exception ex)
                    {
                        Log.Error("myapp", ex.ToString());
                    }
                }
                else if (e.Url.StartsWith("http"))
                {
                    try
                    {
                        var uri = new Uri(e.Url);
                        Device.OpenUri(uri);
                    }
                    catch (Exception ex)
                    {
                        Log.Error("myapp", ex.ToString());
                    }
                }

                e.Cancel = true;
            };
        }
        private static void TestEventViewModel(
            IEventLoaderService loaderService,
            params Event[] expectedEvents)
        {
            var eventViewModel = new EventPageViewModel(loaderService);

            WaitForPropertyChanged(
                eventViewModel,
                () => eventViewModel.RefreshDataCommand.Execute(null),
                pce => pce.PropertyName == nameof(eventViewModel.IsBusy) && !eventViewModel.IsBusy);

            eventViewModel.Events.Count.Should().Be(expectedEvents.Length);

            for (var i = 0; i < expectedEvents.Length; i++)
            {
                var expectedEvent = expectedEvents[i];
                var actualEvent   = eventViewModel.Events[i];

                actualEvent.Title.Should().Be(expectedEvent.Title);
                actualEvent.Description.Should().Be(expectedEvent.Description);
                actualEvent.RSVPCount.Should().Be(expectedEvent.RSVPCount);
            }
        }
Exemplo n.º 4
0
 public EventPage()
 {
     InitializeComponent();
     _viewModel     = DependencyInjection.Container.GetInstance <EventPageViewModel>();
     BindingContext = _viewModel;
 }