示例#1
0
        /// <summary>
        /// 选择
        /// </summary>
        /// <param name="Item"></param>
        protected void SelectedDealWith(SpaceListViewItem Item)
        {
            try
            {
                this.GetItemUri(Item);

                if (!this.SpaceListViewItemList.Contains(Item))
                {
                    this.SpaceListViewItemList.Add(Item);
                    if (this.SpaceListViewItemList.Count == this.ListViewCollection.Count)
                    {
                        this.OperationCallBack(Item, CallBackType.All_Selected);
                    }
                    if (this.OperationCallBack != null)
                    {
                        this.OperationCallBack(Item, CallBackType.One_Selected);
                    }
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
            finally
            {
            }
        }
示例#2
0
 /// <summary>
 /// 取消选择
 /// </summary>
 /// <param name="Item"></param>
 protected void UnselectedDealWith(SpaceListViewItem Item)
 {
     try
     {
         if (this.SpaceListViewItemList.Contains(Item))
         {
             this.SpaceListViewItemList.Remove(Item);
             if (this.SpaceListViewItemList.Count == 0)
             {
                 if (this.OperationCallBack != null)
                 {
                     this.OperationCallBack(Item, CallBackType.All_UnSelected);
                 }
             }
             if (this.OperationCallBack != null)
             {
                 this.OperationCallBack(Item, CallBackType.One_UnSelected);
             }
         }
     }
     catch (Exception ex)
     {
         LogManage.WriteLog(this.GetType(), ex);
     }
     finally
     {
     }
 }
示例#3
0
        protected void Resource_Delete(SpaceListViewItem item, Action beginCallBack, Action <string, int, string> compleateCallBack)
        {
            try
            {
                int intItemID = 0;


                switch (item.BookType)
                {
                case BookType.File:
                    if (item.Self_File != null)
                    {
                        intItemID = item.Self_File.ID;
                    }
                    break;

                case BookType.Folder:
                    if (item.Self_Folder != null)
                    {
                        intItemID = item.Self_Folder.ID;
                    }
                    break;
                }

                if (beginCallBack != null)
                {
                    beginCallBack();
                }
                if (intItemID > 0)
                {
                    string parameters = SpaceHelper.GetParameters(this.SpaceType, SpaceCodeEnterEntity.DeleteFile, intItemID);
                    ModelManage.Space_Service.Function_Invoke(SpaceCodeEnterEntity.DeleteFile, parameters,
                                                              SpaceCodeEnterEntity.LoginUserName,
                                                              SpaceCodeEnterEntity.WebLoginPassword, SpaceCodeEnterEntity.UserDomain, new Action <Dictionary <string, object> >((dicResult) =>
                    {
                        //跨线程(异步委托)
                        this.Dispatcher.BeginInvoke(new Action(() =>
                        {
                            if (this.currentBreadLine.Folder != null && this.currentBreadLine.Folder.ID > 0)
                            {
                                int strItemID      = this.currentBreadLine.Folder.ID;
                                string parameters2 = SpaceHelper.GetParameters(this.SpaceType, SpaceCodeEnterEntity.GetCollection, strItemID);

                                if (compleateCallBack != null)
                                {
                                    compleateCallBack(parameters2, 0, null);
                                }
                            }
                        }));
                    }));
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
            finally
            {
            }
        }
示例#4
0
 /// <summary>
 /// 获取uri地址
 /// </summary>
 /// <param name="Item"></param>
 protected void GetItemUri(SpaceListViewItem Item)
 {
     try
     {
         if (Item.BookType == Common.BookType.File && Item.Self_File != null)
         {
             if (string.IsNullOrEmpty(Item.Uri))
             {
                 string parameters = SpaceHelper.GetParameters(this.SpaceType, SpaceCodeEnterEntity.DisplayItem, Item.Self_File.ID);
                 ModelManage.Space_Service.Function_Invoke(SpaceCodeEnterEntity.DisplayItem, parameters, SpaceCodeEnterEntity.LoginUserName,
                                                           SpaceCodeEnterEntity.WebLoginPassword, SpaceCodeEnterEntity.UserDomain, new Action <Dictionary <string, object> >((dicResult) =>
                 {
                     SPItemEntity sPItemEntity = JsonManage.DictionaryToEntity <SPItemEntity>(dicResult, ',');
                     string uri = SpaceCodeEnterEntity.SPSiteAddressFront + sPItemEntity.FileRef;
                     //跨线程(异步委托)
                     this.Dispatcher.BeginInvoke(new Action(() =>
                     {
                         Item.Self_File.ServerRelativeUrl = uri;
                         Item.Uri = uri;
                     }));
                 }));
             }
         }
     }
     catch (Exception ex)
     {
         LogManage.WriteLog(this.GetType(), ex);
     }
     finally
     {
     }
 }
示例#5
0
        /// <summary>
        /// 选择器控制中心
        /// </summary>
        /// <param name="Item"></param>
        /// <param name="callBackType"></param>
        protected void ItemsSelectedEventCallBack(NavicateListView listView, SpaceListViewItem Item, CallBackType callBackType)
        {
            try
            {
                if (!listView.Items.Contains(Item))
                {
                    return;
                }

                switch (callBackType)
                {
                case CallBackType.OpenItem:
                    this.OpenItemWith(Item, callBackType);
                    break;

                case CallBackType.One_Selected:
                    this.SelectedDealWith(Item);
                    break;

                case CallBackType.One_UnSelected:
                    this.UnselectedDealWith(Item);
                    break;

                case CallBackType.KeDown:
                    this.KedownDealWidth(Item);
                    break;

                case CallBackType.Share:
                    this.ShareDealWidth(Item);
                    break;

                case CallBackType.Download:
                    this.DownloadWidth(Item);

                    break;

                case CallBackType.Delete:
                    this.DeleteWidth(Item, callBackType);
                    break;

                case CallBackType.ReName:
                    this.ReNameWidth(Item);
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
            finally
            {
            }
        }
示例#6
0
        /// <summary>
        /// 生成文件(realDisplay)
        /// </summary>
        /// <param name="folderList">文件夹目录</param>
        /// <param name="row1Height">行1高</param>
        /// <param name="fileHeigth">文件高</param>
        /// <param name="fileWidth">文件宽</param>
        private void DataLoad_File(List <SPVirtualFile> fileList)
        {
            try
            {
                //文件类型
                fileType file_Type = default(fileType);
                //生成文件(根据文件类型去匹配)
                foreach (var item in fileList)
                {
                    if (item.Name.Contains("."))
                    {
                        //文件类型
                        string extention = IOPath.GetExtension(item.Name);
                        //去掉点
                        extention = extention.Replace(".", string.Empty);

                        //文件名称
                        string fileName = IOPath.GetFileNameWithoutExtension(item.Name);

                        //转换为枚举
                        Enum.TryParse(extention, true, out file_Type);
                        //图片
                        string imageUri = null;
                        imageUri = SpaceCodeEnterEntity.extetionImageFolderName + extention + SpaceCodeEnterEntity.pictureExtension;

                        string imageUri_Small = null;
                        imageUri_Small = SpaceCodeEnterEntity.extetionImageFolderName_Small + extention + SpaceCodeEnterEntity.pictureExtension;

                        SpaceListViewItem listViewItem = new SpaceListViewItem(imageUri, ViewType)
                        {
                            Title      = fileName,
                            SpaceType  = this.SpaceType,
                            UpdateTime = item.UpdateTime,
                            BookType   = BookType.File,
                            FileType   = file_Type,
                            Self_File  = item,
                            ParentView = this.listView,
                        };
                        listViewItem.SetSmallImg(imageUri_Small);
                        listViewItem.SizeDisplay = FileManage.GetFileSize_MB_KB_Display(item.Length);;
                        //添加书
                        this.ItemsAdd(listViewItem);
                    }
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
            finally
            {
            }
        }
示例#7
0
        /// <summary>
        /// 打开文件(包括文件夹)
        /// </summary>
        /// <param name="spaceListViewItem"></param>
        protected void book_OpenFileEvent(SpaceListViewItem spaceListViewItem, Action <string, int, string> compleateCallBack)
        {
            try
            {
                switch (spaceListViewItem.BookType)
                {
                case BookType.File:

                    if (spaceListViewItem.Self_File != null)
                    {
                        if (string.IsNullOrEmpty(spaceListViewItem.Uri))
                        {
                            string parameters = SpaceHelper.GetParameters(this.SpaceType, SpaceCodeEnterEntity.DisplayItem, spaceListViewItem.Self_File.ID);
                            ModelManage.Space_Service.Function_Invoke(SpaceCodeEnterEntity.DisplayItem, parameters, SpaceCodeEnterEntity.LoginUserName,
                                                                      SpaceCodeEnterEntity.WebLoginPassword, SpaceCodeEnterEntity.UserDomain, new Action <Dictionary <string, object> >((dicResult) =>
                            {
                                SPItemEntity sPItemEntity = JsonManage.DictionaryToEntity <SPItemEntity>(dicResult, ',');
                                string uri = SpaceCodeEnterEntity.SPSiteAddressFront + sPItemEntity.FileRef;
                                //跨线程(异步委托)
                                this.Dispatcher.BeginInvoke(new Action(() =>
                                {
                                    spaceListViewItem.Self_File.ServerRelativeUrl = uri;
                                    spaceListViewItem.Uri = uri;
                                    //根据文件的类型使用相应的方式打开
                                    SpaceCodeEnterEntity.fileOpenManage.FileOpenByExtension((fileType)spaceListViewItem.FileType, spaceListViewItem.Uri);
                                }));
                            }));
                        }
                        else
                        {
                            //根据文件的类型使用相应的方式打开
                            SpaceCodeEnterEntity.fileOpenManage.FileOpenByExtension((fileType)spaceListViewItem.FileType, spaceListViewItem.Uri);
                        }
                    }
                    break;

                case BookType.Folder:
                    //打开文件夹
                    this.FolderOpen(spaceListViewItem, compleateCallBack);
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
        }
示例#8
0
        /// <summary>
        /// 生成文件夹
        /// </summary>
        /// <param name="folderList">文件夹目录</param>
        /// <param name="row1Height">行1高</param>
        /// <param name="fileHeigth">文件高</param>
        /// <param name="fileWidth">文件宽</param>
        private void DataLoad_Directory(List <SPVirtualFolder> folderList)
        {
            try
            {
                string folder_Img_Small = null;
                folder_Img_Small = SpaceCodeEnterEntity.folderPngUriPart_Small;

                string folder_Img = null;
                folder_Img = SpaceCodeEnterEntity.folderPngUriPart;



                //生成书本形式的文件夹
                foreach (var folderItem in folderList)
                {
                    SpaceListViewItem listViewItem = new SpaceListViewItem(folder_Img, ViewType)
                    {
                        Title               = folderItem.Name,
                        SpaceType           = this.SpaceType,
                        BookType            = BookType.Folder,
                        UpdateTime          = folderItem.UpdateTime,
                        Self_Folder         = folderItem,
                        SizeDisplay         = "-",
                        IsShowOperationIcon = false,
                        ParentView          = this.listView,
                    };
                    this.ItemsAdd(listViewItem);

                    listViewItem.SetSmallImg(folder_Img_Small);

                    //创建一个面包线(目前在这里创建和根面包线【书架自带】)
                    BreadLine breadLine = new BreadLine()
                    {
                        Folder = folderItem, Title = folderItem.Name
                    };
                    //关联指定生成的面包线()
                    listViewItem.BreadLine = breadLine;
                    //面包线点击事件
                    breadLine.LineClickEventCallBack = breadLine_LineClickEvent;
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
            finally
            {
            }
        }
示例#9
0
 /// <summary>
 /// 重命名
 /// </summary>
 /// <param name="Item"></param>
 protected void ReNameWidth(SpaceListViewItem Item)
 {
     try
     {
         Item.IsItemChecked = true;
         Item.IsRenameState = true;
     }
     catch (Exception ex)
     {
         LogManage.WriteLog(this.GetType(), ex);
     }
     finally
     {
     }
 }
示例#10
0
 /// <summary>
 /// 共享
 /// </summary>
 /// <param name="Item"></param>
 protected void ShareDealWidth(SpaceListViewItem Item)
 {
     try
     {
         Item.IsItemChecked = true;
         this.Resource_Share();
     }
     catch (Exception ex)
     {
         LogManage.WriteLog(this.GetType(), ex);
     }
     finally
     {
     }
 }
 /// <summary>
 /// 添加子项(先决条件:定位)
 /// </summary>
 public void ItemsAdd(SpaceListViewItem listViewItem)
 {
     try
     {
         this.listView.Items.Add(listViewItem);
         this.ListViewCollection.Add(listViewItem);
     }
     catch (Exception ex)
     {
         LogManage.WriteLog(this.GetType(), ex);
     }
     finally
     {
     }
 }
示例#12
0
        /// <summary>
        /// 打开文件夹
        /// </summary>
        protected void FolderOpen(SpaceListViewItem spaceListViewItem, Action <string, int, string> compleateCallBack)
        {
            try
            {
                if (this.currentBreadLine != null && spaceListViewItem.BreadLine != null)
                {
                    ////设置当前面包线的子节点(子面包线)
                    //this.currentBreadLine.BreadLineChild = null;

                    BreadLine line = spaceListViewItem.BreadLine;

                    //DependencyObject line_Parent = line.Parent;
                    //if (line_Parent != null && line_Parent is BreadLine)
                    //{
                    //    BreadLine lineParent = line_Parent as BreadLine;
                    //    lineParent.BreadLineChild = null;
                    //}

                    if (this.currentBreadLine != null)
                    {
                        //设置当前面包线的子节点(子面包线)
                        //this.Bread_LineRoot.BreadLineChild = line;

                        this.Bread_LineRoot.SettingLastLine(line);

                        //设置当前面包线
                        this.currentBreadLine = line;

                        if (this.currentBreadLine.Folder != null && this.currentBreadLine.Folder.ID > 0)
                        {
                            int    strItemID  = this.currentBreadLine.Folder.ID;
                            string parameters = SpaceHelper.GetParameters(this.SpaceType, SpaceCodeEnterEntity.GetCollection, strItemID);

                            if (compleateCallBack != null)
                            {
                                compleateCallBack(parameters, 0, null);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
        }
示例#13
0
        /// <summary>
        /// 确认键按下(重命名)
        /// </summary>
        /// <param name="Item"></param>
        protected void KedownDealWidth(SpaceListViewItem Item)
        {
            try
            {
                int ItemID = 0;
                switch (Item.BookType)
                {
                case BookType.File:
                    if (Item.Self_File != null)
                    {
                        ItemID = Item.Self_File.ID;
                    }
                    break;

                case BookType.Folder:
                    if (Item.Self_Folder != null)
                    {
                        ItemID = Item.Self_Folder.ID;
                    }
                    break;

                default:
                    break;
                }
                string parameters2 = SpaceHelper.GetParameters(this.SpaceType, SpaceCodeEnterEntity.ReName_Item, ItemID, new Dictionary <string, string>()
                {
                    { SpaceCodeEnterEntity.NewName, Item.Title }
                });
                ModelManage.Space_Service.Function_Invoke(SpaceCodeEnterEntity.ReName_Item, parameters2, SpaceCodeEnterEntity.LoginUserName,
                                                          SpaceCodeEnterEntity.WebLoginPassword, SpaceCodeEnterEntity.UserDomain, new Action <Dictionary <string, object> >((dicResult) =>
                {
                    //跨线程(异步委托)
                    this.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        Item.IsRenameState = false;
                    }));
                }));
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
            finally
            {
            }
        }
示例#14
0
 /// <summary>
 /// 下载子项
 /// </summary>
 /// <param name="Item"></param>
 protected void DownloadWidth(SpaceListViewItem Item)
 {
     try
     {
         this.GetItemUri(Item, new Action(() =>
         {
             this.Resource_DownLoad(Item);
         }));
     }
     catch (Exception ex)
     {
         LogManage.WriteLog(this.GetType(), ex);
     }
     finally
     {
     }
 }
示例#15
0
 /// <summary>
 /// 删除子项
 /// </summary>
 /// <param name="Item"></param>
 protected void DeleteWidth(SpaceListViewItem Item, CallBackType callBackType)
 {
     try
     {
         if (this.OperationCallBack != null)
         {
             this.OperationCallBack(Item, callBackType);
         }
     }
     catch (Exception ex)
     {
         LogManage.WriteLog(this.GetType(), ex);
     }
     finally
     {
     }
 }
        private void Operation_CallBack(SpaceListViewItem Item, CallBackType callBackType)
        {
            try
            {
                switch (callBackType)
                {
                case CallBackType.OpenItem:
                    this.book_OpenFileEvent(Item, this.LoadFolderCenter);
                    break;

                case CallBackType.One_Selected:
                    this.NavicateListView3.IsEnabled = true;
                    break;

                case CallBackType.All_Selected:
                    this.checkAll.IsChecked = true;

                    break;

                case CallBackType.One_UnSelected:
                    this.checkAll.IsChecked = false;
                    break;

                case CallBackType.All_UnSelected:
                    this.NavicateListView3.IsEnabled = false;
                    break;

                case CallBackType.Delete:
                    this.Resource_Delete(Item, this.ShowTip, this.LoadFolderCenter);
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(typeof(App), ex);
            }
            finally
            {
            }
        }
示例#17
0
        /// <summary>
        /// 资源下载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Resource_DownLoad(SpaceListViewItem item)
        {
            try
            {
                System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();

                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    if (item.BookType == BookType.File)
                    {
                        MainWindow._MainWindow.Open_DownLoad_View();
                        string fileNameAboutExtention = item.Title + "." + item.FileType;

                        DownLoadItem downLoadEntity = new DownLoadItem()
                        {
                            FileUri         = item.Uri,
                            FileName        = fileNameAboutExtention,
                            WebClientHelper = new WebClientManage(),
                            AllSize         = 100,
                            AllSize_MB      = item.SizeDisplay,
                            Style           = MainWindow.DownLoad_Item_Style,
                            Length          = item.Self_File.Length
                        };

                        MainWindow._MainWindow.DownLoad_Items_Add(downLoadEntity);
                        MainWindow._MainWindow.Begin_Resource_DownLoad(dialog.SelectedPath);
                    }
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
            finally
            {
            }
        }
        /// <summary>
        /// 生成文件
        /// </summary>
        private void DataLoad_File(SPItemEntity sPVirtualFile)
        {
            try
            {
                //等待提示
                //this.ShowTip();
                SPVirtualFile file = new SPVirtualFile()
                {
                    ID   = Convert.ToInt32(sPVirtualFile.ID),
                    Name = sPVirtualFile.LinkFilename,
                };
                long length;
                bool isSuccessed = long.TryParse(sPVirtualFile.FileSizeDisplay, out length);
                if (isSuccessed)
                {
                    file.Length = length;
                }

                //文件类型
                fileType file_Type = default(fileType);

                if (file.Name.Contains("."))
                {
                    //文件类型
                    string extention = IOPath.GetExtension(file.Name);
                    //去掉点
                    extention = extention.Replace(".", string.Empty);

                    //文件名称
                    string fileName = IOPath.GetFileNameWithoutExtension(file.Name);

                    //转换为枚举
                    Enum.TryParse(extention, true, out file_Type);


                    //图片
                    string imageUri = null;
                    imageUri = SpaceCodeEnterEntity.extetionImageFolderName + extention + SpaceCodeEnterEntity.pictureExtension;

                    string imageUri_Small = null;
                    imageUri_Small = SpaceCodeEnterEntity.extetionImageFolderName_Small + extention + SpaceCodeEnterEntity.pictureExtension;


                    SpaceListViewItem listViewItem = new SpaceListViewItem(imageUri, ViewType)
                    {
                        Title      = fileName,
                        SpaceType  = this.SpaceType,
                        BookType   = BookType.File,
                        FileType   = file_Type,
                        Self_File  = file,
                        ParentView = this.listView,
                    };
                    listViewItem.SetSmallImg(imageUri_Small);
                    listViewItem.SizeDisplay = FileManage.GetFileSize_MB_KB_Display(file.Length);

                    DateTime dateTime;
                    bool     isSuccessed_1 = DateTime.TryParse(sPVirtualFile.Modified, out dateTime);
                    if (isSuccessed_1)
                    {
                        listViewItem.UpdateTime = dateTime;
                    }

                    //添加书
                    this.ItemsAdd(listViewItem);
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
            finally
            {
            }
        }
        void NavicateListView1_Naivcate_SelectionChanged(NavicateListView listView, NavicateListViewItem listViewItem)
        {
            try
            {
                if (listView.SelectedIndex == -1)
                {
                    return;
                }

                switch (listViewItem.NavicateType)
                {
                case NavicateType.Resource_Upload:
                    this.Resource_Upload(this.ShowTip, this.LoadFolderCenter);
                    this.SpaceInit();
                    break;

                case NavicateType.Resource_Share:
                    this.Resource_Share();
                    break;

                case NavicateType.Resource_DownLoad:
                    this.Resource_DownLoad();
                    break;

                case NavicateType.Resource_Delete:
                    this.Resource_Delete(this.ShowTip, null);
                    this.SpaceInit();
                    break;

                case NavicateType.Resource_Remove:
                    break;

                case NavicateType.Resource_Rename:
                    if (SpaceListViewItemList.Count > 0)
                    {
                        SpaceListViewItem item = SpaceListViewItemList[SpaceListViewItemList.Count - 1];
                        item.IsRenameState = true;
                    }
                    break;

                case NavicateType.List_View:
                    this.Item_ListView.BG_Brush    = this.Item_ListView.BG_SelectBrush;
                    this.Item_PcitureView.BG_Brush = this.Item_PcitureView.BG_UnSelectBrush;
                    this.ViewSetting(viewType.ListView, this.listView);


                    break;

                case NavicateType.Picture_View:
                    this.Item_PcitureView.BG_Brush = this.Item_PcitureView.BG_SelectBrush;
                    this.Item_ListView.BG_Brush    = this.Item_ListView.BG_UnSelectBrush;
                    this.ViewSetting(viewType.PictureView, this.listView);

                    break;

                default:
                    break;
                }

                switch (listView.AreaType)
                {
                case AreaType.NormalButton:
                    listView.SelectedIndex = -1;
                    break;

                case AreaType.NavicateType:

                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
            finally
            {
            }
        }