Exemplo n.º 1
0
        private FoxeCategoryTreeViewItem CreateRootFoxeTreeViewNode()
        {
            //FoxeCategory rootCategory = foxeContext.CategoryItems.Where(cat => cat.ParentCategory == null).First();
            var          query        = foxeContext.CategoryItems.Where(cat => cat.ParentCategory == null);
            FoxeCategory rootCategory = query.First();

            foxeRootTreeViewNode = CreateExapndableCategoryTreeItem(rootCategory);
            foxeTreeView.Items.Add(foxeRootTreeViewNode);
            return(foxeRootTreeViewNode);
        }
Exemplo n.º 2
0
        private FoxeCategoryTreeViewItem CreateExapndableCategoryTreeItem(FoxeCategory foxeCategory)
        {
            FoxeCategoryTreeViewItem item = new FoxeCategoryTreeViewItem(foxeCategory);

            //item.Items.Add(new FoxeProcessingTreeViewItem());
            if (foxeCategory.ChildCategories.Count > 1 || foxeCategory.Pages.Count >= 1)
            {
                item.Items.Add(new FoxeProcessingTreeViewItem());
            }
            return(item);
        }
Exemplo n.º 3
0
        private async void foxeTreeView_Expanded(object sender, RoutedEventArgs e)
        {
            if (e.Source is FoxeCategoryTreeViewItem)
            {
                FoxeCategoryTreeViewItem item = e.Source as FoxeCategoryTreeViewItem;
                await UsrExapandedCategoryTreeViewItem(item);
            }

            if (e.Source is FoxePageTreeViewItem)
            {
                FoxePageTreeViewItem item = e.Source as FoxePageTreeViewItem;
                await UsrExapandedPageTreeViewItem(item);
            }
        }
Exemplo n.º 4
0
 private void InitApplication()
 {
     LogManager.Init();
     // Program.DatabaseSetup();
     foxeContext = new FoxEbookDbContext();
     foxeContext.Database.Log       = Console.Write;
     foxeTreeViewNotifications      = Global.FoxeTreeViewNotifications;
     jobNotifications               = Global.JobNotifications;
     jobNotifications.JobCompleted += new EventHandler <JobCompletedEventArgs>(jobNotifications_JobCompleted);
     //foxeTreeViewNotifications.DownloadFoxeProducts+=new EventHandler<FoxeDownloadProductsEventArgs>(foxeTreeViewNotifications_DownloadFoxeProducts);
     foxeTreeViewNotifications.GotoParent += new EventHandler <FoxeGotoParentEventArgs>(foxeTreeViewNotifications_GotoParent);
     foxeRootTreeViewNode      = CreateRootFoxeTreeViewNode();
     gvJobsSummary.ItemsSource = JobQueue.JobsSummary;
     gvLog.ItemsSource         = LogManager.LogsList;
     Global.StartScheduler();
 }
Exemplo n.º 5
0
        private async Task AddPagesUnderSubCategory(FoxeCategoryTreeViewItem subCategoryTreeViewItem, FoxeCategory foxeSubCategory)
        {
            var synchronizationContext = TaskScheduler.FromCurrentSynchronizationContext();
            var cancellationToken      = new CancellationToken();

            await Task.Factory.StartNew(() =>
            {
                subCategoryTreeViewItem.Items.Clear();
                foreach (FoxePage foxePage in foxeSubCategory.Pages)
                {
                    subCategoryTreeViewItem.Items.Add(CreateExapndablePageTreeItem(foxePage));
                    //var pageTreeViewItem = new FoxePageTreeViewItem(foxePage);
                    //subCategoryTreeViewItem.Tag = foxePage;
                    //subCategoryTreeViewItem.Items.Add(pageTreeViewItem);
                }
            }, cancellationToken, TaskCreationOptions.None, synchronizationContext);
        }
Exemplo n.º 6
0
        private async Task AddSubCategoriesUnderRootCategory(FoxeCategoryTreeViewItem rootCategoryTreeViewItem, FoxeCategory rootFoxeCategory)
        {
            var taskGetSubCategoriesForRootcategory = new Task <IList <FoxeCategory> >(() =>
            {
                return(rootFoxeCategory.ChildCategories.ToList());
            });

            taskGetSubCategoriesForRootcategory.Start();
            var foxeSubCategories = await taskGetSubCategoriesForRootcategory;

            rootCategoryTreeViewItem.Items.Clear();

            foreach (var foxeCategory in foxeSubCategories)
            {
                rootCategoryTreeViewItem.Items.Add(CreateExapndableCategoryTreeItem(foxeCategory));
            }
        }
Exemplo n.º 7
0
        private async Task UsrExapandedCategoryTreeViewItem(FoxeCategoryTreeViewItem item)
        {
            if ((item.Items.Count == 1) && (item.Items[0] is FoxeProcessingTreeViewItem))
            {
                if (item.Tag is FoxeCategory)
                {
                    var foxeCategory = item.Tag as FoxeCategory;

                    // At Root Category Node
                    if (foxeCategory.IsRoot())
                    {
                        // Expanding Root Category --(should give)--> Child Categories
                        await AddSubCategoriesUnderRootCategory(item, foxeCategory);
                    }

                    //  At Left Category Node
                    if (foxeCategory.IsLeaf())
                    {
                        //Expanding Child Category --(should give)--> Pages
                        await AddPagesUnderSubCategory(item, foxeCategory);
                    }
                }
            }
        }