public static void Enter(BasePresenter presenter) { Instance.StartCoroutine(Instance.EnterProcessing(presenter)); }
private async void OnDevSwitcherOnCheckedChange(object sender, CompoundButton.CheckedChangeEventArgs e) { await BasePresenter.SwitchChain(e.IsChecked); }
public nfloat UpdateCell(Post post, CellSizeHelper variables, nfloat direction) { _currentPost = post; if (direction == 0) { leftMargin = 0; } else if (direction > 0) { leftMargin = 5; } else { leftMargin = -5; } likesMargin = leftMargin; _avatarImage?.RemoveFromSuperview(); _avatarImage = new UIImageView(new CGRect(leftMargin, 20, 30, 30)); _avatarImage.Layer.CornerRadius = _avatarImage.Frame.Size.Width / 2; _avatarImage.ClipsToBounds = true; _avatarImage.ContentMode = UIViewContentMode.ScaleAspectFill; _contentView.AddSubview(_avatarImage); _scheduledWorkAvatar?.Cancel(); if (!string.IsNullOrEmpty(_currentPost.Avatar)) { _scheduledWorkAvatar = ImageLoader.Load(_currentPost.Avatar, _avatarImage, placeHolder: "ic_noavatar.png"); } else { _avatarImage.Image = UIImage.FromBundle("ic_noavatar"); } _author.Text = _currentPost.Author; _timestamp.Text = _currentPost.Created.ToPostTime(); _contentScroll.SetContentOffset(new CGPoint(0, 0), false); _photoScroll.Frame = new CGRect(0, 0, _contentScroll.Frame.Width, variables.PhotoHeight); _photoScroll.ContentSize = new CGSize(_contentScroll.Frame.Width * _currentPost.Media.Length, variables.PhotoHeight); _photoScroll.SetContentOffset(new CGPoint(0, 0), false); foreach (var subview in _photoScroll.Subviews) { subview.RemoveFromSuperview(); } for (int i = 0; i < _scheduledWorkBody.Length; i++) { _scheduledWorkBody[i]?.Cancel(); } _scheduledWorkBody = new IScheduledWork[_currentPost.Media.Length]; _bodyImage = new UIImageView[_currentPost.Media.Length]; for (int i = 0; i < _currentPost.Media.Length; i++) { _bodyImage[i] = new UIImageView(); _bodyImage[i].ClipsToBounds = true; _bodyImage[i].UserInteractionEnabled = true; _bodyImage[i].ContentMode = UIViewContentMode.ScaleAspectFill; _bodyImage[i].Frame = new CGRect(_contentScroll.Frame.Width * i, 0, _contentScroll.Frame.Width, variables.PhotoHeight); _photoScroll.AddSubview(_bodyImage[i]); _scheduledWorkBody[i] = ImageLoader.Load(_currentPost.Media[i].Url, _bodyImage[i], 2, LoadingPriority.Highest); } if (_currentPost.Media.Length > 1) { _pageControl.Hidden = false; _pageControl.Pages = _currentPost.Media.Length; _pageControl.SizeToFit(); _pageControl.Frame = new CGRect(new CGPoint(0, _photoScroll.Frame.Bottom - 30), _pageControl.Frame.Size); } else { _pageControl.Hidden = true; } if (_currentPost.TopLikersAvatars.Any() && !string.IsNullOrEmpty(_currentPost.TopLikersAvatars[0])) { _firstLikerImage?.RemoveFromSuperview(); _firstLikerImage = new UIImageView(); _contentScroll.AddSubview(_firstLikerImage); _firstLikerImage.BackgroundColor = UIColor.White; _firstLikerImage.Layer.CornerRadius = likersCornerRadius; _firstLikerImage.ClipsToBounds = true; _firstLikerImage.ContentMode = UIViewContentMode.ScaleAspectFill; _firstLikerImage.Frame = new CGRect(leftMargin, _photoScroll.Frame.Bottom + likersY, likersImageSide, likersImageSide); _scheduledWorkfirst?.Cancel(); _scheduledWorkfirst = ImageLoader.Load(_currentPost.TopLikersAvatars[0], _firstLikerImage, placeHolder: "ic_noavatar.png", priority: LoadingPriority.Lowest); likesMargin = _firstLikerImage.Frame.Right + likesMarginConst; } else if (_firstLikerImage != null) { _firstLikerImage.Hidden = true; } if (_currentPost.TopLikersAvatars.Count() >= 2 && !string.IsNullOrEmpty(_currentPost.TopLikersAvatars[1])) { _secondLikerImage?.RemoveFromSuperview(); _secondLikerImage = new UIImageView(); _contentScroll.AddSubview(_secondLikerImage); _secondLikerImage.BackgroundColor = UIColor.White; _secondLikerImage.Layer.CornerRadius = likersCornerRadius; _secondLikerImage.ClipsToBounds = true; _secondLikerImage.ContentMode = UIViewContentMode.ScaleAspectFill; _secondLikerImage.Frame = new CGRect(_firstLikerImage.Frame.Right - likersMargin, _photoScroll.Frame.Bottom + likersY, likersImageSide, likersImageSide); _scheduledWorksecond?.Cancel(); _scheduledWorksecond = ImageLoader.Load(_currentPost.TopLikersAvatars[1], _secondLikerImage, placeHolder: "ic_noavatar.png", priority: LoadingPriority.Lowest); likesMargin = _secondLikerImage.Frame.Right + likesMarginConst; } else if (_secondLikerImage != null) { _secondLikerImage.Hidden = true; } if (_currentPost.TopLikersAvatars.Count() >= 3 && !string.IsNullOrEmpty(_currentPost.TopLikersAvatars[2])) { _thirdLikerImage?.RemoveFromSuperview(); _thirdLikerImage = new UIImageView(); _contentScroll.AddSubview(_thirdLikerImage); _thirdLikerImage.BackgroundColor = UIColor.White; _thirdLikerImage.Layer.CornerRadius = likersCornerRadius; _thirdLikerImage.ClipsToBounds = true; _thirdLikerImage.ContentMode = UIViewContentMode.ScaleAspectFill; _thirdLikerImage.Frame = new CGRect(_secondLikerImage.Frame.Right - likersMargin, _photoScroll.Frame.Bottom + likersY, likersImageSide, likersImageSide); _scheduledWorkthird?.Cancel(); _scheduledWorkthird = ImageLoader.Load(_currentPost.TopLikersAvatars[2], _thirdLikerImage, placeHolder: "ic_noavatar.png", priority: LoadingPriority.Lowest); likesMargin = _thirdLikerImage.Frame.Right + likesMarginConst; } else if (_thirdLikerImage != null) { _thirdLikerImage.Hidden = true; } nfloat flagMargin = 0; if (_currentPost.NetLikes != 0) { _likes.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Likes, _currentPost.NetLikes); var likesWidth = _likes.SizeThatFits(new CGSize(0, underPhotoPanelHeight)); _likes.Frame = new CGRect(likesMargin, _photoScroll.Frame.Bottom, likesWidth.Width, underPhotoPanelHeight); flagMargin = flagsMarginConst; } else { _likes.Frame = new CGRect(likesMargin, _photoScroll.Frame.Bottom, 0, 0); } _likersTapView.Frame = new CGRect(leftMargin, _photoScroll.Frame.Bottom, _likes.Frame.Right - leftMargin, _likes.Frame.Height); if (_currentPost.NetFlags != 0) { _flags.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Flags, _currentPost.NetFlags); var flagsWidth = _flags.SizeThatFits(new CGSize(0, underPhotoPanelHeight)); _flags.Frame = new CGRect(likesMargin + _likes.Frame.Width + flagMargin, _photoScroll.Frame.Bottom, flagsWidth.Width, underPhotoPanelHeight); } else { _flags.Frame = new CGRect(likesMargin, _photoScroll.Frame.Bottom, 0, 0); } _like.Frame = new CGRect(_contentView.Frame.Width - likeButtonWidthConst, _photoScroll.Frame.Bottom, likeButtonWidthConst, underPhotoPanelHeight); _sliderView.Frame = new CGRect(0, _photoScroll.Frame.Bottom - 5, _photoScroll.Frame.Width, 70); _like.Transform = CGAffineTransform.MakeScale(1f, 1f); if (_currentPost.VoteChanging) { Animate(); } else { _like.Layer.RemoveAllAnimations(); _like.LayoutIfNeeded(); if (BasePostPresenter.IsEnableVote) { _like.Image = _currentPost.Vote ? UIImage.FromBundle("ic_like_active") : UIImage.FromBundle("ic_like"); } else { _like.Image = _currentPost.Vote ? UIImage.FromBundle("ic_like_active_disabled") : UIImage.FromBundle("ic_like_disabled"); } _like.UserInteractionEnabled = true; } _verticalSeparator.Frame = new CGRect(_contentView.Frame.Width - likeButtonWidthConst - 1, _photoScroll.Frame.Bottom + underPhotoPanelHeight / 2 - verticalSeparatorHeight / 2, 1, verticalSeparatorHeight); #if DEBUG _rewards.Text = BasePresenter.ToFormatedCurrencyString(_currentPost.TotalPayoutReward); var rewardWidth = _rewards.SizeThatFits(new CGSize(0, underPhotoPanelHeight)); _rewards.Frame = new CGRect(_verticalSeparator.Frame.Left - rewardWidth.Width, _photoScroll.Frame.Bottom, rewardWidth.Width, underPhotoPanelHeight); #endif _topSeparator.Frame = new CGRect(0, _photoScroll.Frame.Bottom + underPhotoPanelHeight, _contentScroll.Frame.Width, 1); var at = new NSMutableAttributedString(); var _noLinkAttribute = new UIStringAttributes { Font = Constants.Regular14, ForegroundColor = Constants.R15G24B30, }; at.Append(new NSAttributedString(_currentPost.Title, _noLinkAttribute)); if (!string.IsNullOrEmpty(_currentPost.Description)) { at.Append(new NSAttributedString(Environment.NewLine)); at.Append(new NSAttributedString(Environment.NewLine)); at.Append(new NSAttributedString(post.Description, _noLinkAttribute)); } foreach (var tag in _currentPost.Tags) { if (tag == "steepshot") { continue; } NSUrl tagUrlWithoutWhitespaces = null; var tagText = tag.Replace(" ", string.Empty); if (_tagRegex.IsMatch(tagText)) { tagUrlWithoutWhitespaces = new NSUrl(tagText); } var linkAttribute = new UIStringAttributes { Link = tagUrlWithoutWhitespaces, Font = Constants.Regular14, ForegroundColor = Constants.R231G72B0, }; at.Append(new NSAttributedString($" ", _noLinkAttribute)); at.Append(new NSAttributedString($"#{tag}", linkAttribute)); } _attributedLabel?.RemoveFromSuperview(); _attributedLabel = new TTTAttributedLabel(); _attributedLabel.EnabledTextCheckingTypes = NSTextCheckingType.Link; var prop = new NSDictionary(); _attributedLabel.LinkAttributes = prop; _attributedLabel.ActiveLinkAttributes = prop; _attributedLabel.Font = Constants.Regular14; _attributedLabel.Lines = 0; _attributedLabel.UserInteractionEnabled = true; _attributedLabel.Enabled = true; //_attributedLabel.BackgroundColor = UIColor.Blue; _contentScroll.AddSubview(_attributedLabel); _attributedLabel.Delegate = new TTTAttributedLabelFeedDelegate(_tagAction); _attributedLabel.SetText(at); var textHeight = _attributedLabel.SizeThatFits(new CGSize(_contentScroll.Frame.Width, 0)).Height; _attributedLabel.Frame = new CGRect(new CGPoint(leftMargin, _topSeparator.Frame.Bottom + 15), new CGSize(_contentScroll.Frame.Width, textHeight)); _comments.Text = _currentPost.Children == 0 ? AppSettings.LocalizationManager.GetText(LocalizationKeys.PostFirstComment) : AppSettings.LocalizationManager.GetText(LocalizationKeys.ViewComments, _currentPost.Children); _comments.Frame = new CGRect(leftMargin - 5, _attributedLabel.Frame.Bottom + 5, _comments.SizeThatFits(new CGSize(10, 20)).Width + 10, 20 + 10); _bottomSeparator.Frame = new CGRect(0, _comments.Frame.Bottom + 10, _contentScroll.Frame.Width, 1); _contentScroll.ContentSize = new CGSize(_contentScroll.Frame.Width, _bottomSeparator.Frame.Bottom); return(_bottomSeparator.Frame.Bottom); //for constant size checking //var constantsSize = _bottomSeparator.Frame.Bottom - _attributedLabel.Frame.Height - _bodyImage.Frame.Height; }
private PreRenewalQuestionare GenerateTempalteObject() { //buid the marketing template var template = new PreRenewalQuestionare { DocumentTitle = BasePresenter.ReadDocumentProperty("Title"),//Constants.TemplateNames.InsuranceRenewalReport, DocumentSubTitle = string.Empty, ClientName = txtClientName.Text, ClientCommonName = txtClientCommonName.Text, PeriodOfInsuranceFrom = dtpPeriodOfInsuranceFrom.Text, PeriodOfInsuranceTo = dtpPeriodOfInsuranceTo.Text, ExecutiveName = txtExecutiveName.Text, ExecutiveEmail = txtExecutiveEmail.Text, ExecutivePhone = txtExecutivePhone.Text, ExecutiveTitle = txtExecutiveTitle.Text, ExecutiveMobile = txtExecutiveMobile.Text, ExecutiveDepartment = txtExecutiveDepartment.Text, AssistantExecutiveName = txtAssistantExecutiveName.Text, AssistantExecutiveTitle = txtAssistantExecutiveTitle.Text, AssistantExecutivePhone = txtAssistantExecutivePhone.Text, AssistantExecutiveEmail = txtAssistantExecutiveEmail.Text, AssistantExecDepartment = txtAssitantExecDepartment.Text, ClaimsExecutiveName = txtClaimsExecutiveName.Text, ClaimsExecutiveTitle = txtClaimsExecutiveTitle.Text, ClaimsExecutivePhone = txtClaimsExecutivePhone.Text, ClaimsExecutiveEmail = txtClaimsExecutiveEmail.Text, ClaimsExecDepartment = txtClaimExecDepartment.Text, OtherContactName = txtOtherContactName.Text, OtherContactTitle = txtOtherContactTitle.Text, OtherContactPhone = txtOtherContactPhone.Text, OtherContactEmail = txtOtherContactEmail.Text, OtherExecDepartment = txtOtherExecDepartment.Text, OAMPSBranchAddress = txtBranchAddress1.Text, OAMPSBranchAddressLine2 = txtBranchAddress2.Text, DatePrepared = DateTime.Now.ToString(@"dd/MM/yyyy"), SelectedDocumentFragments = _selectedQuestionnaireFragments, PopulateApprovalForm = _populateApprovalForm, PopulateClaimMadeWarning = _populateClaimMadeWarning }; var baseTemplate = (BaseTemplate)template; var logoTab = tbcWizardScreens.TabPages[Constants.ControlNames.TabPageLogosName]; PopulateLogosToTemplate(logoTab, ref baseTemplate); var covberTab = tbcWizardScreens.TabPages[Constants.ControlNames.TabPageCoverPagesName]; PopulateCoversToTemplate(covberTab, ref baseTemplate); return(template); }