Пример #1
0
        private async void OnPackageContentChanged(ContentPackage sender,
                                                   Tuple <IEnumerable <ContentPart>, IEnumerable <ContentPart> > args)
        {
            if (!(sender is { } package))
            {
                return;
            }

            var book = await package.ToPlatformAsync();

            await InitializeAsync(book);

            if (!(args is { } tuple))
            {
                if (Pages.Any())
                {
                    InteractiveInkCommands.PageCommands.CommandOpen.Execute(Pages.First());
                }

                return;
            }

            var(removed, added) = tuple;
            if ((removed?.ToList() is { } removedList&& removedList.Any()) ||
                !(added?.ToList() is { } addedList) || !addedList.Any())
            {
                return;
            }

            InteractiveInkCommands.PageCommands.CommandOpen.Execute(addedList.Last().ToPlatform());
        }
Пример #2
0
        public void Delete(EarTrumpetActionViewModel earTrumpetActionViewModel, bool promptOverride = false)
        {
            Action doRemove = () =>
            {
                var actions = EarTrumpetActionsAddon.Current.Actions.ToList();
                if (actions.Any(a => a.Id == earTrumpetActionViewModel.Id))
                {
                    actions.Remove(item => item.Id == earTrumpetActionViewModel.Id);
                }
                EarTrumpetActionsAddon.Current.Actions = actions.ToArray();

                if (Pages.Any(a => a == earTrumpetActionViewModel))
                {
                    Pages.Remove(earTrumpetActionViewModel);
                }
            };

            if (earTrumpetActionViewModel.IsPersisted && !promptOverride)
            {
                _parent.ShowDialog(Properties.Resources.DeleteActionDialogTitle, Properties.Resources.DeleteActionDialogText,
                                   Properties.Resources.DeleteActionDialogYesText, Properties.Resources.DeleteActionDialogNoText, doRemove, () => { });
            }
            else
            {
                doRemove();
            }
        }
Пример #3
0
 void ThrowIfAnotherChildPageHasName(string name)
 {
     if (Pages.Any(p => p.Name == name && p != this))
     {
         throw new ArgumentException("There is already another page with the URL text \"" + name + "\".");
     }
 }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var path = Path.GetDirectoryName(HttpContext.Current.Request.PhysicalPath);

            var files = Directory.GetFiles(path, "*.aspx", SearchOption.TopDirectoryOnly)
                        .Select(r => Path.GetFileName(r))
                        .Where(r => !r.EndsWith("warmup.aspx", StringComparison.OrdinalIgnoreCase))
                        .ToList();

            if (Pages != null && Pages.Any())
            {
                files.AddRange(Pages);
            }

            if (Exclude != null && Exclude.Any())
            {
                files = files.Except(Exclude).ToList();
            }

            foreach (var file in files.Distinct())
            {
                var page = Path.GetFileName(file);
                try
                {
                    HttpContext.Current.Server.Execute(page);
                }
                catch (Exception ex)
                {
                    LogManager.GetLogger("ASC").Error("Warmup " + page, ex);
                }
            }

            HttpContext.Current.Response.Clear();
        }
        public void NotifyChildrenPageWasPopped()
        {
            if (Master is NavigationPage masterNavPage)
            {
                masterNavPage.NotifyAllChildrenPopped();
            }
            if (Master is IFreshNavigationService masterFreshNavPage)
            {
                masterFreshNavPage.NotifyChildrenPageWasPopped();
            }

            foreach (var page in this.Pages)
            {
                if (page.Page is NavigationPage navPage)
                {
                    navPage.NotifyAllChildrenPopped();
                }
                if (page.Page is IFreshNavigationService freshNavPage)
                {
                    freshNavPage.NotifyChildrenPageWasPopped();
                }
            }
            if (Pages != null && !Pages.Any(item => item.Page == Detail) && Detail is NavigationPage)
            {
                ((NavigationPage)Detail).NotifyAllChildrenPopped();
            }
            if (Pages != null && !Pages.Any(item => item.Page == Detail) && Detail is IFreshNavigationService)
            {
                ((IFreshNavigationService)Detail).NotifyChildrenPageWasPopped();
            }
        }
Пример #6
0
        public bool CanReadFirstPage()
        {
            if (Pages.Any())
            {
                if (!String.IsNullOrWhiteSpace(Pages.First().ImageFilePath))
                {
                    try
                    {
                        if (new FileInfo(Pages.First().ImageFilePath).Exists)
                        {
                            return(true);
                        }
                    }
                    catch (Exception ex)
                    {
                        Loggers.MangaCrawler.Error(String.Format(
                                                       "Exception, chapter: {0} state: {1}", this, State), ex);

                        return(false);
                    }
                }
            }

            return(false);
        }
