Exemplo n.º 1
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
     {
     }
 }
Exemplo n.º 2
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);
            }
        }