Пример #1
0
        public override Style SelectStyle(object item, DependencyObject container)
        {
            ListView   listView = ItemsControl.ItemsControlFromItemContainer(container) as ListView;
            LinkObject link     = item as LinkObject;

            if (link == null)
            {
                return(listView.FindResource("DefaultItemStyle") as Style);
            }
            else
            {
                switch (link.category)
                {
                case linkCategory.Object: return(listView.FindResource("ObjectStyle") as Style);

                case linkCategory.Method: return(listView.FindResource("MethodStyle") as Style);

                case linkCategory.Property: return(listView.FindResource("PropertyStyle") as Style);

                case linkCategory.Function: return(listView.FindResource("FunctionStyle") as Style);

                case linkCategory.DclTile: return(listView.FindResource("DclTileStyle") as Style);

                case linkCategory.DclAttribute: return(listView.FindResource("DclAttributeStyle") as Style);

                case linkCategory.Event: return(listView.FindResource("EventStyle") as Style);

                default: return(listView.FindResource("DefaultItemStyle") as Style);
                }
            }
        }
Пример #2
0
 private void Navigator(ref bool searching, int ContentTarget)
 {
     if (currentIndex < CatagorizedLinks[currentKey].Count)
     {
         string dir  = dataFolder + Enum.GetName(linkCategory.NotUsed.GetType(), CatagorizedLinks[currentKey][currentIndex].category) + "\\";
         string path = dir + CatagorizedLinks[currentKey][currentIndex].guid + ".html";
         if (System.IO.Directory.Exists(dir) == false)
         {
             System.IO.Directory.CreateDirectory(dir);
         }
         if (System.IO.File.Exists(path) == false || new System.IO.FileInfo(path).Length <= 3000) // verifying its not a near empty html file
         {
             if (ContentTarget == 1)
             {
                 b1path    = path;
                 b1Content = CatagorizedLinks[currentKey][currentIndex];
                 wbDownloader1.Navigate(b1Content.url);
             }
             else
             {
                 b2path    = path;
                 b2Content = CatagorizedLinks[currentKey][currentIndex];
                 wbDownloader2.Navigate(b2Content.url);
             }
             searching = false;
         }
         else
         {
             currentIndex++;
         }
     }
     else
     {
         if (AllKeys.IndexOf(currentKey) + 1 < AllKeys.Count)
         {
             currentKey   = AllKeys[AllKeys.IndexOf(currentKey) + 1];
             currentIndex = 0;
         }
         else
         {
             if (ContentTarget == 1)
             {
                 b1Content = null;
             }
             else
             {
                 b2Content = null;
             }
             searching = false;
         }
     }
 }
Пример #3
0
 /// These callbacks do represent all the interface behavior associated with Step 4
 /// The ScrapeDocument, WebObjectLibrary and all its sub-object Classes are defined in: /StepBehaviors/Step4.WebObjectLibrary.cs
 private void lbxScrapeContent_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
 {
     if (lbxScrapeContent.SelectedItem is LinkObject)
     {
         LinkObject obj      = (LinkObject)lbxScrapeContent.SelectedItem;
         var        filePath = dataFolder + Enum.GetName(linkCategory.NotUsed.GetType(), obj.category) + "\\" + obj.guid + ".html";
         if (System.IO.File.Exists(filePath) == true)
         {
             tbxScrapeContent.Text = new ScrapeDocument(filePath, obj).jsonString;
         }
         else
         {
             tbxScrapeContent.Text = "Error: The local version of this GUID's content was not found";
         }
     }
     else
     {
         tbxScrapeContent.Text = "Null";
     }
 }