Esempio n. 1
0
        protected override void OnElementChanged(ElementChangedEventArgs <Label> e)
        {
            base.OnElementChanged(e);

            MultiLineLabel multiLineLabel = (MultiLineLabel)Element;

            Control.Invalidate();

            Rect  bounds = new Rect();
            Paint paint  = new Paint();

            paint.TextSize = (float)40;

            paint.GetTextBounds(Element.Text, 0, Element.Text.Length, bounds);

            int width = (int)Math.Ceiling((float)bounds.Width() / 40);

            int lines = (int)(width / 40);

            if (multiLineLabel != null && multiLineLabel.Lines != -1)
            {
                Control.SetSingleLine(false);
                Control.SetLines(multiLineLabel.Lines);
            }
        }
Esempio n. 2
0
        protected override void OnElementChanged(ElementChangedEventArgs <Label> e)
        {
            base.OnElementChanged(e);
            MultiLineLabel multiLineLabel = (MultiLineLabel)Element;

            if (multiLineLabel != null && multiLineLabel.Lines != -1)
            {
                Control.Lines = multiLineLabel.Lines;
            }
        }
        protected override void OnElementChanged(ElementChangedEventArgs <Label> e)
        {
            base.OnElementChanged(e);
            MultiLineLabel multiLineLabel = (MultiLineLabel)Element;

            if (multiLineLabel != null && multiLineLabel.Lines != -1)
            {
                Control.SetSingleLine(false);
                Control.SetLines(multiLineLabel.Lines);
            }
        }
Esempio n. 4
0
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Label> e)
        {
            base.OnElementChanged(e);

            MultiLineLabel multiLineLabel = (MultiLineLabel)Element;

            if (multiLineLabel != null && multiLineLabel.Lines != -1)
            {
                Control.SetSingleLine(false);
                Control.SetLines(multiLineLabel.Lines);
            }

            if (multiLineLabel?.Lines == -1)
            {
                Control.InputType = Android.Text.InputTypes.TextFlagMultiLine;
                Control.SetSingleLine(false);
            }
        }
