コード例 #1
0
        private static void AddFolders(Folder parentFolder, DataSet dataset, List <Folder> folders)
        {
            OC_DataTable table = dataset.Tables[0] as OC_DataTable;

            if (parentFolder != null)
            {
                OC_Datarow newRow = (OC_Datarow)table.NewRow();
                newRow.Tag        = parentFolder;
                newRow["ID"]      = parentFolder.UniqueIdentifier;
                newRow["Title"]   = "..";
                newRow["URL"]     = parentFolder.UniqueIdentifier;
                newRow["Picture"] = ImageManager.GetInstance().GetUpFolderImage();
                table.Rows.Add(newRow);
            }
            foreach (Folder subfolder in folders)
            {
                if (subfolder.Selected == false)
                {
                    continue;
                }

                OC_Datarow newRow = (OC_Datarow)table.NewRow();
                newRow.Tag      = subfolder;
                newRow["ID"]    = subfolder.UniqueIdentifier;
                newRow["Title"] = subfolder.Title;
                newRow["URL"]   = subfolder.UniqueIdentifier;
                string picturePath = string.Empty;
                if (subfolder as SPWeb != null)
                {
                    picturePath = ImageManager.GetInstance().GetWebImage();
                }
                else if (subfolder as SPList != null)
                {
                    picturePath = ImageManager.GetInstance().GetListImage();
                }
                else
                {
                    picturePath = ImageManager.GetInstance().GetFolderImage();
                }

                newRow["Picture"] = picturePath;
                table.Rows.Add(newRow);
            }
        }
コード例 #2
0
        private static void AddItems(DataSet dataset, List <IItem> items)
        {
            OC_DataTable table = dataset.Tables[0] as OC_DataTable;

            foreach (IItem item in items)
            {
                OC_Datarow newRow = (OC_Datarow)table.NewRow();
                UpdateItemProperties(newRow, item);
                table.Rows.Add(newRow);
            }
        }
コード例 #3
0
        private void AddItems(DataSet dataset, List <IItem> items)
        {
            OC_DataTable table = dataset.Tables[0] as OC_DataTable;

            foreach (IItem item in items)
            {
                OC_Datarow newRow = (OC_Datarow)table.NewRow();
                newRow.Tag = item;
                string extensionName = item.URL.Substring(item.URL.LastIndexOf('.') + 1);
                newRow["Picture"] = ImageManager.GetInstance().GetExtensionImageFromResource(extensionName, item.isExtracted());
                newRow["ID"]      = item.UniqueIdentifier;
                newRow["Title"]   = item.Title;
                newRow["URL"]     = item.URL;
                table.Rows.Add(newRow);
            }
        }
コード例 #4
0
        private void FoldersTreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            ResultGrid.Items.Clear();
            DataSet      ds = new DataSet();
            OC_DataTable dt = new OC_DataTable();

            ds.Tables.Add(dt);
            DataColumn dtTypeColumn    = dt.Columns.Add("Key");
            DataColumn dtPictureColumn = dt.Columns.Add("Value");

            SPWebpart webpart = ((TreeViewItem)WebpartsTreeView.SelectedItem).Tag as SPWebpart;

            foreach (string key in webpart.Properties.Keys)
            {
                OC_Datarow newRow = (OC_Datarow)dt.NewRow();
                newRow["Key"]   = key;
                newRow["Value"] = webpart.Properties[key];
                newRow.Tag      = webpart.Properties[key];
                dt.Rows.Add(newRow);
            }
            ResultGrid.ItemsSource = dt.AsDataView();
        }