private void CreateReport() { _reusedPasswords = Vault.Credentials.Where(cred => cred.IsReused()); _knownPasswords = Vault.Credentials.Where(cred => cred.IsKnown()); _weakPasswords = Vault.Credentials.Where(cred => cred.IsWeak()); _oldPasswords = Vault.Credentials.Where(cred => cred.IsOlderThan(new TimeSpan(AppConfig.Instance.DaysForOld, 0, 0, 0))); ExpandableView reusedView = View.FindByName <ExpandableView>("ReusedView"); if (reusedView != null) { reusedView.IsExpanded = false; } ExpandableView knownView = View.FindByName <ExpandableView>("KnownView"); if (knownView != null) { knownView.IsExpanded = false; } ExpandableView weakView = View.FindByName <ExpandableView>("WeakView"); if (weakView != null) { weakView.IsExpanded = false; } ExpandableView oldView = View.FindByName <ExpandableView>("OldView"); if (oldView != null) { oldView.IsExpanded = false; } NotifyPropertyChanged("HasReusedPasswords"); NotifyPropertyChanged("HasKnownPasswords"); NotifyPropertyChanged("HasWeakPasswords"); NotifyPropertyChanged("ReusedPasswordsHeight"); NotifyPropertyChanged("KnownPasswordsHeight"); NotifyPropertyChanged("WeakPasswordsHeight"); NotifyPropertyChanged("ReportResultGlyphColour"); NotifyPropertyChanged("ReportResultGlyphText"); NotifyPropertyChanged("ReusedPasswords"); NotifyPropertyChanged("KnownPasswords"); NotifyPropertyChanged("WeakPasswords"); NotifyPropertyChanged("OldPasswords"); if (HasReusedPasswords || HasKnownPasswords || HasWeakPasswords || HasOldPasswords) { ReportSummaryText = "Your vault contains credentials that cachy considers to be at risk. Please review the points of concern below."; } else { ReportSummaryText = "Your vault appears to be in good standing, with no immediate conerns."; } View.ForceLayout(); }
public NestedExpandablePage() { var nestedExp = new ExpandableView { SecondaryViewHeightRequest = 200, PrimaryView = new Label { Text = "NESTED EXP 2", FontSize = 30 }, SecondaryViewTemplate = new DataTemplate(() => { return(new BoxView { Color = Color.Purple }); }) }; var mainExp = new ExpandableView { BackgroundColor = Color.Green, VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, PrimaryView = new Label { Text = "EXPANDABLE 1", FontSize = 40, FontAttributes = FontAttributes.Bold }, SecondaryViewTemplate = new DataTemplate(() => { return(new StackLayout { Children = { new BoxView { Color = Color.Black, HeightRequest = 150 }, nestedExp } }); }) }; nestedExp.Command = new Command(() => { mainExp.SecondaryView.HeightRequest = -1; }); Content = new StackLayout { Children = { mainExp } }; }
// I will assume that there aren't enough items to necessitate a scrollview public MasterPage() { InitializeComponent(); // First setup the background color of the view BackgroundColor = Constants.BackgroundColor; // Second compile the list of pages FinancialItems = new List <PageType>(); TimeItems = new List <PageType>(); FinancialItems.Add(new PageType("Master", typeof(MoneyPage))); // will need to create pages other than just money pages in the future FinancialItems.Add(new PageType("Reoccuring Scheduler", typeof(ReoccurringScheduler))); TimeItems.Add(new PageType("Master", typeof(TimePage))); // Timepage is broken right now but that is ok // Third define the Root items RootFinancial = new RootMenuItem("Financial", "MoneyIcon.png", Constants.MoneyColor, FinancialItems); RootTime = new RootMenuItem("Time", "TimeIcon.png", Constants.TimeColor, TimeItems); // Fourth, generate the tapped events // first define the clicked event for each of the secondstack children pageClicked = new TapGestureRecognizer(); pageClicked.Tapped += (s, e) => { MenuPageStack MenuItem = (MenuPageStack)s; MessagingCenter.Send(this, "NewDetail", MenuItem.TargetType); // Now collapse the expanding views if (MoneyExpand.Status == ExpandStatus.Expanded) { MoneyExpand.IsExpanded = false; } if (TimeExpand.Status == ExpandStatus.Expanded) { TimeExpand.IsExpanded = false; } }; // Fifth add the expandable views to the stack layout MoneyExpand = CreateExpandable(RootFinancial); TimeExpand = CreateExpandable(RootTime); MiddleStack.Children.Add(MoneyExpand); MiddleStack.Children.Add(TimeExpand); }
public ObjectView(Object @object) { Object = @object; if (Object.Children != null) { children = new List <ObjectView>(); StackLayout childrenView; ExpandableView v = new ExpandableView() { PrimaryView = CreatePrimaryView(), SecondaryView = childrenView = new StackLayout { Orientation = StackOrientation.Vertical, }, }; v.TouchHandlerView = v.PrimaryView; foreach (var child in Object.Children) { ObjectView objectView = new ObjectView(child); children.Add(objectView); childrenView.Children.Add(objectView); } Content = v; } else { children = null; Content = CreatePrimaryView(); } }
private View CreateExpandable(int number) { var middleImage = new Image { HeightRequest = 40, Aspect = Aspect.Fill, Source = "grad.jpg" }; var arrowImage = new Image { HorizontalOptions = LayoutOptions.EndAndExpand, Source = "arrow_drop_down.png", HeightRequest = 45, WidthRequest = 45 }; var exp = new ExpandableView { IsTouchToExpandEnabled = false, SecondaryViewTemplate = new DataTemplate(() => new StackLayout { Spacing = 10, Padding = new Thickness(20, 0), Children = { new Button { CornerRadius = 0, FontAttributes = FontAttributes.Italic, HeightRequest = 40, BackgroundColor = Color.White, TextColor = Color.Black, Text = $"Increase height", Command = new Command(() => ChangeHeight(middleImage, 20)) }, middleImage, new Button { CornerRadius = 0, FontAttributes = FontAttributes.Italic, HeightRequest = 40, BackgroundColor = Color.White, TextColor = Color.Black, Text = $"Decrease height", Command = new Command(() => ChangeHeight(middleImage, -20)) } } }) }; exp.StatusChanged += (sender, e) => { var rotation = 0; switch (e.Status) { case ExpandStatus.Collapsing: break; case ExpandStatus.Expanding: rotation = 180; break; default: return; } arrowImage.RotateTo(rotation, 200, Easing.CubicInOut); }; exp.PrimaryView = new TouchView { RegularAnimationEasing = Easing.CubicInOut, PressedAnimationEasing = Easing.CubicInOut, RegularAnimationDuration = 600, PressedAnimationDuration = 600, RegularBackgroundColor = Color.White, RippleCount = -1, PressedBackgroundColor = Color.LightGray, PressedScale = 1.2, Command = new Command(() => exp.IsExpanded = !exp.IsExpanded) }; (exp.PrimaryView as TouchView).Children.Add(new Frame { CornerRadius = 5, Padding = new Thickness(10, 0), Content = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { new Label { FontSize = 22, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center, FontAttributes = FontAttributes.Bold, HeightRequest = 60, TextColor = Color.Black, Text = $"Click to expand {number}" }, arrowImage } } }); return(exp); }