Esempio n. 5
0
        public NieuwsLijstAlgemeen()
        {
            Title          = "Nieuws";
            BindingContext = viewModel = new ViewModels.NieuwsLijstAlgemeenVM();

            BackgroundColor = Color.FromHex("#1f1f1f");

            string title = "";

            if (Device.RuntimePlatform == Device.iOS)
            {
                title = "Enter The Grid";
            }
            else
            {
                title = "race.ttf#race";
            }

            ActivityIndicator loadingImage = new ActivityIndicator();

            loadingImage.SetBinding(ActivityIndicator.IsRunningProperty, "LoadingVisibility");
            loadingImage.SetBinding(ActivityIndicator.IsVisibleProperty, "LoadingVisibility");
            loadingImage.Color             = Color.FromHex("#f50000");
            loadingImage.HeightRequest     = 50;
            loadingImage.HorizontalOptions = LayoutOptions.Center;
            loadingImage.VerticalOptions   = LayoutOptions.Center;
            loadingImage.WidthRequest      = 50;

            lstView = new ListView();
            lstView.SetBinding(ListView.ItemsSourceProperty, "NieuwsLijst");
            lstView.SeparatorColor         = Color.Transparent;
            lstView.HasUnevenRows          = true;
            lstView.IsPullToRefreshEnabled = true;
            lstView.SetBinding(ListView.RefreshCommandProperty, "GetNieuwsLijst");
            lstView.SetBinding(ListView.IsRefreshingProperty, "IsRefreshing");
            lstView.BackgroundColor = Color.FromHex("#1f1f1f");
            lstView.ItemTemplate    = new DataTemplate(() =>
            {
                Image afbeelding  = new Image();
                afbeelding.Aspect = Aspect.AspectFill;
                afbeelding.SetBinding(Image.SourceProperty, "source");

                Label titel          = new Label();
                titel.FontFamily     = title;
                titel.FontAttributes = FontAttributes.Bold;
                titel.SetBinding(Label.TextProperty, "titel");
                titel.TextColor = Color.Black;
                titel.FontSize  = 12;

                MultiLineLabel inleiding = new MultiLineLabel();
                inleiding.Lines          = 3;
                inleiding.SetBinding(Label.TextProperty, "inleiding");
                inleiding.TextColor     = Color.Black;
                inleiding.LineBreakMode = LineBreakMode.WordWrap;
                inleiding.FontSize      = 12;


                Label datum = new Label();
                datum.SetBinding(Label.TextProperty, "datum");
                datum.TextColor = Color.LightGray;
                datum.FontSize  = 12;

                if (Device.Idiom == TargetIdiom.Tablet)
                {
                    titel.FontSize     = 25;
                    inleiding.FontSize = 25;
                    datum.FontSize     = 25;
                }

                Frame frame             = new Frame();
                frame.CornerRadius      = 5;
                frame.IsClippedToBounds = true;
                frame.Padding           = 0;
                frame.WidthRequest      = 1500;
                frame.HeightRequest     = 80;
                frame.Content           = afbeelding;

                StackLayout children = new StackLayout
                {
                    Spacing         = 0,
                    Margin          = 2.5,
                    VerticalOptions = LayoutOptions.Center,
                    Children        =
                    {
                        titel,
                        inleiding,
                        datum
                    }
                };

                Grid viewGrid = new Grid();
                //viewGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(140, GridUnitType.Absolute) });
                viewGrid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(140, GridUnitType.Absolute)
                });
                viewGrid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
                viewGrid.Children.Add(frame, 0, 0);
                viewGrid.Children.Add(children, 1, 0);

                Frame wholeFrame = new Frame();
                if (Device.RuntimePlatform == Device.iOS)
                {
                    wholeFrame.TranslationX = 0;
                }
                else
                {
                    wholeFrame.TranslationX = -500;
                }
                wholeFrame.Padding         = 2.5;
                wholeFrame.CornerRadius    = 5;
                wholeFrame.BackgroundColor = Color.White;
                wholeFrame.Margin          = new Thickness(5, 2.5);
                wholeFrame.Content         = viewGrid;
                wholeFrame.TranslateTo(0, 0, 750, Easing.CubicOut);
                wholeFrame.TranslateTo(0, 0, 750, Easing.CubicOut);
                // Return an assembled ViewCell.
                return(new ViewCell
                {
                    View = wholeFrame
                });
            });

            lstView.ItemTapped += async(o, e) =>
            {
                var myList = (ListView)o;
                var nieuws = (myList.SelectedItem as Entiteiten.Nieuws);
                await Navigation.PushAsync(new NieuwsWeergave(nieuws, false, false));

                myList.SelectedItem = null; // de-select the row
            };

            Grid grid = new Grid();

            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            grid.Children.Add(lstView, 0, 0);
            grid.Children.Add(loadingImage, 0, 0);

            Content = grid;
        }
