Beispiel #1
0
 private void listView1_DragLeave(object sender, EventArgs e)
 {
     if (this.listView1.SelectedItems != null)
     {
         foreach (ListViewItem litem in this.listView1.SelectedItems)
         {
             SRRC_ResourceEntity ent = litem.Tag as SRRC_ResourceEntity;
             Int32 ires = SROperation.Instance.CenterLanZhiTemp_Remove(ent.Id);
             litem.Remove();
         }
     }
 }
Beispiel #2
0
 private void listView1_Click(object sender, EventArgs e)
 {
     if (OnPageClicked != null)
     {
         SRRC_ResourceEntity ent = this.listView1.SelectedItems[0].Tag as SRRC_ResourceEntity;
         int index = this.listView1.Items.IndexOf(this.listView1.SelectedItems[0]);
         OnPageClicked(sender, new MyEventArgs()
         {
             Action = 1
         });                                                     //把按钮自身作为参数传递
         OnPageClicked(sender, new MyEventArgs()
         {
             Action = 16, Parameter = ent.Serverip + ent.Path + "|" + index + "|" + ent.Id
         });                                                                                                                        //把按钮自身作为参数传递
     }
 }
Beispiel #3
0
 private void  一张ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     //this.center2_11_OnPageClicked(sender, new MyEventArgs() { Action = 12 });
     index++;
     if (recEntList.Count > index)
     {
         SRRC_ResourceEntity ent = recEntList[index];
         this.PicId = ent.Id;
         this.inPutBuffer(ent.Serverip + ent.Path, 0);
         //this.center2_11.SetSelectedState(index);
         this.right1.SetBiaoJiStatusByString(this.PicId.ToString());
     }
     else
     {
         index = recEntList.Count - 1;
         MessageBox.Show("已是最后一张");
     }
 }
Beispiel #4
0
        public void BindData(int picId)
        {
            this.label2.Text = Param.UserEnt.Loginname;
            string strText = "";

            SRRC_ResourceEntity ent = DataBase.Instance.tSRRC_Resource.Get_Entity(picId);

            if (ent == null)
            {
                return;
            }

            strText += String.Format(" {0} | {1} | {2}KB,Modify Date:{3} | {4} ",
                                     ent.Extend1, ent.Name,
                                     (ent.Filesize / 1024).ToString("F1"),
                                     ent.Addtime, ent.Extend2
                                     );

            this.label1.Text = strText;
        }
Beispiel #5
0
        internal void AddPic(SRRC_ResourceEntity item)
        {
            ListViewItem litem = new ListViewItem();

            if (item.Dtype == 0)//文件夹
            {
                litem.ImageKey = "folder";
            }
            else if (item.Dtype == 1)//图片
            {
                litem.ImageKey = "image";
            }
            else
            {
                litem.ImageKey = item.Extend1.ToLower();
            }
            litem.Name = item.Id.ToString();
            litem.Text = item.Name;
            litem.Tag  = item;
            this.listView1.Items.Add(litem);
        }
Beispiel #6
0
        void SetAddress(String strAddress, SRRC_ResourceEntity resEnt)
        {
            this.panel2.Controls.Clear();
            if (SROperation2.Instance.FocusPanel == "Left")
            {
                String[] arrls = strAddress.TrimStart('\\').TrimStart('\\').Split(new char[] { '\\' });
                Int32    index = 0;
                foreach (var item in arrls)
                {
                    if (String.IsNullOrEmpty(item) == false)
                    {
                        PictureBox pic = new PictureBox();
                        pic.Image    = SirdRoom.ManageSystem.ClientApplication.Properties.Resources.Tool_Address;
                        pic.Size     = new Size(12, 15);
                        pic.Location = new Point(index, 3);
                        this.panel2.Controls.Add(pic);

                        Label lbl = new Label();
                        lbl.Text      = item;
                        lbl.AutoSize  = false;
                        lbl.Size      = new Size(lbl.Text.Length * 16, 15);
                        lbl.Location  = new Point(index + 15 + 3, 3);
                        lbl.ForeColor = Color.White;
                        this.panel2.Controls.Add(lbl);

                        index = lbl.Location.X + lbl.Width + 3;
                    }
                }
            }

            //显示加载信息
            Label lbl1 = new Label();

            lbl1.Text      = "共" + SROperation2.Instance.entListCount + "项";
            lbl1.AutoSize  = false;
            lbl1.Size      = new Size(lbl1.Text.Length * 16, 15);
            lbl1.Location  = new Point(panel2.Width - lbl1.Width, 3);
            lbl1.ForeColor = Color.White;
            this.panel2.Controls.Add(lbl1);
        }
