/// <summary> /// Gets the image item with description. /// </summary> /// <param name="view">The view.</param> /// <param name="items">The items.</param> /// <returns></returns> internal ImageItemWithDescription GetImageItemWithDescription( View view, IEnumerable<ImageItemWithDescription> items) { ImageItemWithDescription imageItemWithDescription = items.FirstOrDefault(x => x.Selected); //// bug im my code or WPF - doesnt seem to uncheck radio buttons in a group !! IEnumerable<ImageItemWithDescription> multiupleItems = items.Where(x => x.Selected); ImageItemWithDescription[] imageItemWithDescriptions = multiupleItems as ImageItemWithDescription[] ?? multiupleItems.ToArray(); if (imageItemWithDescriptions.Count() == 2) { ImageItemWithDescription firstItem = imageItemWithDescriptions.ToList()[0]; if (this.showLayouts) { if (view.LayoutType != firstItem.Name) { imageItemWithDescription = firstItem; } ImageItemWithDescription secondItem = imageItemWithDescriptions.ToList()[1]; if (view.LayoutType != secondItem.Name) { imageItemWithDescription = secondItem; } } else if (this.showFrameworks) { if (view.Framework != firstItem.Name) { imageItemWithDescription = firstItem; } ImageItemWithDescription secondItem = imageItemWithDescriptions.ToList()[1]; if (view.Framework != secondItem.Name) { imageItemWithDescription = secondItem; } } else { if (view.PageType != firstItem.Name) { imageItemWithDescription = firstItem; } ImageItemWithDescription secondItem = imageItemWithDescriptions.ToList()[1]; if (view.PageType != secondItem.Name) { imageItemWithDescription = secondItem; } } } return imageItemWithDescription; }
/// <summary> /// Chooses the type of the page. /// </summary> public void ChoosePageType(object parameter) { this.currentView = this.views.FirstOrDefault(x => x.Name == parameter.ToString()); if (this.currentView != null) { ImageItemWithDescription imageItemWithDescription = this.Pages.FirstOrDefault(x => x.Name == this.currentView.PageType); if (imageItemWithDescription != null) { imageItemWithDescription.Selected = true; } else { imageItemWithDescription = this.MvxViews.FirstOrDefault(x => x.Name == this.currentView.PageType); if (imageItemWithDescription != null) { imageItemWithDescription.Selected = true; } } if (this.currentView.PageType == XamarinFormsPage.TabbedPage.GetDescription() || this.currentView.PageType == XamarinFormsPage.CarouselPage.GetDescription()) { this.currentView.LayoutType = "Content Page"; } this.DisplayPages(this.currentView.Framework); } }
/// <summary> /// Chooses the framework. /// </summary> /// <param name="parameter">The parameter.</param> public void ChooseFramework(object parameter) { this.currentView = this.views.FirstOrDefault(x => x.Name == parameter.ToString()); if (this.currentView != null) { this.DisplayFrameworks(); ImageItemWithDescription imageItemWithDescription = this.Frameworks.FirstOrDefault(x => x.Name == this.currentView.Framework); if (imageItemWithDescription != null) { imageItemWithDescription.Selected = true; } } }
/// <summary> /// Chooses the type of the layout. /// </summary> public void ChooseLayoutType(object parameter) { this.currentView = this.views.FirstOrDefault(x => x.Name == parameter.ToString()); if (this.currentView != null) { if (this.currentView.PageType == XamarinFormsPage.TabbedPage.GetDescription() || this.currentView.PageType == XamarinFormsPage.CarouselPage.GetDescription()) { this.messageBoxService.Show( "Tabbed Pages and Carousel Pages can only have Content Layouts.", Settings.ApplicationName, true, Theme.Light, this.settingsService.ThemeColor); return; } } this.DisplayLayouts(); ImageItemWithDescription imageItemWithDescription = this.Layouts.FirstOrDefault(x => x.Name == this.currentView.LayoutType); if (imageItemWithDescription != null) { imageItemWithDescription.Selected = true; } }
/// <summary> /// Adds this instance. /// </summary> public void Add() { View view = new View { Name = this.GetName(), AllowDeletion = true }; //// dont allow the main viewmodel to be deleted. if (view.Name == "Main") { view.AllowDeletion = false; } if (this.settingsService.FrameworkType == FrameworkType.XamarinForms || this.settingsService.FrameworkType == FrameworkType.MvvmCrossAndXamarinForms) { view.Framework = FrameworkType.XamarinForms.GetDescription(); view.PageType = "Content Page"; view.LayoutType = "Content View"; } else { view.Framework = FrameworkType.MvvmCross.GetDescription(); view.LayoutType = "Not Applicable"; view.PageType = "SampleData"; } this.Views.Add(view); }