Esempio n. 6
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            MultiLineLabel multiLineLabel = (MultiLineLabel)base.ContentContainer.FindControl("lblKeywordStatisticsInformation");
            Repeater       repeater       = (Repeater)base.ContentContainer.FindControl("keywordHitsRepeater");
            HtmlTableCell  htmlTableCell  = (HtmlTableCell)base.ContentContainer.FindControl("errorDetailsLink");
            PowerShellResults <MailboxSearch> powerShellResults = base.Results as PowerShellResults <MailboxSearch>;

            if (powerShellResults != null && powerShellResults.SucceededWithValue)
            {
                MailboxSearch mailboxSearch = powerShellResults.Output[0];
                repeater.DataSource = mailboxSearch.KeywordHits;
                repeater.DataBind();
                if (string.IsNullOrEmpty(mailboxSearch.Icon))
                {
                    WebControl webControl = (WebControl)base.ContentContainer.FindControl("imgStatus");
                    webControl.Visible = false;
                }
                Label label = (Label)base.ContentContainer.FindControl("lblInformation_label");
                label.Visible = false;
                MultiLineLabel multiLineLabel2 = (MultiLineLabel)base.ContentContainer.FindControl("lblInformation");
                multiLineLabel2.Visible = false;
                this.HideOrShowKeywordStatisticsPagingUI(false);
                string     leftPart   = this.Context.GetRequestUrl().GetLeftPart(UriPartial.Authority);
                string     arg        = Encoder.UrlEncode(Encoder.HtmlEncode(mailboxSearch.Identity.RawIdentity));
                HtmlAnchor htmlAnchor = new HtmlAnchor();
                htmlAnchor.InnerHtml = Strings.ViewAllDetails;
                string arg2 = string.Format("{0}/ecp/Reporting/ViewMailboxSearchErrors.aspx?Id={1}", leftPart, arg);
                htmlAnchor.HRef = "#";
                htmlAnchor.Attributes.Add("onclick", string.Format("window.open(\"{0}\",\"popup\",\"width=800,height=600,sscrollbars=yes,resizable=no,toolbar=no,directories=no,location=center,menubar=no,status=yes\"); return false", arg2));
                if (htmlTableCell != null && mailboxSearch.TotalKnownErrors + mailboxSearch.TotalUndefinedErrors > 0)
                {
                    htmlTableCell.Controls.Add(htmlAnchor);
                }
                htmlAnchor.Dispose();
                if (mailboxSearch.MailboxSearch.EstimateOnly)
                {
                    if (mailboxSearch.MailboxSearch.Status == SearchState.EstimateInProgress || mailboxSearch.MailboxSearch.Status == SearchState.Queued)
                    {
                        repeater.Visible = false;
                        if (mailboxSearch.MailboxSearch.IncludeKeywordStatistics && !mailboxSearch.MailboxSearch.KeywordStatisticsDisabled)
                        {
                            multiLineLabel.Text = Strings.RetrievingStatistics;
                        }
                        else
                        {
                            Label label2 = (Label)base.ContentContainer.FindControl("lblKeywordStatistics");
                            label2.Text = string.Empty;
                        }
                    }
                    else
                    {
                        LinkButton linkButton = (LinkButton)base.ContentContainer.FindControl("lnkStartFullStatsSearch");
                        linkButton.Visible = false;
                        if (mailboxSearch.MailboxSearch.KeywordStatisticsDisabled)
                        {
                            Label label3 = (Label)base.ContentContainer.FindControl("lblKeywordStatistics");
                            label3.Text             = string.Empty;
                            repeater.Visible        = false;
                            label.Visible           = true;
                            multiLineLabel2.Visible = true;
                        }
                        else if (mailboxSearch.IsFullStatsSearchAllowed)
                        {
                            multiLineLabel.Visible = false;
                            Label label4 = (Label)base.ContentContainer.FindControl("lblRetrievingStatistics");
                            label4.Visible           = true;
                            linkButton.OnClientClick = string.Format("MailboxSearchUtil.StartFullStatsMailboxSearchHandler('{0}', '{1}', '{2}', '{3}')", new object[]
                            {
                                linkButton.ClientID,
                                label4.ClientID,
                                mailboxSearch.Identity.RawIdentity,
                                HttpUtility.JavaScriptStringEncode(mailboxSearch.Identity.DisplayName)
                            });
                            repeater.Visible   = false;
                            linkButton.Visible = true;
                        }
                        else if (mailboxSearch.SearchQuery == null || mailboxSearch.SearchQuery == string.Empty)
                        {
                            multiLineLabel.Text = Strings.KeywordStatisticsEmptyQuery;
                            repeater.Visible    = false;
                        }
                        else
                        {
                            if (mailboxSearch.ExcludeDuplicateMessages)
                            {
                                multiLineLabel.Text = Strings.DuplicatesNotExcluded;
                            }
                            Label label5 = (Label)base.ContentContainer.FindControl("lblKeywordStatisticsPagingInfo");
                            if (label5 != null)
                            {
                                int num = mailboxSearch.StatisticsStartIndex + Math.Min(24, mailboxSearch.TotalKeywords - mailboxSearch.StatisticsStartIndex);
                                label5.Text = string.Format(Strings.KeywordStatisticsPagingInfo, mailboxSearch.StatisticsStartIndex, num, mailboxSearch.TotalKeywords);
                                LinkButton linkButton2 = (LinkButton)base.ContentContainer.FindControl("lnkKeywordStatisticsNavigationPrevious");
                                LinkButton linkButton3 = (LinkButton)base.ContentContainer.FindControl("lnkKeywordStatisticsNavigationNext");
                                Label      label6      = (Label)base.ContentContainer.FindControl("lblRetrievingStatisticsForPaging");
                                label6.Visible      = true;
                                linkButton2.Enabled = (mailboxSearch.StatisticsStartIndex > 25);
                                if (linkButton2.Enabled)
                                {
                                    linkButton2.OnClientClick = string.Format("MailboxSearchUtil.KeywordStatisticsPaginationSearch('{0}', '{1}', '{2}', '{3}', '{4}', {5})", new object[]
                                    {
                                        linkButton2.ClientID,
                                        linkButton3.ClientID,
                                        label6.ClientID,
                                        mailboxSearch.Identity.RawIdentity,
                                        HttpUtility.JavaScriptStringEncode(mailboxSearch.Identity.DisplayName),
                                        mailboxSearch.StatisticsStartIndex - 25
                                    });
                                }
                                linkButton3.Enabled = (num < mailboxSearch.TotalKeywords);
                                if (linkButton3.Enabled)
                                {
                                    linkButton3.OnClientClick = string.Format("MailboxSearchUtil.KeywordStatisticsPaginationSearch('{0}', '{1}', '{2}', '{3}', '{4}', {5})", new object[]
                                    {
                                        linkButton2.ClientID,
                                        linkButton3.ClientID,
                                        label6.ClientID,
                                        mailboxSearch.Identity.RawIdentity,
                                        HttpUtility.JavaScriptStringEncode(mailboxSearch.Identity.DisplayName),
                                        1 + num
                                    });
                                }
                                this.HideOrShowKeywordStatisticsPagingUI(true);
                            }
                        }
                    }
                }
                else
                {
                    Label label7 = (Label)base.ContentContainer.FindControl("lblKeywordStatistics");
                    label7.Text      = string.Empty;
                    repeater.Visible = false;
                }
                if (mailboxSearch.MailboxSearch.PreviewDisabled)
                {
                    label.Visible           = true;
                    multiLineLabel2.Visible = true;
                }
                this.rowResultMailbox = (HtmlControl)base.ContentContainer.FindControl("rowResultMailbox");
                if (this.rowResultMailbox != null)
                {
                    this.rowResultMailbox.Visible = !string.IsNullOrEmpty(mailboxSearch.ResultsLink);
                }
                if (string.IsNullOrEmpty(mailboxSearch.InPlaceHoldErrors))
                {
                    base.ContentContainer.FindControl("InPlaceHoldErrorLabelContainer").Visible = false;
                }
                if (!RbacPrincipal.Current.IsInRole("LegalHold"))
                {
                    base.ContentContainer.FindControl("InPlaceHoldSection").Visible = false;
                }
                if (!RbacPrincipal.Current.IsInRole("MailboxSearch"))
                {
                    base.ContentContainer.FindControl("DiscoverySection").Visible = false;
                }
                if (string.IsNullOrEmpty(multiLineLabel.Text))
                {
                    multiLineLabel.Visible = false;
                }
            }
        }