Beispiel #7
0
        /// <summary>
        /// 选中与否
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            SRRC_ResourceEntity ent = this.Tag as SRRC_ResourceEntity;

            if (this.BackColor == Color.FromArgb(57, 57, 57))//未选中
            {
                this.BackColor = Color.FromArgb(77, 77, 77);
                SROperation2.Instance.PicSelected_Add(ent.Id);
            }
            else
            {
                this.BackColor = Color.FromArgb(57, 57, 57);
                SROperation2.Instance.PicSelected_Remove(ent.Id);
            }
            if (OnPageClick != null)
            {
                OnPageClick(sender, new MyEventArgs()
                {
                    Action = 0, Parameter = this.Tag
                });
            }
        }
Beispiel #8
0
 public void SetData(SRRC_ResourceEntity ent)
 {
     this.label1.Text       = ent.Extend1;
     this.label2.Text       = ent.Name;
     this.pictureBox1.Image = Image.FromFile(ent.Serverip + ent.Path);
 }
Beispiel #9
0
        void center2_11_OnPageClicked(object sender, MyEventArgs e)
        {
            switch (e.Action)
            {
            case 11:
            {
                index--;
                //if (index < 0)
                //    index = 0;
                if (index >= 0)
                {
                    SRRC_ResourceEntity ent = lvic[index].Tag as SRRC_ResourceEntity;
                    this.PicId = ent.Id;
                    this.inPutBuffer(ent.Serverip + ent.Path, 0);
                    this.center2_11.SetSelectedState(index);
                    this.right1.SetBiaoJiStatusByString(this.PicId.ToString());
                }
                else
                {
                    index = 0;
                    MessageBox.Show("已是第一张");
                }
            }
            break;

            case 12:
            {
                index++;
                if (lvic.Count > index)
                {
                    SRRC_ResourceEntity ent = lvic[index].Tag as SRRC_ResourceEntity;
                    this.PicId = ent.Id;
                    this.inPutBuffer(ent.Serverip + ent.Path, 0);
                    this.center2_11.SetSelectedState(index);
                    this.right1.SetBiaoJiStatusByString(this.PicId.ToString());
                }
                else
                {
                    index = lvic.Count - 1;
                    MessageBox.Show("已是最后一张");
                }
            }
            break;

            case 13:
            {
                this.inPutBuffer(strPic, -1);
            }
            break;

            case 14:
            {
                this.inPutBuffer(strPic, 0);
            }
            break;

            case 15:
            {
                this.inPutBuffer(strPic, 0);
            }
            break;

            case 16:    //显示图片
            {
                if (String.IsNullOrEmpty(e.Parameter.ToString()) == false)
                {
                    //1:1显示
                    String[] arrls = e.Parameter.ToString().Split(new char[] { '|' });
                    index = SRLibFun.StringConvertToInt32(arrls[1]);
                    PicId = SRLibFun.StringConvertToInt32(arrls[2]);
                    inPutBuffer(arrls[0], 0);
                    this.right1.SetBiaoJiStatusByString(this.PicId.ToString());
                }
            }
            break;

            default:
                break;
            }
        }
Beispiel #10
0
        private void  制到指定目录ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SR_UserEntity userEnt = DataBase.Instance.tSR_User.Get_Entity(Param.UserId);

            if (userEnt == null || String.IsNullOrEmpty(userEnt.Companyname) == true)
            {
                MessageBox.Show("未设置路径!");
                return;
            }
            using (new IdentityScope(Param.ServerIP.Description,
                                     Param.ServerIP.Remark,
                                     Param.ServerIP.Title))
            {
                SRRC_ResourceEntity item = DataBase.Instance.tSRRC_Resource.Get_Entity(this.PicId);
                if (item == null)
                {
                    return;
                }
                string path = "";
                if (item.Iscomposite)//复合文件
                {
                    var temp = DataBase.Instance.tSRRC_Resource.Get_Entity(item.Pid);
                    path = temp.Serverip + temp.Path;
                }
                else
                {
                    path = item.Serverip + item.Path;
                }

                SROperation2.Instance.isLoading = true;
                int totalCount = 0;
                if (Directory.Exists(path))
                {//文件夹
                    totalCount += Directory.GetFiles(path, "*.*", SearchOption.AllDirectories).Length;
                }
                else if (File.Exists(path))
                {
                    //文件
                    totalCount++;
                }

                SROperation2.Instance.entListCount      = totalCount;
                SROperation2.Instance.entListReadyCount = 0;
                Thread t = new Thread(new ThreadStart(SetWaitPic));
                t.Start();

                //先复制文件
                if (Directory.Exists(path))
                {//文件夹
                    string destPath = userEnt.Companyname.TrimEnd('\\') + "\\" + new DirectoryInfo(path).Name;
                    if (!Directory.Exists(destPath))
                    {
                        Directory.CreateDirectory(destPath);
                    }
                    else
                    {
                        Directory.Delete(destPath, true);
                        Directory.CreateDirectory(destPath);
                    }
                    this.copyDirectory(path, destPath);
                }
                else if (File.Exists(path))
                {
                    //文件
                    File.Copy(path, userEnt.Companyname.TrimEnd('\\') + "\\" + new FileInfo(path).Name, true);
                    ++SROperation2.Instance.entListReadyCount;
                }
            }
            SROperation2.Instance.isLoading = false;
            MessageBox.Show("复制完成!");
        }