Пример #7
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            if (!string.IsNullOrEmpty(Context.Language))
            {
                sb.AppendFormat("Language: '{0}'", Context.Language);
                sb.AppendLine();
            }

            if (!string.IsNullOrEmpty(Context.ProjectType))
            {
                sb.AppendFormat("ProjectType: '{0}'", Context.ProjectType);
                sb.AppendLine();
            }

            if (!string.IsNullOrEmpty(Context.FrontEndFramework))
            {
                sb.AppendFormat("Front End Framework: '{0}'", Context.FrontEndFramework);
                sb.AppendLine();
            }

            if (!string.IsNullOrEmpty(Context.BackEndFramework))
            {
                sb.AppendFormat("Back End Framework: '{0}'", Context.BackEndFramework);
                sb.AppendLine();
            }

            foreach (var property in Context.PropertyBag)
            {
                sb.AppendFormat($"{property.Key.ToLowerInvariant()}", property.Value);
                sb.AppendLine();
            }

            if (Pages.Any())
            {
                sb.AppendFormat("Pages: '{0}'", string.Join(", ", Pages.Select(p => $"{p.Name} - {p.TemplateId}").ToArray()));
                sb.AppendLine();
            }

            if (Features.Any())
            {
                sb.AppendFormat("Features: '{0}'", string.Join(", ", Features.Select(p => $"{p.Name} - {p.TemplateId}").ToArray()));
                sb.AppendLine();
            }

            if (Services.Any())
            {
                sb.AppendFormat("Services: '{0}'", string.Join(", ", Services.Select(p => $"{p.Name} - {p.TemplateId}").ToArray()));
                sb.AppendLine();
            }

            if (Testing.Any())
            {
                sb.AppendFormat("Testing: '{0}'", string.Join(", ", Testing.Select(p => $"{p.Name} - {p.TemplateId}").ToArray()));
                sb.AppendLine();
            }

            return(sb.ToString());
        }
