public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View.Frame = new CGRect(View.Frame.Location, new CGSize(UIScreen.MainScreen.Bounds.Width, View.Frame.Height));

            followButton.Layer.CornerRadius = _cornerRadius;
            followButton.TitleLabel.Font    = Constants.Semibold14;
            followButton.Layer.BorderColor  = Constants.R244G244B246.CGColor;

            username.Font         = Constants.Semibold20;
            websiteTextView.Font  = Constants.Regular14;
            descriptionLabel.Font = Constants.Regular14;
            locationLabel.Font    = Constants.Regular12;
            balanceLabel.Font     = Constants.Regular14;
            balanceValue.Font     = Constants.Regular14;

            Avatar = new UIImageView(new CGRect(5, 5, 80, 80));
            Avatar.Layer.CornerRadius     = Avatar.Frame.Width / 2;
            Avatar.ClipsToBounds          = true;
            Avatar.UserInteractionEnabled = true;
            Avatar.ContentMode            = UIViewContentMode.ScaleAspectFill;

            PowerFrame = new CircleFrame(Avatar, new CGRect(0, 0, 90, 90));
            View.Add(PowerFrame);

            PowerFrame.AutoSetDimensionsToSize(new CGSize(90, 90));
            PowerFrame.AutoPinEdgeToSuperviewEdge(ALEdge.Top, 25f);
            PowerFrame.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 30f);
            PowerFrame.AutoAlignAxis(ALAxis.Horizontal, followButton);
            stackView.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, PowerFrame, 9f);
#if !DEBUG
            accountViewHeight.Constant = 0;
#endif
            _viewLoaded();
        }
示例#2
0
        public DetailsPage(MeasurementVmItem vmItem)
        {
            InitializeComponent();
            var vm = new DetailsViewModel(Navigation, vmItem);

            BindingContext = vm;

            Circle = CircleFrame.CreateCircleFrame();

            QualityText = new Frame
            {
                Content = new StackLayout
                {
                    Children =
                    {
                        QualityTextLabel.CreateQualityText(),
                        QualityTextDescription.CreateQualityTextDescription()
                    }
                }
            };

            PmValuesGrid = new Grid
            {
                ColumnDefinitions = new ColumnDefinitionCollection
                {
                    new ColumnDefinition
                    {
                        Width = GridLength.Star
                    }
                },

                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition
                    {
                        Height = GridLength.Star
                    },
                    new RowDefinition
                    {
                        Height = GridLength.Star
                    }
                }
            };

            PmValuesGrid.Children.Add(
                GridItem.CreateGridItem("PM 2.5", "mg/m3", DetailsViewModel.PmTwoPointFiveValueBindName,
                                        DetailsViewModel.PmTwoPointFivePercentBindName), 0, 0);
            PmValuesGrid.Children.Add(
                GridItem.CreateGridItem("PM 10", "mg/m3", DetailsViewModel.PmTenValueBindName,
                                        DetailsViewModel.PmTenPercentBindName), 1, 0);

            HumiditySlider = SliderItem.CreateSlider("Humidity", 0, 100, "%", DetailsViewModel.HumidityBindName);
            PressureSlider = SliderItem.CreateSlider("Pressure", 900, 1100, "hPa", DetailsViewModel.PressureBindName);

            MyStackLayout.Children.Add(Circle);
            MyStackLayout.Children.Add(QualityText);
            MyStackLayout.Children.Add(PmValuesGrid);
            MyStackLayout.Children.Add(HumiditySlider);
            MyStackLayout.Children.Add(PressureSlider);
        }
示例#3
0
        private void checkCircle(Person person)
        {
            Stack <CircleFrame> stack = new Stack <CircleFrame>();
            CircleFrame         root  = new CircleFrame()
            {
                Id = person.Id, firstName = person.FirstName, lastName = person.LastName
            };

            stack.Push(root);
            checkCircle(person.FatherId, person.Id, stack);
            checkCircle(person.MotherId, person.Id, stack);
        }
示例#4
0
 public static void Preserve()
 {
     CardsView.Preserve();
     CarouselView.Preserve();
     CoverFlowView.Preserve();
     ArrowControl.Preserve();
     LeftArrowControl.Preserve();
     RightArrowControl.Preserve();
     CircleFrame.Preserve();
     IndicatorItemView.Preserve();
     IndicatorsControl.Preserve();
     ParentScrollView.Preserve();
 }