Beispiel #11
0
        internal void BindData()
        {
            if (Param.GroupId > 1)
            {
                this.toolStripButton1.Visible = false;
            }
            //排序按钮
            //重置排序
            {
                p4.Checked = false;
                p5.Checked = false;
                p6.Checked = false;
                p7.Checked = false;
                p8.Checked = false;
            }
            switch (SROperation.Instance.Orderby)
            {
            case 5:
            {
                // p8.Image = global::SirdRoom.ManageSystem.ClientApplication.Properties.Resources.ResourceManager.GetObject("_8_1") as Image;
                p8.Checked = true;
            }
            break;

            case 2:
            {
                // p5.Image = global::SirdRoom.ManageSystem.ClientApplication.Properties.Resources.ResourceManager.GetObject("_5_1") as Image;
                p5.Checked = true;
            }
            break;

            case 3:
            {
                //  p6.Image = global::SirdRoom.ManageSystem.ClientApplication.Properties.Resources.ResourceManager.GetObject("_6_1") as Image;
                p6.Checked = true;
            }
            break;

            case 4:
            {
                //  p7.Image = global::SirdRoom.ManageSystem.ClientApplication.Properties.Resources.ResourceManager.GetObject("_7_1") as Image;
                p7.Checked = true;
            }
            break;

            case 1:
            default:
            {
                // p4.Image = global::SirdRoom.ManageSystem.ClientApplication.Properties.Resources.ResourceManager.GetObject("_4_1") as Image;
                p4.Checked = true;
            }
            break;
            }
            //ordertype
            {
                this.递增ToolStripMenuItem.Checked = false;
                this.递减ToolStripMenuItem.Checked = false;
            }
            if (SROperation.Instance.OrderType == 0)
            {
                this.递增ToolStripMenuItem.Checked = true;
            }
            else if (SROperation.Instance.OrderType == 1)
            {
                this.递减ToolStripMenuItem.Checked = true;
            }
            //只显示
            if (SROperation.Instance.OnlyShow)
            {
                p14.Image = global::SirdRoom.ManageSystem.ClientApplication.Properties.Resources._14_2;
            }

            //查询关键字
            this.txtQuery.Text = SROperation.Instance.Keyword;
            String strPath = "";
            SRRC_ResourceEntity      resEnt  = DataBase.Instance.tSRRC_Resource.Get_Entity(SROperation.Instance.LeftSelectedId);
            List <SRRC_BiaojiEntity> entList = null;

            switch (SROperation.Instance.LeftDtype)
            {
            case "Resources":
            {
                if (resEnt != null)
                {
                    strPath = resEnt.Path;
                    string sharedName = resEnt.Serverip.Substring(resEnt.Serverip.LastIndexOf('\\'));
                    strPath = sharedName + "\\" + strPath;
                }
            }
            break;

            case "Study":
            {
                entList = DataBase.Instance.tSRRC_Biaoji.Get_EntityCollection(null, " User_id=0 ");
                if (entList != null)
                {
                    this.AddData(entList, SROperation.Instance.LeftSelectedId, ref strPath);
                }
            }
            break;

            case "Favorites":
            {
                entList = DataBase.Instance.tSRRC_Biaoji.Get_EntityCollection(null, " User_id=" + Param.UserId + " ");
                if (entList != null)
                {
                    this.AddData(entList, SROperation.Instance.LeftSelectedId, ref strPath);
                }
            }
            break;

            default:
                break;
            }
            this.strAddress = strPath;
            if (resEnt != null)
            {
                this.panel2.Controls.Clear();
                Label lbl = new Label();
                lbl.Text      = "正在加载请稍等...";
                lbl.AutoSize  = false;
                lbl.Size      = new Size(lbl.Text.Length * 16, 15);
                lbl.Location  = new Point(0, 3);
                lbl.ForeColor = Color.White;
                this.panel2.Controls.Add(lbl);
            }
            else
            {
                this.SetAddress();
            }
        }