Пример #8
0
        private async void OnPackageChanged(ContentPackage current, ContentPackage previous)
        {
            if (!(current is { } package))
            {
                return;
            }

            var book = await package.ToPlatformAsync();

            var mode = previous == null ? NavigationMode.New : NavigationMode.Refresh;

            await InitializeAsync(book, mode);

            if (mode != NavigationMode.New)
            {
                return;
            }

            if (!Pages.Any())
            {
                return;
            }

            OnPackageContentChanged(package, null);
        }
        private void SearchCompletedHandler(System.Net.DownloadStringCompletedEventArgs e)
        {
            SearchGroupTabs = null;
            //TODO examine e.Error
            if (e.Error == null)
            {
                var groupTabs = _tabSearcher.Entries.Where(FilterTab).
                                Select(entry => new TabEntity
                {
                    SearchId  = entry.Id,
                    SearchUrl = entry.Url,
                    Name      = entry.Name,
                    Group     = entry.Artist,
                    Rating    = entry.Rating,
                    Type      = entry.Type,
                    ImageUrl  = Database.GetTabTypeByName(entry.Type).ImageUrl,
                    Votes     = entry.Votes,
                    Version   = entry.Version
                });



                if (_sortOrder == ResultsSortOrder.Popularity)
                {
                    var artistName = CurrentSearchText.TransLiterate();
                    var grouped    = groupTabs.Where(t => t.Group.TransLiterate() == artistName).OrderByDescending(t => t.Votes);
                    IsNothingPopularFound = !grouped.Any();
                    SearchPopularTabs     = new ObservableCollection <TabEntity>(grouped.Take(100));
                    Deployment.Current.Dispatcher.BeginInvoke(() => { IsSearching = false; });
                    //Clear the Search Area (for the Search Page)
                    this.ClearSearchArea();
                }
                else
                {
                    IsNothingFound  = !groupTabs.Any();
                    Pages           = Enumerable.Range(1, _tabSearcher.Summary.PageCount).Select(p => p.ToString());
                    SearchGroupTabs = new TabsByName(new ObservableCollection <TabEntity>(groupTabs), Database);
                    Deployment.Current.Dispatcher.BeginInvoke(
                        () =>
                    {
                        if (Pages.Any())
                        {
                            SelectedPage = Pages.ElementAt(CurrentPageIndex - 1);
                        }
                        RaisePropertyChanged("SelectedPage");
                        AssignHeaderPagingUI(_tabSearcher.Summary.PageCount);
                        IsSearching = false;
                    });
                }
            }
            else
            {
                IsSearching = false;
                ClearSearchArea();
                Dialog.Show(AppResources.Search_Sorry, AppResources.Search_ServerUnavailable);
            }
        }
        public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var  input = (ApplicationPage)value;
            Type pageType;

            switch (input)
            {
            case ApplicationPage.Home:
                pageType = typeof(HomeView);
                break;

            case ApplicationPage.Login:
                pageType = typeof(LoginView);
                break;

            case ApplicationPage.Camera:
                pageType = typeof(CameraView);
                break;

            case ApplicationPage.Laser:
                pageType = typeof(LaserView);
                break;

            case ApplicationPage.Table:
                pageType = typeof(TableView);
                break;

            case ApplicationPage.Server:
                pageType = typeof(ServerView);
                break;

            case ApplicationPage.Settings:
                pageType = typeof(SettingsView);
                break;

            case ApplicationPage.Charts:
                pageType = typeof(ChartView);
                break;

            default:
                throw new NotSupportedException("Can not find such type of page");
            }

            // If page created, take from the list
            if (Pages.Any(ele => ele.GetType() == pageType))
            {
                return(Pages.First(ele => ele.GetType() == pageType));
            }

            // If not created push in list and return the new page
            var page = (UserControl)Activator.CreateInstance(pageType);

            Pages.Add(page);
            return(page);
        }
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            if (!string.IsNullOrEmpty(Language))
            {
                sb.AppendFormat("Language: '{0}'", Language);
                sb.AppendLine();
            }

            if (!string.IsNullOrEmpty(ProjectType))
            {
                sb.AppendFormat("ProjectType: '{0}'", ProjectType);
                sb.AppendLine();
            }

            if (!string.IsNullOrEmpty(FrontEndFramework))
            {
                sb.AppendFormat("Front End Framework: '{0}'", FrontEndFramework);
                sb.AppendLine();
            }

            if (!string.IsNullOrEmpty(BackEndFramework))
            {
                sb.AppendFormat("Back End Framework: '{0}'", BackEndFramework);
                sb.AppendLine();
            }

            if (Pages.Any())
            {
                sb.AppendFormat("Pages: '{0}'", string.Join(", ", Pages.Select(p => $"{p.Name} - {p.TemplateId}").ToArray()));
                sb.AppendLine();
            }

            if (Features.Any())
            {
                sb.AppendFormat("Features: '{0}'", string.Join(", ", Features.Select(p => $"{p.Name} - {p.TemplateId}").ToArray()));
                sb.AppendLine();
            }

            if (Services.Any())
            {
                sb.AppendFormat("Services: '{0}'", string.Join(", ", Services.Select(p => $"{p.Name} - {p.TemplateId}").ToArray()));
                sb.AppendLine();
            }

            if (Testing.Any())
            {
                sb.AppendFormat("Testing: '{0}'", string.Join(", ", Testing.Select(p => $"{p.Name} - {p.TemplateId}").ToArray()));
                sb.AppendLine();
            }

            return(sb.ToString());
        }
Пример #12
0
        private async Task SaveCustomerAsync()
        {
            try
            {
                if (!WasModified)
                {
                    GoBackCommand.Execute(null);
                    return;
                }

                if (!Pages.Any(p => IsValid(p)))
                {
                    ErrorMessage = "Unable to save customer";
                    return;
                }

                ErrorMessage     = "";
                Customer         = Pages[0].Customer;
                Customer.Address = Pages[1].Address;
                Customer.Contact = Pages[2].Contact;
                Customer.Pool    = Pages[3].Pool;

                Position?position = await Customer.Address.FullAddress.GetPositionAsync();

                if (position.HasValue)
                {
                    Customer.Latitude  = position.Value.Latitude;
                    Customer.Longitude = position.Value.Longitude;
                }

                var customerController = new CustomerController();
                await customerController.ModifyWithChildrenAsync(Customer);

                OnPropertyChanged("Progress");
                OnPropertyChanged("Percent");
                Pages[3].NotifyPropertyChanged("ShowAddEquipment");
                WasModified      = false;
                ErrorMessage     = "Save Customer Success";
                OriginalCustomer = JsonConvert.SerializeObject(Customer,
                                                               Formatting.Indented,
                                                               new JsonSerializerSettings {
                    PreserveReferencesHandling = PreserveReferencesHandling.Objects
                });
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                ErrorMessage = $"Error: {e.Message}";
            }
        }