示例#5
0
        private void checkCircle(long?currentPersonId, long rootPersonId, Stack <CircleFrame> stack)
        {
            if (currentPersonId == null)
            {
                return;
            }
            if (rootPersonId == currentPersonId.Value)
            {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("存在循环:");
                CircleFrame circleFrame = null;
                for (int i = stack.Count - 1; i >= 0; i--)
                {
                    circleFrame = stack.ElementAt(i);
                    stringBuilder.Append(circleFrame.lastName);
                    stringBuilder.Append(circleFrame.firstName);
                    stringBuilder.Append("->");
                }
                circleFrame = stack.ElementAt(stack.Count - 1);
                stringBuilder.Append(circleFrame.lastName);
                stringBuilder.Append(circleFrame.firstName);

                throw new RelationsipException(stringBuilder.ToString());
            }
            Person currentPerson = db.Person.SingleOrDefault(p => p.Id == currentPersonId.Value);

            if (currentPerson == null)
            {
                throw new RelationsipException(string.Format("不存丰ID为{0}的人员,请检查。", currentPersonId));
            }
            CircleFrame currentCheckCircle = new CircleFrame()
            {
                Id        = currentPerson.Id,
                firstName = currentPerson.FirstName,
                lastName  = currentPerson.LastName
            };

            stack.Push(currentCheckCircle);
            checkCircle(currentPerson.MotherId, rootPersonId, stack);
            checkCircle(currentPerson.FatherId, rootPersonId, stack);
            stack.Pop();
        }
        public UIView CreateView()
        {
            var screenWidth = UIScreen.MainScreen.Bounds.Width;

            UserInteractionEnabled = true;

            #region topPanel

            topView = new UIView();
            topView.BackgroundColor = UIColor.Clear;
            topView.Frame           = new CGRect(mainMargin - 5, mainMargin, screenWidth - mainMargin * 2, topViewHeight);

            avatar = new UIImageView(new CGRect(5, 5, photoSide, photoSide));
            avatar.Layer.CornerRadius     = photoSide / 2;
            avatar.ClipsToBounds          = true;
            avatar.UserInteractionEnabled = true;
            avatar.ContentMode            = UIViewContentMode.ScaleAspectFill;
            avatar.BackgroundColor        = UIColor.Clear;
            powerFrame = new CircleFrame(avatar, new CGRect(0, 0, powerFrameSide, powerFrameSide));

            infoView              = new UIStackView();
            infoView.Axis         = UILayoutConstraintAxis.Vertical;
            infoView.Alignment    = UIStackViewAlignment.Fill;
            infoView.Distribution = UIStackViewDistribution.FillEqually;
            infoView.Frame        = new CGRect(powerFrameSide + topViewSpacing, 0, screenWidth - mainMargin * 2 - (powerFrameSide + topViewSpacing), topViewHeight + 8);

            userName = new UILabel();
            userName.UserInteractionEnabled = false;
            userName.TextColor       = Helpers.Constants.R15G24B30;
            userName.Font            = Helpers.Constants.Semibold20;
            userName.Lines           = 1;
            userName.LineBreakMode   = UILineBreakMode.TailTruncation;
            userName.BackgroundColor = UIColor.Clear;

            userLocation = new UILabel();
            userLocation.UserInteractionEnabled = false;
            userLocation.TextColor       = Helpers.Constants.R151G155B158;
            userLocation.Font            = Helpers.Constants.Regular14;
            userLocation.Lines           = 1;
            userLocation.LineBreakMode   = UILineBreakMode.TailTruncation;
            userLocation.BackgroundColor = UIColor.Clear;

            var topEmptyView    = new UIView();
            var bottomEmptyView = new UIView();

            infoView.AddArrangedSubview(topEmptyView);
            infoView.AddArrangedSubview(userName);
            infoView.AddArrangedSubview(userLocation);
            infoView.AddArrangedSubview(bottomEmptyView);

            topView.AddSubview(powerFrame);
            topView.AddSubview(infoView);
            AddSubview(topView);

            #endregion

            attributedLabel       = new TTTAttributedLabel();
            attributedLabel.Lines = 0;
            attributedLabel.EnabledTextCheckingTypes = NSTextCheckingType.Link;

            var prop = new NSDictionary();
            attributedLabel.LinkAttributes       = prop;
            attributedLabel.ActiveLinkAttributes = prop;

            attributedLabel.Delegate = new TTTAttributedLabelCustomDelegate();

            at = new NSMutableAttributedString();

            followButton = new UIButton();
            followButton.BackgroundColor = UIColor.Clear;
            AddSubview(followButton);

            followProgress = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray);
            followProgress.HidesWhenStopped = false;
            followProgress.StartAnimating();
            AddSubview(followProgress);

            #region originality

            originalityContainer = new UIView();
            originalityContainer.BackgroundColor    = Helpers.Constants.R250G250B250;
            originalityContainer.Layer.CornerRadius = 10;

            originalityLabel = new UILabel();
            originalityLabel.UserInteractionEnabled = false;
            //originalityLabel.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Originality);
            originalityLabel.TextColor     = UIColor.Black;
            originalityLabel.Font          = Helpers.Constants.Regular14;
            originalityLabel.Lines         = 1;
            originalityLabel.LineBreakMode = UILineBreakMode.TailTruncation;

            originality = new UILabel();
            originality.UserInteractionEnabled = false;
            originality.Text      = "100%";
            originality.TextColor = Helpers.Constants.R255G34B5;
            originality.Font      = Helpers.Constants.Semibold14;
            originality.Lines     = 1;

            originalityContainer.AddSubview(originalityLabel);
            originalityContainer.AddSubview(originality);

            //contentView.AddSubview(originalityContainer);

            #endregion

            #region stats

            statsView              = new UIStackView();
            statsView.Axis         = UILayoutConstraintAxis.Horizontal;
            statsView.Alignment    = UIStackViewAlignment.Fill;
            statsView.Distribution = UIStackViewDistribution.Fill;
            statsView.TranslatesAutoresizingMaskIntoConstraints = false;

            photos    = new UIButton();
            following = new UIButton();
            followers = new UIButton();

            var emptySpace = new UIView();

            var firstSpacing  = new UIView();
            var secondSpacing = new UIView();

            statsView.AddArrangedSubview(photos);
            statsView.AddArrangedSubview(firstSpacing);
            statsView.AddArrangedSubview(following);
            statsView.AddArrangedSubview(secondSpacing);
            statsView.AddArrangedSubview(followers);
            statsView.AddArrangedSubview(emptySpace);

            statsContainer = new UIView();
            statsContainer.AddSubview(statsView);

            AddSubview(statsContainer);

            #endregion

            #region balance

            balanceContainer = new UIView();
            balanceContainer.UserInteractionEnabled = true;

            var topSeparator    = new UIView();
            var bottomSeparator = new UIView();
            topSeparator.BackgroundColor = bottomSeparator.BackgroundColor = Helpers.Constants.R245G245B245;

            var balanceImage = new UIImageView();
            balanceImage.Image = UIImage.FromBundle("ic_balance");

            var balanceLabel = new UILabel();
            balanceLabel.UserInteractionEnabled = false;
            balanceLabel.Text      = AppSettings.LocalizationManager.GetText(LocalizationKeys.AccountBalance);
            balanceLabel.TextColor = UIColor.Black;
            balanceLabel.Font      = Helpers.Constants.Regular14;
            balanceLabel.Lines     = 1;

            balance = new UILabel();
            balance.UserInteractionEnabled = false;
            balance.TextColor     = Helpers.Constants.R255G34B5;
            balance.TextAlignment = UITextAlignment.Right;
            balance.Font          = Helpers.Constants.Semibold14;
            balance.Lines         = 1;

            var balanceArrow = new UIImageView();
            balanceArrow.Image = UIImage.FromBundle("ic_forward");

            balanceContainer.AddSubview(topSeparator);
            balanceContainer.AddSubview(bottomSeparator);
            balanceContainer.AddSubview(balanceImage);
            balanceContainer.AddSubview(balanceLabel);
            balanceContainer.AddSubview(balanceArrow);
            balanceContainer.AddSubview(balance);

            UITapGestureRecognizer balanceTap = new UITapGestureRecognizer(() =>
            {
                ProfileAction?.Invoke(ActionType.Balance);
            });
            balanceContainer.AddGestureRecognizer(balanceTap);