Beispiel #12
0
        private void Copy(SRRC_ResourceEntity parentEnt, string[] files, ref int count)
        {
            foreach (string file in files)
            {
                if (File.Exists(file)) //判断是否是文件
                {
                    try
                    {
                        CopyFile(parentEnt, file, ref count);
                    }
                    catch
                    {
                        uploadFailFile.AppendFormat(file + @"\r\n");
                        SRLogHelper.Instance.AddLog("异常", "上传文件", "文件", file);
                    }
                }
                else
                {
                    try
                    {
                        //文件夹
                        DirectoryInfo di = new DirectoryInfo(file);
                        string path = parentEnt.Path + "\\" + di.Name;
                        SRRC_ResourceEntity ent = DataBase.Instance.tSRRC_Resource.Get_Entity("ServerIP=[$ip$] and Path=[$path$]"
                      , new DataParameter("ip", parentEnt.Serverip)
                      , new DataParameter("path", path));
                        if (ent == null)
                        {
                            Directory.CreateDirectory(parentEnt.Serverip + path);
                            Directory.CreateDirectory(parentEnt.Serverip.Replace(Param.IP, Param.IP + "\\Cache") + path);
                            string code = Guid.NewGuid().ToString();
                            ent = new SRRC_ResourceEntity()
                            {
                                Addtime = DateTime.Now,
                                Pid = parentEnt.Id,
                                Name = di.Name,
                                Dtype = 0,
                                Serverip = parentEnt.Serverip,
                                Path = path,
                                Code = code
                            };
                            DataBase.Instance.tSRRC_Resource.Add(ent);
                            ent = DataBase.Instance.tSRRC_Resource.Get_Entity(code);
                        }
                        Copy(ent, Directory.GetFiles(file).Concat(Directory.GetDirectories(file)).ToArray(), ref count);

                    }
                    catch (Exception ex)
                    {
                        SRLogHelper.Instance.AddLog("异常", "上传文件", "文件夹", ex.Message);
                    }
                }
            }
        }
Beispiel #13
0
        /// <summary>
        /// 复制单个文件
        /// </summary>
        /// <param name="parentEnt">目录</param>
        /// <param name="file">要复制的文件名</param>
        /// <param name="count">当前已复制的个数</param>
        private void CopyFile(SRRC_ResourceEntity parentEnt,string file,ref int count)
        {
            SRRC_ResourceEntity ent;
            FileInfo fi = new FileInfo(file);
            string name = fi.Name;
            if (name == "Thumbs.db") return;
            string path = parentEnt.Path + "\\" + name;
            int type = 2;//文件类型,2,非图片
            int width = 0;
            int height = 0;
            //复制
            File.Copy(file, parentEnt.Serverip + path, true);

            //图片生成缩略图,删除本地缓存
            if(SRConfig.Instance.GetAppString("ImageExt").Contains(fi.Extension.Trim('.').ToLower()))
            {
                type = 1;
                using (new IdentityScope(Param.ServerIP.Description,Param.ServerIP.Remark,Param.ServerIP.Title))
                {
                    SirdRoom.ManageSystem.Library.Common.Image.ImageOperation.CreateThumb(
                          parentEnt.Serverip + path
                          , parentEnt.Serverip.Replace(Param.IP, Param.ServerCacheIP.Trim('\\')) + path
                          , ThumbWidth, ThumbHeight);
                }

                Image im = Bitmap.FromFile(file);
                width = im.Width;
                height = im.Height;
            }

            ent = DataBase.Instance.tSRRC_Resource.Get_Entity("ServerIP=[$ip$] and Path=[$path$]"
                , new DataParameter("ip", parentEnt.Serverip)
                , new DataParameter("path", path));
            if(ent == null)
            {
                //新增
                ent = new SRRC_ResourceEntity()
                {
                    Addtime = DateTime.Now,
                    Pid = parentEnt.Id,
                    Name = fi.Name,
                    Dtype=type,
                    Serverip = parentEnt.Serverip,
                    Path=path,
                    Extend1 = fi.Extension.Trim('.'),
                    Extend2 = type == 1? width + "*" + height:"",
                    Filesize = fi.Length
                };
                DataBase.Instance.tSRRC_Resource.Add(ent);
            }
            else
            {
                //替换
                ent.Addtime = DateTime.Now;
                ent.Extend2 = type == 1 ? width + "*" + height : "";
                ent.Filesize = fi.Length;
                DataBase.Instance.tSRRC_Resource.Update(ent);
            }
            BgWorker.ReportProgress(++count * 100 / countSum);
        }