Пример #13
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            Page   page = new Page();
            int    i    = 1;
            string name = "page1";

            while (Pages.Any(p => p.Name == name))
            {
                i++;
                name = "page" + i.ToString();
            }
            page.Name = name;
            Pages.Add(page);
        }
Пример #14
0
        private void GetSiteOutDegree()
        {
            foreach (Page p in Pages)
            {
                try{
                    HtmlWeb hw = new HtmlWeb()
                    {
                        PreRequest = request =>
                        {
                            // Make any changes to the request object that will be used.
                            request.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;
                            return(true);
                        }
                    };
                    HtmlDocument doc   = hw.Load(p.Url);
                    var          nodes = doc.DocumentNode.SelectNodes("//a[@href]");
                    if (nodes != null)
                    {
                        foreach (HtmlNode link in nodes)
                        {
                            var url = link.Attributes["href"].Value;
                            if (url.StartsWith("http"))
                            {
                                if (Pages.Any(page => page.Url == url))
                                {
                                    p.OutDegreeLinks.Add(link.Attributes["href"].Value);
                                }
                            }
                        }
                    }
                }
                catch (Exception e) {
                    Console.WriteLine(e.Message);
                }
            }

            using (System.IO.StreamWriter file =
                       new System.IO.StreamWriter(Directory.GetCurrentDirectory() + "//outdegreelinks.txt"))
            {
                foreach (Page p in Pages)
                {
                    file.WriteLine("Id: " + p.Id);
                    foreach (var link in p.OutDegreeLinks)
                    {
                        file.WriteLine(link);
                    }
                }
            }
        }
Пример #15
0
        private Page MakePage()
        {
            int    i    = 1;
            string name = "page" + i.ToString();

            while (Pages.Any(p => p.Name == name))
            {
                i++;
                name = "page" + i.ToString();
            }

            Page page = new Page();

            page.Name = name;
            return(page);
        }
Пример #16
0
        public void Save(EarTrumpetActionViewModel earTrumpetActionViewModel)
        {
            var actions = EarTrumpetActionsAddon.Current.Actions.ToList();

            if (actions.Any(a => a.Id == earTrumpetActionViewModel.Id))
            {
                actions.Remove(item => item.Id == earTrumpetActionViewModel.Id);
            }
            actions.Insert(0, earTrumpetActionViewModel.GetAction());
            EarTrumpetActionsAddon.Current.Actions = actions.ToArray();
            earTrumpetActionViewModel.IsWorkSaved  = true;

            if (Pages.Any(a => a == earTrumpetActionViewModel))
            {
                Pages.Remove(earTrumpetActionViewModel);
            }
            Pages.Insert(0, earTrumpetActionViewModel);
            Selected = Pages[0];
        }
        private void Crawler_ProcessPageCrawlCompleted(object sender, PageCrawlCompletedArgs e)
        {
            var requestStarted   = e.CrawledPage.RequestStarted;
            var requestCompleted = e.CrawledPage.RequestCompleted;
            var doc        = e.CrawledPage.AngleSharpHtmlDocument;
            var title      = doc.Title;
            var uri        = e.CrawledPage.Uri;
            var path       = $"{uri.Scheme}{Uri.SchemeDelimiter}{uri.Authority}{uri.AbsolutePath}";
            var parentUri  = e.CrawledPage.ParentUri;
            var parentPath = $"{parentUri.Scheme}{Uri.SchemeDelimiter}{parentUri.Authority}{parentUri.AbsolutePath}";

            if (!Pages.Any(rp => rp.PageTitle == title || (rp.Path == path && rp.ParentPath == parentPath)))
            {
                Pages.Add(new RetrievedPage()
                {
                    HtmlDoc = doc, PageTitle = title, Url = uri.ToString(), Path = path, ParentPath = parentPath
                });
            }
            Console.WriteLine($"Page Crawled: {e.CrawledPage.Uri} in {(requestCompleted - requestStarted).TotalSeconds} seconds");
        }
Пример #18
0
        public UserSelection GetUserSelection()
        {
            var selection = new UserSelection(_projectTypeName, _frameworkName, _language);

            if (Pages.Any())
            {
                selection.HomeName = Pages.First().Name;
            }

            foreach (var page in Pages)
            {
                selection.Pages.Add(page.GetUserSelection());
            }

            foreach (var feature in Features)
            {
                selection.Features.Add(feature.GetUserSelection());
            }

            return(selection);
        }
