示例#1
0
        void dragMgr_ProcessDrop(object sender, DragEventArgs e)//, ProcessDropEventArgs<DataRowView> e)
        {
            if (e.Effects == DragDropEffects.None)
            {
                return;
            }

            if (e.Data.GetDataPresent("System.Data.DataRowView", false) == true && this.dragMgr.IndexUnderDragCursor != -1)//JD.
            {
                ListView  list  = (ListView)e.Source;
                DataTable items = ((DataView)list.ItemsSource).Table;

                DataRowView item = e.Data.GetData(typeof(DataRowView)) as DataRowView;

                OC_Datarow dropUnder = (OC_Datarow)(items.Rows[this.dragMgr.IndexUnderDragCursor]);

                bool isFolder = (dropUnder.Tag as Folder != null);

                if (isFolder)
                {
                    ISiteSetting siteSetting = ConfigurationManager.GetInstance().GetSiteSetting(SelectedFolder.SiteSettingID);

                    Folder     folder         = dropUnder.Tag as Folder;
                    OC_Datarow dataSourceItem = (OC_Datarow)(item).Row;
                    IItem      itemToMove     = dataSourceItem.Tag as IItem;

                    if (ItemsManager.moveItem(siteSetting, itemToMove, folder))
                    {
                        reloadItemList();
                    }
                }
            }
            else
            {
                if (SelectedFolder == null)
                {
                    return;
                }
                List <IItem> emailItems = new List <IItem>();

                if (SelectedFolder.CanUpload() == false)
                {
                    MessageBox.Show(Languages.Translate("In order to upload email, you need to enable attachment feature in this list."));
                    return;
                }

                ISiteSetting      siteSetting = ConfigurationManager.GetInstance().GetSiteSetting(SelectedFolder.SiteSettingID);
                List <UploadItem> uploadItems = ApplicationContext.Current.GetUploadItems(SelectedFolder.GetWebUrl(), siteSetting, SelectedFolder, e, getFieldMappings);
                if (uploadItems == null)
                {
                    return;
                }

                WorkItem workItem = new WorkItem(Languages.Translate("Uploading emails"));
                workItem.CallbackFunction = new WorkRequestDelegate(UploadEmails_Callback);
                workItem.CallbackData     = new object[] { siteSetting, SelectedFolder, uploadItems, this.ConnectorExplorer, true };
                workItem.WorkItemType     = WorkItem.WorkItemTypeEnum.NonCriticalWorkItem;
                BackgroundManager.GetInstance().AddWorkItem(workItem);
            }
        }
示例#2
0
        private void LibraryContentDataGridView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (LibraryContentDataListView.SelectedItem == null)
            {
                return;
            }

            OC_Datarow row = (OC_Datarow)((DataRowView)LibraryContentDataListView.SelectedItem).Row;

            if (row.Tag as Folder != null)
            {
                Folder      folder       = row.Tag as Folder;
                SiteSetting siteSetting  = ConfigurationManager.GetInstance().GetSiteSetting(folder.SiteSettingID);
                Folder      parentFolder = this.SelectedFolder;
                if (row["Title"].ToString() == "..")
                {
                    parentFolder = ApplicationContext.Current.GetParentFolder(siteSetting, folder);
                }
                SelectFolder(parentFolder, folder);

                /*
                 * WorkItem workItem = new WorkItem(Languages.Translate("Populating breadcrumb"));
                 * workItem.CallbackFunction = new WorkRequestDelegate(BreadcrumbNavigatorExplorerSelectFolder_Callback);
                 * workItem.CallbackData = new object[] { LibraryContentDataListView, this.ConnectorExplorer.BreadcrumbNavigatorExplorer, folder };
                 * workItem.WorkItemType = WorkItem.WorkItemTypeEnum.NonCriticalWorkItem;
                 * BackgroundManager.GetInstance().AddWorkItem(workItem);
                 */


                //this.ConnectorExplorer.BreadcrumbNavigatorExplorer.SelectFolder(folder);
            }
        }