Beispiel #14
0
        private void ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem obj = sender as ToolStripMenuItem;

            if (obj != null && OnPageClicked != null)
            {
                switch (obj.Text)
                {
                case "选择全部":
                {
                    if (this.listView1.Items != null)
                    {
                        foreach (ListViewItem litem in this.listView1.Items)
                        {
                            litem.Selected = true;
                        }
                    }
                }
                break;

                case "清除选择":
                {
                    if (this.listView1.SelectedItems != null && this.listView1.SelectedItems.Count > 0)
                    {
                        var lst = faTabStrip1.SelectedItem.Tag as List <SRRC_ResourceEntity>;
                        foreach (ListViewItem litem in this.listView1.SelectedItems)
                        {
                            SRRC_ResourceEntity ent = litem.Tag as SRRC_ResourceEntity;

                            SROperation2.Instance.Center2ImageDict.Remove(ent.Id.ToString());
                            litem.Remove();
                            lst.Remove(ent);
                        }
                        updateTabItem(faTabStrip1.SelectedItem);
                    }
                }
                break;

                case "清除所有":
                {
                    this.listView1.Items.Clear();
                    faTabStrip1.SelectedItem.Tag = new List <SRRC_ResourceEntity>();
                    updateTabItem(faTabStrip1.SelectedItem);
                }
                break;

                case "复制到指定目录":
                case "跳转到资源目录":
                {
                    SROperation2.Instance.Center2PicSelected.Clear();
                    if (this.listView1.SelectedItems != null)
                    {
                        foreach (ListViewItem litem in this.listView1.SelectedItems)
                        {
                            SROperation2.Instance.Center2PicSelected.Add(litem.Tag as SRRC_ResourceEntity);
                        }
                        OnPageClicked(sender, new MyEventArgs()
                            {
                                Action = 6, Parameter = sender
                            });                                                                             //把按钮自身作为参数传递
                    }
                }
                break;

                case "添加到ImageBasket":
                {
                    var lst = faTabStrip1.SelectedItem.Tag as List <SRRC_ResourceEntity>;
                    for (int i = 0; i < faTabStrip1.Items.Count; i++)
                    {
                        var item = faTabStrip1.Items[i];
                        if (item.CanClose == false && item.Title == "Image Basket")
                        {
                            var newList = item.Tag as List <SRRC_ResourceEntity>;
                            foreach (var ent in lst)
                            {
                                if (newList.Any(r => r.Id == ent.Id))
                                {
                                    continue;
                                }
                                newList.Add(ent);
                            }
                            item.Tag = newList;
                            updateTabItem(item);
                            break;
                        }
                    }
                }
                break;
                }
            }
        }