Пример #19
0
        public RenderedPageForDisplayDTO NextPage(FormCollection form)
        {
            RenderedPageForDisplayDTO currentPage = GetCurrentPageFromRoute();

            if (currentPage != null)
            {
                if (currentPage.NextPageID.HasValue && Pages.Any(p => p.PageID == currentPage.NextPageID.Value))
                {
                    return(Pages.Where(p => p.PageID == currentPage.NextPageID.Value).FirstOrDefault());
                }
                else
                {
                    //no further pages
                    return(null);
                }
            }
            else
            {
                throw new Exception("unable to find page");
            }
        }
Пример #20
0
        public RenderedPageForDisplayDTO PreviousPage()
        {
            RenderedPageForDisplayDTO currentPage = GetCurrentPageFromRoute();

            if (currentPage != null)
            {
                if (Pages.Any(p => p.NextPageID.HasValue && p.NextPageID == currentPage.PageID))
                {
                    return(Pages.Where(p => p.NextPageID == currentPage.PageID).FirstOrDefault());
                }
                else
                {
                    //no previous pages
                    return(null);
                }
            }
            else
            {
                throw new Exception("unable to find page");
            }
        }
Пример #21
0
        public async Task FinalizeAsync()
        {
            if (DynamicDataAdded)
            {
                return;
            }

            if (!Pages.Any())
            {
                throw new InvalidOperationException("Unable to create book with no pages");
            }

            await AddTextEntryAsync(Strings.EpubContentEntryName, EpubXmlWriter.GenerateContentOPF(Metadata, Contents, Pages)).ConfigureAwait(false);

            if (!Pages.Where(d => d.NavigationLabel != null).Any())
            {
                Pages.First().NavigationLabel = Metadata.Title;
            }

            await AddTextEntryAsync(Strings.EpubNavEntryName, EpubXmlWriter.GenerateNavXML(Pages)).ConfigureAwait(false);

            DynamicDataAdded = true;
        }
 private void SyncPagesWithActionCollection(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == NotifyCollectionChangedAction.Add)
     {
         foreach (ActionProfileOptions action in e.NewItems)
         {
             WeakEventManager <ActionProfileOptions, ActionNameChangedEventArgs> .AddHandler(
                 action, nameof(ActionProfileOptions.NameChanged), OnActionNameChanged);
         }
     }
     else if (e.Action == NotifyCollectionChangedAction.Remove)
     {
         foreach (ActionProfileOptions action in e.OldItems)
         {
             WeakEventManager <ActionProfileOptions, ActionNameChangedEventArgs> .RemoveHandler(
                 action, nameof(ActionProfileOptions.NameChanged), OnActionNameChanged);
         }
     }
     RaisePropertyChanged(nameof(ActionNames));
     if (!Pages.Any(a => a.Name == _profile.MenuCommands.DebugAction))
     {
         _profile.MenuCommands.DebugAction = null;
     }
     if (!Pages.Any(a => a.Name == _profile.MenuCommands.ProfileAction))
     {
         _profile.MenuCommands.ProfileAction = null;
     }
     if (!Pages.Any(a => a.Name == _profile.MenuCommands.DisassembleAction))
     {
         _profile.MenuCommands.DisassembleAction = null;
     }
     if (!Pages.Any(a => a.Name == _profile.MenuCommands.PreprocessAction))
     {
         _profile.MenuCommands.PreprocessAction = null;
     }
 }
