public MainView(MainViewController parent)
            {
                BackgroundColor     = UIColor.White;
                backgroundImageView = new UIImageView(UIImage.FromBundle("background"));
                AddSubview(backgroundImageView);

                logoImageView = new UIImageView(new RectangleF(20, 40, 150, 45))
                {
                    Image       = UIImage.FromBundle("logo_mainhub"),
                    ContentMode = UIViewContentMode.ScaleAspectFit,
                };
                AddSubview(logoImageView);

                nextVisitView = new NextVisitView();
                nextVisitView.TouchUpInside += (sender, args) => Parent.ShowVisitDetails(nextVisitView.Visit);
                AddSubview(nextVisitView);

                otherVisitFlipper = new VisitFlipper {
                    Selected = visit => Parent.ShowVisitDetails(visit)
                };
                AddSubview(otherVisitFlipper);

                todayVisitsViewController = new VisitsViewController
                {
                    Title    = "Today's Visits",
                    Selected = visit => Parent.ShowVisitDetails(visit)
                };
                AddSubview(todayVisitsViewController.View);
                parent.AddChildViewController(todayVisitsViewController);
            }
Пример #2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }


            Visit visit = await _context.Visits.FirstOrDefaultAsync(m => m.Id == id);

            if (visit == null)
            {
                return(NotFound());
            }


            var          uaParser = Parser.GetDefault();
            ClientInfo   client   = uaParser.Parse(visit.UserAgent);
            FullResponse response = null;

            try
            {
                var api = new IpInfoApi(configuration.GetValue <string>("IpinfoToken"), clientFactory.CreateClient());
                response = await api.GetInformationByIpAsync(visit.IP);
            }
            catch (Exception) { }

            Visit = new()
            {
                Id         = visit.Id,
                Share      = visit.Share,
                User       = visit.User,
                Date       = visit.Date,
                IP         = visit.IP,
                UserAgent  = visit.UserAgent,
                ClientInfo = client,
                IpInfo     = response,
                Access     = visit.Access
            };

            return(Page());
        }