Beispiel #15
0
        internal void BindData()
        {
            //排序按钮
            switch (SROperation.Instance.Orderby)
            {
            case 5:
            {
                p8.Image = global::SirdRoom.ManageSystem.ClientApplication.Properties.Resources.ResourceManager.GetObject("_8_1") as Image;
            }
            break;

            case 2:
            {
                p5.Image = global::SirdRoom.ManageSystem.ClientApplication.Properties.Resources.ResourceManager.GetObject("_5_1") as Image;
            }
            break;

            case 3:
            {
                p6.Image = global::SirdRoom.ManageSystem.ClientApplication.Properties.Resources.ResourceManager.GetObject("_6_1") as Image;
            }
            break;

            case 4:
            {
                p7.Image = global::SirdRoom.ManageSystem.ClientApplication.Properties.Resources.ResourceManager.GetObject("_7_1") as Image;
            }
            break;

            case 1:
            default:
            {
                p4.Image = global::SirdRoom.ManageSystem.ClientApplication.Properties.Resources.ResourceManager.GetObject("_4_1") as Image;
            }
            break;
            }

            //只显示
            if (SROperation.Instance.OnlyShow)
            {
                p14.Image = global::SirdRoom.ManageSystem.ClientApplication.Properties.Resources._14_2;
            }

            //查询关键字
            this.txtQuery.Text = SROperation.Instance.Keyword;
            String strPath             = "";
            SRRC_ResourceEntity resEnt = DataBase.Instance.tSRRC_Resource.Get_Entity(SROperation.Instance.LeftSelectedId);

            switch (SROperation.Instance.LeftDtype)
            {
            case "Resources":
            {
                if (resEnt != null)
                {
                    strPath = resEnt.Path;
                    string sharedName = resEnt.Serverip.Substring(resEnt.Serverip.LastIndexOf('\\'));
                    strPath = sharedName + "\\" + strPath;
                }
            }
            break;

            case "Study":
            {
                List <SRRC_BiaojiEntity> entList = DataBase.Instance.tSRRC_Biaoji.Get_EntityCollection(null, " User_id=0 ");
                if (entList != null)
                {
                    this.AddData(entList, SROperation.Instance.LeftSelectedId, ref strPath);
                }
            }
            break;

            case "Favorites":
            {
                List <SRRC_BiaojiEntity> entList = DataBase.Instance.tSRRC_Biaoji.Get_EntityCollection(null, " User_id=" + Param.UserId + " ");
                if (entList != null)
                {
                    this.AddData(entList, SROperation.Instance.LeftSelectedId, ref strPath);
                }
            }
            break;

            default:
                break;
            }

            this.SetAddress(strPath, resEnt);
        }
Beispiel #16
0
        private void listView1_ItemDrag(object sender, ItemDragEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                List <string> list = new List <string>();
                foreach (ListViewItem lvi in this.listView1.SelectedItems)
                {
                    SRRC_ResourceEntity ent = lvi.Tag as SRRC_ResourceEntity;
                    string path             = "";
                    if (ent.Iscomposite) //复合文件
                    {
                        var item = DataBase.Instance.tSRRC_Resource.Get_Entity(ent.Pid);
                        if (item == null)
                        {
                            continue;
                        }
                        item.Usecount++;
                        DataBase.Instance.tSRRC_Resource.Update(item);

                        List <SRRC_ResourceEntity> maxEntList = DataBase.Instance.tSRRC_Resource.Get_EntityCollection(null, "pid in (select Id from SRRC_Resource where pid=[$pid$] and Dtype=0) and lower(Extend1)=[$extend1$]", new DataParameter("pid", item.Id), new DataParameter("extend1", "max"));
                        if (maxEntList == null || maxEntList.Count == 0)
                        {
                            MessageBox.Show(string.Format("{0}复合文件无MAX文件,请修改!", item.Name.Substring(0, item.Name.LastIndexOf('.'))));
                            return;
                        }
                        else if (maxEntList.Count > 1)
                        {
                            MessageBox.Show(string.Format("{0}复合文件有{1}个MAX文件,请修改!", item.Name.Substring(0, item.Name.LastIndexOf('.')), maxEntList.Count));
                            return;
                        }
                        else
                        {
                            var maxEnt = maxEntList.First();
                            path = maxEnt.Serverip + maxEnt.Path;
                        }
                    }
                    else
                    {
                        path = ent.Serverip + ent.Path;
                    }
                    ent.Usecount++;
                    DataBase.Instance.tSRRC_Resource.Update(ent);
                    if (path != "" && !list.Contains(path))
                    {
                        list.Add(path);
                    }
                }

                if (list.Count > 0)
                {
                    (this.TopLevelControl as FrmFrame).WindowState = FormWindowState.Minimized;
                    //Thread t = new Thread(new ThreadStart(ProcessHelper.AddAndDelNetUse));
                    //t.Start();
                    IDataObject poj = new DataObject(DataFormats.FileDrop, list.ToArray());
                    poj.SetData(poj);
                    this.listView1.DoDragDrop(poj, DragDropEffects.Copy);
                }
            }
            else
            {
                this.listView1.DoDragDrop(this.listView1.SelectedItems, DragDropEffects.Move);
            }
        }
Beispiel #17
0
 internal void AddPic(SRRC_ResourceEntity item)
 {
     ListViewItem litem = new ListViewItem();
     if (item.Dtype == 0)//文件夹
     {
         litem.ImageKey = "folder";
     }
     else if (item.Dtype == 1)//图片
     {
         litem.ImageKey = "image";
     }
     else
     {
         litem.ImageKey = item.Extend1.ToLower();
     }
     litem.Name = item.Id.ToString();
     litem.Text = item.Name;
     litem.Tag = item;
     this.listView1.Items.Add(litem);
 }