//#if DEBUG
            AddSubview(balanceContainer);
//#endif
            #endregion

            AddSubview(bottomSeparator);

            #region constraints

            /*
             * originalityLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Left, extraMargin);
             * originalityLabel.AutoAlignAxis(ALAxis.Horizontal, originalityContainer);
             * originality.AutoPinEdgeToSuperviewEdge(ALEdge.Right, extraMargin);
             * originality.AutoAlignAxis(ALAxis.Horizontal, originalityContainer);
             */

            statsView.AutoPinEdgesToSuperviewEdges();

            topSeparator.AutoSetDimension(ALDimension.Height, 1);
            topSeparator.AutoPinEdgeToSuperviewEdge(ALEdge.Top);
            topSeparator.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            topSeparator.AutoPinEdgeToSuperviewEdge(ALEdge.Right);

            bottomSeparator.AutoSetDimension(ALDimension.Height, 1);
            bottomSeparator.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            bottomSeparator.AutoPinEdgeToSuperviewEdge(ALEdge.Right);
            bottomSeparator.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom);

            followProgress.AutoAlignAxis(ALAxis.Horizontal, followButton);
            followProgress.AutoAlignAxis(ALAxis.Vertical, followButton);
//#if DEBUG
            balanceImage.AutoSetDimensionsToSize(new CGSize(10, 10));
            balanceImage.AutoPinEdgeToSuperviewEdge(ALEdge.Left, mainMargin);
            balanceImage.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            balanceLabel.AutoPinEdge(ALEdge.Left, ALEdge.Right, balanceImage, 20);
            balanceLabel.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            balanceArrow.AutoSetDimensionsToSize(new CGSize(6, 10));
            balanceArrow.AutoPinEdgeToSuperviewEdge(ALEdge.Right, mainMargin);
            balanceArrow.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            balance.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 55);
            balance.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