示例#3
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);
            }
        }
示例#4
0
 public static void AddTempItemInGrid(string id, string title, ListView libraryContentDataGridView)
 {
     libraryContentDataGridView.Dispatcher.Invoke(DispatcherPriority.Input, new ThreadStart(() =>
     {
         DataTable dt      = ((DataView)libraryContentDataGridView.ItemsSource).Table;
         OC_Datarow newRow = (OC_Datarow)dt.NewRow();
         newRow["ID"]      = id;
         newRow["Title"]   = title;
         newRow["Picture"] = "/Sobiens.Connectors.WPF.Controls;component/Images/loader.GIF";
         dt.Rows.Add(newRow);
     }));
 }
示例#5
0
        private static void RemoveFolders(DataSet dataset)
        {
            OC_DataTable table = dataset.Tables[0] as OC_DataTable;

            for (int i = table.Rows.Count - 1; i > -1; i--)
            {
                OC_Datarow row = table.Rows[i] as OC_Datarow;
                if (row.Tag as Folder != null)
                {
                    table.Rows.RemoveAt(i);
                }
            }
        }
        private void RemoveItems(DataSet dataset)
        {
            OC_DataTable table = dataset.Tables[0] as OC_DataTable;

            for (int i = table.Rows.Count - 1; i > -1; i--)
            {
                OC_Datarow row = table.Rows[i] as OC_Datarow;
                if (row.Tag as IItem != null)
                {
                    table.Rows.RemoveAt(i);
                }
            }
        }
示例#7
0
        public static void UpdateItemProperties(OC_Datarow row, IItem item)
        {
            row.Tag = item;
            string extensionName = item.URL.Substring(item.URL.LastIndexOf('.') + 1);

            row["Picture"] = ImageManager.GetInstance().GetExtensionImageFromResource(extensionName, item.isExtracted());
            row["ID"]      = item.UniqueIdentifier;
            row["Title"]   = item.Title;
            row["URL"]     = item.URL;
            string modifiedBy    = item.Properties["Editor"].ToString();
            string modifiedBySIP = "sip:[email protected]";

            row["ModifiedBy"]    = Sobiens.Connectors.Common.tools.keepBehind(modifiedBy, ";#");
            row["ModifiedBySIP"] = modifiedBySIP;
        }
示例#8
0
        public static void UpdateUploadItemInGrid(string id, IItem item, object LibraryContentDataGridView)
        {
            //DataGrid libraryContentDataGridView = (DataGrid)LibraryContentDataGridView;//JD
            ListView libraryContentDataGridView = (ListView)LibraryContentDataGridView;

            libraryContentDataGridView.Dispatcher.Invoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                DataTable dt     = ((DataView)libraryContentDataGridView.ItemsSource).Table;
                DataRow[] result = dt.Select("ID = '" + id.ToString() + "'");
                if (result.Count() > 0)
                {
                    OC_Datarow row = (OC_Datarow)result[0];
                    UpdateItemProperties(row, item);
                }
            }));
        }
示例#9
0
        public static void UpdateUploadItemErrorInGrid(string id, IItem item, object LibraryContentDataGridView)
        {
            //DataGrid libraryContentDataGridView = (DataGrid)LibraryContentDataGridView;//JD
            ListView libraryContentDataGridView = (ListView)LibraryContentDataGridView;

            libraryContentDataGridView.Dispatcher.Invoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                DataTable dt     = ((DataView)libraryContentDataGridView.ItemsSource).Table;
                DataRow[] result = dt.Select("ID = '" + id.ToString() + "'");
                if (result.Count() > 0)
                {
                    OC_Datarow row = (OC_Datarow)result[0];
                    row["Picture"] = "/Sobiens.Connectors.WPF.Controls;component/Images/error.GIF";
                }
            }));
        }
        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);
            }
        }
示例#11
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);
            }
        }
        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();
        }