Beispiel #18
0
        private void ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem obj = sender as ToolStripMenuItem;

            if (obj != null && OnPageClicked != null)
            {
                switch (obj.Text)
                {
                case "选择全部":
                {
                    if (this.listView1.Items != null)
                    {
                        foreach (ListViewItem litem in this.listView1.Items)
                        {
                            litem.Selected = true;
                        }
                    }
                }
                break;

                case "清除选择":
                {
                    if (this.listView1.SelectedItems != null && this.listView1.SelectedItems.Count > 0)
                    {
                        foreach (ListViewItem litem in this.listView1.SelectedItems)
                        {
                            SRRC_ResourceEntity ent = litem.Tag as SRRC_ResourceEntity;
                            if (isTemp)
                            {
                                Int32 ires = SROperation.Instance.CenterLanZhiTemp_Remove(ent.Id);
                            }
                            else
                            {
                                Int32 ires = SROperation.Instance.CenterLanZhi_Remove(ent.Id);
                            }
                            SROperation2.Instance.Center2ImageDict.Remove(ent.Id.ToString());
                            litem.Remove();
                        }
                    }
                }
                break;

                case "清除所有":
                {
                    this.listView1.Items.Clear();
                    if (isTemp)
                    {
                        SROperation.Instance.CenterLanZhiTemp = "";
                    }
                    else
                    {
                        SROperation.Instance.CenterLanZhi = "";
                    }
                }
                break;

                case "复制到指定目录":
                case "跳转到资源目录":
                {
                    SROperation2.Instance.Center2PicSelected.Clear();
                    if (this.listView1.SelectedItems != null)
                    {
                        foreach (ListViewItem litem in this.listView1.SelectedItems)
                        {
                            SROperation2.Instance.Center2PicSelected.Add(litem.Tag as SRRC_ResourceEntity);
                        }
                        OnPageClicked(sender, new MyEventArgs()
                            {
                                Action = 6, Parameter = sender
                            });                                                                             //把按钮自身作为参数传递
                    }
                }
                break;
                }
            }
        }
Beispiel #19
0
        private void listView1_DragLeave(object sender, EventArgs e)
        {
            if (this.listView1.SelectedItems == null || this.listView1.SelectedItems.Count == 0)
            {
                return;
            }
            Point pt        = this.listView1.PointToClient(MousePosition);
            bool  isMouseIn = this.listView1.Bounds.Contains(pt);

            if (!isMouseIn)
            {
                List <string> list = new List <string>();
                foreach (ListViewItem lvi in this.listView1.SelectedItems)
                {
                    SRRC_ResourceEntity ent = lvi.Tag as SRRC_ResourceEntity;
                    string path             = "";
                    if (ent.Iscomposite) //复合文件
                    {
                        var item = DataBase.Instance.tSRRC_Resource.Get_Entity(ent.Pid);
                        if (item == null)
                        {
                            continue;
                        }
                        item.Usecount++;
                        DataBase.Instance.tSRRC_Resource.Update(item);
                        if (this._mouseDown == System.Windows.Forms.MouseButtons.Left)
                        {
                            path = item.Serverip + item.Path;
                        }
                        else if (this._mouseDown == System.Windows.Forms.MouseButtons.Right)
                        {
                            List <SRRC_ResourceEntity> maxEntList = DataBase.Instance.tSRRC_Resource.Get_EntityCollection(null, "pid=[$pid$] and lower(Extend1)=[$extend1$]", new DataParameter("pid", item.Pid), new DataParameter("extend1", "max"));
                            if (maxEntList == null || maxEntList.Count == 0)
                            {
                                MessageBox.Show(string.Format("{0}复合文件无MAX文件,请修改!", item.Name.Substring(0, item.Name.LastIndexOf('.'))));
                                return;
                            }
                            else if (maxEntList.Count > 1)
                            {
                                MessageBox.Show(string.Format("{0}复合文件有{1}个MAX文件,请修改!", item.Name.Substring(0, item.Name.LastIndexOf('.')), maxEntList.Count));
                                return;
                            }
                            else
                            {
                                var maxEnt = maxEntList.First();
                                path = maxEnt.Serverip + maxEnt.Path;
                            }
                        }
                    }
                    else
                    {
                        path = ent.Serverip + ent.Path;
                    }
                    ent.Usecount++;
                    DataBase.Instance.tSRRC_Resource.Update(ent);
                    if (path != "" && !list.Contains(path))
                    {
                        list.Add(path);
                    }
                }

                if (list.Count > 0)
                {
                    //Thread t = new Thread(new ThreadStart(ProcessHelper.AddAndDelNetUse));
                    //t.Start();
                    IDataObject poj = new DataObject(DataFormats.FileDrop, list.ToArray());
                    poj.SetData(poj);
                    this.listView1.DoDragDrop(poj, DragDropEffects.Copy);
                }
            }
        }