Пример #23
0
        internal void DownloadPagesAndImages()
        {
            try
            {
                Limiter.BeginChapter(this);

                try
                {
                    DownloadPagesList();

                    var  names        = Pages.Select(p => p.Name);
                    var  sorted_names = Pages.Select(p => p.Name).OrderBy(n => n, new NaturalOrderStringComparer());
                    bool error        = false;

                    PageNamingStrategy pns = DownloadManager.Instance.MangaSettings.PageNamingStrategy;
                    if (pns == PageNamingStrategy.IndexToPreserveOrder)
                    {
                        if (!names.SequenceEqual(sorted_names))
                        {
                            pns = PageNamingStrategy.AlwaysUseIndex;
                        }
                    }
                    else if (pns == PageNamingStrategy.PrefixToPreserverOrder)
                    {
                        if (!names.SequenceEqual(sorted_names))
                        {
                            pns = PageNamingStrategy.AlwaysUsePrefix;
                        }
                    }

                    for (int i = 0; i < Pages.Count; i++)
                    {
                        Pages[i].LimiterOrder = Catalog.NextID();

                        Debug.Assert(Pages[i].Index == i + 1);
                    }

                    Parallel.ForEach(new SequentialPartitioner <Page>(Pages),

                                     new ParallelOptions()
                    {
                        MaxDegreeOfParallelism = Crawler.MaxConnectionsPerServer
                    },
                                     (page, state) =>
                    {
                        try
                        {
                            page.DownloadAndSavePageImage(pns);

                            Catalog.Save(this);
                        }
                        catch (OperationCanceledException)
                        {
                            state.Break();
                        }
                        catch (Exception ex2)
                        {
                            Loggers.MangaCrawler.Error(String.Format(
                                                           "Exception #1, chapter: {0} state: {1}",
                                                           this, State), ex2);

                            error = true;
                        }
                    }
                                     );

                    Token.ThrowIfCancellationRequested();

                    if (PagesDownloaded != Pages.Count)
                    {
                        State = ChapterState.Error;
                    }
                    else if (Pages.Any(p => p.State != PageState.Downloaded))
                    {
                        State = ChapterState.Error;
                    }
                    else if (error)
                    {
                        State = ChapterState.Error;
                    }

                    Catalog.Save(this);

                    if (DownloadManager.Instance.MangaSettings.UseCBZ)
                    {
                        if (State != ChapterState.Error)
                        {
                            CreateCBZ();
                        }
                    }

                    Visited = true;
                }
                finally
                {
                    Limiter.EndChapter(this);
                }
            }
            catch (OperationCanceledException)
            {
                Debug.Assert(State == ChapterState.Cancelling);
                Debug.Assert(m_cancellation_token_source.IsCancellationRequested);

                State = ChapterState.Cancelled;
            }
            catch (Exception ex1)
            {
                Loggers.MangaCrawler.Error(String.Format(
                                               "Exception #2, chapter: {0} state: {1}", this, State), ex1);

                State = ChapterState.Error;

                try
                {
                    DownloadManager.Instance.DownloadChapters(Serie, true);
                }
                catch (Exception ex2)
                {
                    Loggers.MangaCrawler.Error(String.Format(
                                                   "Exception #3, chapter: {0} state: {1}", this, State), ex2);
                }
            }
            finally
            {
                lock (m_state_lock)
                {
                    if ((State != ChapterState.Error) && (State != ChapterState.Cancelled))
                    {
                        Debug.Assert(
                            (State == ChapterState.DownloadingPages) ||
                            (State == ChapterState.Zipping));
                        State = ChapterState.Downloaded;
                    }
                }
            }

            Catalog.Save(this);
        }
Пример #24
0
 public bool HasButton(VRCEUiQuickButton button) =>
 Pages.Any(a => a.HasButton(button));
Пример #25
0
 public bool Contains(object value)
 {
     return(Pages.Any(page => page == value));
 }
Пример #26
0
        private async Task TryRemoveHiddenDependenciesAsync(SavedTemplateViewModel savedTemplate)
        {
            foreach (var identity in savedTemplate.Dependencies)
            {
                var dependency = Features.FirstOrDefault(f => f.Identity == identity.Identity);
                if (dependency == null)
                {
                    dependency = Pages.FirstOrDefault(p => p.Identity == identity.Identity);
                }

                if (dependency != null)
                {
                    // If the template is not hidden we can not remove it because it could be added in wizard
                    if (dependency.IsHidden)
                    {
                        // Look if there are another saved template that depends on it.
                        // For example, if it's added two different chart pages, when remove the first one SampleDataService can not be removed, but if no saved templates use SampleDataService, it can be removed.
                        if (!Features.Any(sf => sf.Dependencies.Any(d => d.Identity == dependency.Identity)) || Pages.Any(p => p.Dependencies.Any(d => d.Identity == dependency.Identity)))
                        {
                            await RemoveAsync(dependency);
                        }
                    }
                }
            }
        }
Пример #27
0
 public bool HasItem(Transform item) =>
 Pages.Any(a => a.HasItem(item));
Пример #28
0
 public Page this[string pageName] => Pages.Any() ? Pages.FirstOrDefault(p => p.Name == pageName) : null;
Пример #29
0
 public bool HasChildren()
 {
     return(Pages.Any(p => p.ParentId == Page.PageNavigation.Id));
 }