Exemple #1
0
 /// <summary>
 /// Raises event 'ChangeActive'
 /// </summary>
 protected virtual void OnChangeActive()
 {
     if (ChangeActive != null)
     {
         ChangeActive.Invoke(this, System.EventArgs.Empty);
     }
 }
Exemple #2
0
 private void DrivesCB_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (drivesComboBox.SelectedIndex > -1)
     {
         CurrentDrive = (String)drivesComboBox.Items[drivesComboBox.SelectedIndex];
         ChangeActive?.Invoke(this, e); // THIS!
         SelectDrive?.Invoke();
     }
 }
Exemple #3
0
        public async Task SetActiveAsync(string path)
        {
            _logger.LogDebug("Try set breadcrumb");

            CurrentBreadcrumb = await _memoryCache.GetOrCreateAsync(GetCacheNameForPath(path), async entry =>
            {
                var currentNodes     = await _matchSitemapNode.FindByPath(path);
                var firstCurrentNode = currentNodes.FirstOrDefault();
                if (firstCurrentNode != null)
                {
                    //Build breadcrumb
                    var breadcrumb = new BreadcrumbDto
                    {
                        Id   = firstCurrentNode.Id,
                        Name = firstCurrentNode.Name,
                        Path = firstCurrentNode.Path, //TODO build path
                    };

                    var node = firstCurrentNode;
                    var currentBreadcrumb = breadcrumb;
                    while (node.ParentId.HasValue)
                    {
                        var parent = await _sitemapNodeRepository.GetAsync(node.ParentId.Value);

                        var parentBreadcrumb = new BreadcrumbDto
                        {
                            Id   = parent.Id,
                            Name = parent.Name,
                            Path = parent.Path, //TODO build path
                        };

                        currentBreadcrumb.Parent = parentBreadcrumb;

                        currentBreadcrumb = parentBreadcrumb;
                        node = parent;
                    }

                    return(breadcrumb);
                }

                return(BreadcrumbDto.Default);
            });

            ChangeActive?.Invoke(this, new ChangeBreadcrumbEventArgs
            {
                CurrentBreadcrumb = CurrentBreadcrumb
            });
        }
Exemple #4
0
 private void ContentLB_SelectedIndexChanged(object sender, EventArgs e)
 {
     ChangeActive?.Invoke(this, e);
 }