Beispiel #20
0
 public void SetData(SRRC_ResourceEntity ent)
 {
     this.label1.Text = ent.Extend1;
     this.label2.Text = ent.Name;
     this.pictureBox1.Image = Image.FromFile(ent.Serverip + ent.Path);
 }
Beispiel #21
0
        private void listView1_DrawItem(object sender, DrawListViewItemEventArgs e)
        {
            string imageKey         = e.Item.ImageKey;
            SRRC_ResourceEntity ent = e.Item.Tag as SRRC_ResourceEntity;

            if (imageKey == "image" && !waitLoadImageId.Contains(ent.Id.ToString()) && !SROperation2.Instance.Center2_1ImageDict.ContainsKey(ent.Id.ToString()))
            {
                //图片,未加载
                waitLoadImageId.Add(ent.Id.ToString());
                //Thread t = new Thread(new ParameterizedThreadStart(DownLoadImage));
                //t.Start(new string[] { ent.Id.ToString(), ent.Serverip.Replace(Param.IP, Param.ServerCacheIP.Trim('\\')) + ent.Path });
                SROperation2.Instance.Center2_1ImageBlockingCollection.Add(new KeyValuePair <string, string>(ent.Id.ToString(), ent.Serverip.Replace(Param.IP, Param.ServerCacheIP.Trim('\\')) + ent.Path));
                e.DrawDefault = true;
            }
            else
            {
                Image image1;
                if (SROperation2.Instance.Center2_1ImageDict.ContainsKey(ent.Id.ToString()))
                {
                    image1 = SROperation2.Instance.Center2_1ImageDict[ent.Id.ToString()];
                }
                else
                {
                    image1 = SROperation2.Instance.Center2_1ImageDict[e.Item.ImageKey];
                }
                Size size = e.Item.ImageList.ImageSize;
                e.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
                e.Graphics.InterpolationMode  = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
                e.Graphics.SmoothingMode      = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                if (e.Item.Selected)
                {
                    e.Graphics.FillRectangle(new SolidBrush(Color.Gray), e.Bounds);

                    Rectangle re = new Rectangle(e.Bounds.X + (e.Bounds.Width - size.Width) / 2, e.Bounds.Y + 2, size.Width, size.Height);
                    e.Graphics.DrawImage(image1, re);
                    //绘制次数
                    re = new Rectangle(re.X, re.Y + (re.Height - listView1.Font.Height + 2), re.Width, listView1.Font.Height + 2);
                    e.Graphics.DrawString((e.Item.Tag as SRRC_ResourceEntity).Usecount.ToString(), listView1.Font, new SolidBrush(Color.Red), re, new StringFormat()
                    {
                        Alignment = StringAlignment.Far, LineAlignment = StringAlignment.Center
                    });
                    if (ent.Iscomposite)
                    {
                        e.Graphics.DrawString("*", listView1.Font, new SolidBrush(Color.Red), re, new StringFormat()
                        {
                            Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center
                        });
                    }
                }
                else
                {
                    Rectangle re = new Rectangle(e.Bounds.X + (e.Bounds.Width - size.Width) / 2, e.Bounds.Y + 2, size.Width, size.Height);
                    e.Graphics.DrawImage(image1, re);
                    //绘制次数
                    re = new Rectangle(re.X, re.Y + (re.Height - listView1.Font.Height + 2), re.Width, listView1.Font.Height + 2);
                    e.Graphics.DrawString((e.Item.Tag as SRRC_ResourceEntity).Usecount.ToString(), listView1.Font, new SolidBrush(Color.Red), re, new StringFormat()
                    {
                        Alignment = StringAlignment.Far, LineAlignment = StringAlignment.Center
                    });
                    if (ent.Iscomposite)
                    {
                        e.Graphics.DrawString("*", listView1.Font, new SolidBrush(Color.Red), re, new StringFormat()
                        {
                            Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center
                        });
                    }
                }
            }
        }