//#endif
            firstSpacing.AutoSetDimension(ALDimension.Width, 48);
            secondSpacing.AutoSetDimension(ALDimension.Width, 48);

            #endregion

            return(this);
        }
示例#7
0
        public MainTabBarController()
        {
            TabBar.Translucent = false;
            TabBar.TintColor   = Constants.R231G72B0;

            var feedTab = new InteractivePopNavigationController(new FeedViewController());

            feedTab.TabBarItem = new UITabBarItem(null, UIImage.FromBundle("ic_home"), 0);

            var browseTab = new InteractivePopNavigationController(new PreSearchViewController());

            browseTab.TabBarItem = new UITabBarItem(null, UIImage.FromBundle("ic_browse"), 1);

            var photoTab = new UIViewController()
            {
            };

            photoTab.TabBarItem = new UITabBarItem(null, null, 2);

            var profileTab = new InteractivePopNavigationController(new ProfileViewController());

            profileTab.TabBarItem = new UITabBarItem(null, null, 3);

            ViewControllers = new UIViewController[] {
                feedTab,
                browseTab,
                photoTab,
                profileTab
            };

            var insets = new UIEdgeInsets(5, 0, -5, 0);

            foreach (UIViewController item in ViewControllers)
            {
                if (item is UINavigationController navController)
                {
                    navController.NavigationBar.Translucent = false;
                }
                item.TabBarItem.ImageInsets = insets;
            }

            var createPhotoImage = new UIImageView(new CGRect(0, -2, TabBar.Frame.Width / 4, TabBar.Frame.Height));

            createPhotoImage.Image       = UIImage.FromBundle("ic_create");
            createPhotoImage.ContentMode = UIViewContentMode.Center;
            TabBar.Subviews[2].AddSubview(createPhotoImage);

            _avatar     = new UIImageView();
            _powerFrame = new CircleFrame(_avatar, new CGRect(TabBar.Frame.Width / 4 / 2 - 16, TabBar.Frame.Height / 2 - 17, 28, 28));

            _powerFrame.UserInteractionEnabled = false;
            _avatar.UserInteractionEnabled     = false;
            _avatar.Frame = new CGRect(3, 3, 22, 22);
            _avatar.Layer.CornerRadius = _avatar.Frame.Width / 2;
            _avatar.ClipsToBounds      = true;
            _avatar.Image       = UIImage.FromBundle("ic_noavatar");
            _avatar.ContentMode = UIViewContentMode.ScaleAspectFill;

            _presenter = new UserProfilePresenter()
            {
                UserName = AppSettings.User.Login
            };

            TabBar.Subviews[3].AddSubview(_powerFrame);
            InitializePowerFrame();
            if (AppSettings.AppInfo.GetModel() != "Simulator")
            {
                InitPushes();
            }
        }
示例#8
0
 public CircleFrameDrawable(CircleFrame element)
 {
     this.element = element;
 }