Inheritance: IList, ICollection, IEnumerable
Exemple #1
0
        public RenameDocument(ListView.SelectedListViewItemCollection selectedItems)
        {            
            InitializeComponent();

            if(selectedItems.Count > 0)
            {
                this.SelectedItems = selectedItems;

                if(this.SelectedItems.Count == 1)
                {
                    this.label.Text = "Digite um novo nome para o documento";

                    documento tag = (documento)this.SelectedItems[0].Tag;

                    if(tag != null)
                    {
                        this.boxName.Text = tag.name;
                    }
                }
                else
                {
                    this.label.Text = "Digite um novo nome para os [" + this.SelectedItems.Count + "] documentos";
                }
            }            
            else
            {
                MessageBox.Show("Não foi possível renomear o documento");
            }

            this.ShowDialog();
        }                        
Exemple #2
0
        public RecipeDetailsForm(recipeClientForm mainWindow, List<RecipesHeaderData> allRecipes, List<CategoryHeaderData> allCategories, ListView.SelectedListViewItemCollection selectedRecipe)
        {
            this.allRecipes = allRecipes;
            this.allCategories = allCategories;
            this.mainWindow = mainWindow;
            this.selectedRecipe = selectedRecipe;
            InitializeComponent();

            foreach (ListViewItem recipe in selectedRecipe)
            {
                string title = recipe.SubItems[1].Text;
                string recipeId = recipe.Tag.ToString();
                tbTitle.Text = title;
                tbFilePath.Text = recipe.SubItems[0].Text;
                tbPrepareTime.Text = recipe.SubItems[3].Text;
                tbIngredients.Text = recipe.SubItems[2].Text;

                foreach (var category in allCategories)
                {
                    cbCategory.Items.Add(category.DisplayName);
                }
                currentRecipe = allRecipes.Where(r => r.ID.ToString() == recipeId).First();
                var currentCategory = allCategories.Where(c => c.ID == currentRecipe.Category_ID).First();
                cbCategory.SelectedItem = currentCategory.DisplayName;
                tbHowToPrepare.Text = currentRecipe.HowToPrepare;
            }
        }
Exemple #3
0
        public UrunDegistir(ListView.SelectedListViewItemCollection urunler)
        {
            InitializeComponent();

            this.urunler = urunler;

            this.Top = (Screen.PrimaryScreen.Bounds.Height - this.Height) / 2;
            this.Left = (Screen.PrimaryScreen.Bounds.Width - this.Width) / 2;
        }
Exemple #4
0
        private void listview_ItemDrag(object sender, ItemDragEventArgs e)
        {
            if (!m_editMode)
                return;

            if (treeView.SelectedNode.Level == 0) // 选中第一层不允许拖
                return;

            m_selecteditems = this.listview.SelectedItems;
            this.DoDragDrop(this.listview.SelectedItems, DragDropEffects.Move);
        }
        private void 删除_Click(object sender, EventArgs e)
        {
            ListView.SelectedListViewItemCollection SelectedItem = new ListView.SelectedListViewItemCollection(listView1);
            DialogResult d = MessageBox.Show("删除选中的 " + SelectedItem.Count + " 项?", "附件", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            String[] source = new string[SelectedItem.Count];
            ShellFileOperation fo = new ShellFileOperation();
            fo.Operation = FileOperations.FO_DELETE;
            fo.OwnerWindow = this.Handle;
            fo.SourceFiles = source;

            if (d == DialogResult.Yes)
            {
                for (int i = 0; i < SelectedItem.Count; i++)
                    source[i] = workpath + "\\" + SelectedItem[i].Text;

                if (!fo.DoOperation())
                    MessageBox.Show("删除文件过程中出错!", "附件", MessageBoxButtons.OK, MessageBoxIcon.Error);

                for (int i = 0; i < SelectedItem.Count; )
                    listView1.Items.Remove(SelectedItem[i]);

                LoadData(workpath);
            }
        }
Exemple #6
0
        private void btnCall_Click(object sender, EventArgs e)
        {
            //Call("192.168.0.104");

                if (1==1)
            {
                if (this.onlineuses.SelectedItems.Count > 0)
                {
                    //循环处理 在线用户列表
                    selectedUsers = this.onlineuses.SelectedItems;
                    for (int a = 0; a < selectedUsers.Count; a++)
                    {
                        Call(selectedUsers[a].SubItems[1].Text);
                        //Console.WriteLine(selectedUsers[a].SubItems[1].Text);
                    }
                }
                else
                {
                    MessageBox.Show("请选择需要聊天的用户");
                }
            }
        }
 private void emotionalDecisionMakingView_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (_emotionalAppraisalToSelected == null)
         _emotionalAppraisalToSelected = emotionalAppraisalSelectionView.SelectedItems;
     else
         emotionalAppraisalSelectionView.Items.Remove(emotionalAppraisalSelectionView.SelectedItems[0]);
 }
Exemple #8
0
 private void TransferRightTechnique()
 {
     ListView.SelectedListViewItemCollection SettleOnItem = new ListView.SelectedListViewItemCollection(this.listView1);//定义一个选择项的集合
     for(int i = 0; i < SettleOnItem.Count; )//循环遍历选择的每一项
     {
         listView2.Items.Add(SettleOnItem[i].Text);//向listView2中添加选择项
         listView1.Items.Remove(SettleOnItem[i]);//从listView1中移除选择项
     }
 }
 private void scenariosListView_SelectedIndexChanged(object sender, EventArgs e)
 {
     _scenarioSelected = _scenarioList.SelectedItems;
 }
        private void removeScenarios_Click(object sender, EventArgs e)
        {
            if(_scenarioSelected != null)
            {
                _scenarioList.Items.Remove(_scenarioList.SelectedItems[0]);
            }

            _scenarioSelected = null;
        }
Exemple #11
0
 void SelectListViewSfxItem(ListViewItem item)
 {
     #if false
     ListView.SelectedListViewItemCollection coll = new ListView.SelectedListViewItemCollection(listViewSfx);
     coll.Clear();
     item.Selected = true;
     #else
     //Rectangle rc = listViewSfx.GetItemRect(item.Index);
     //Point pt = new Point(rc.Left + (rc.Right - rc.Left) / 2, rc.Top + (rc.Bottom - rc.Top) / 2);
     //uint wp = 0;
     //uint lp = (uint)((ushort)pt.X + (uint)(pt.Y << 16));
     //PostMessageW(listViewSfx.Handle, 0x201, wp, lp);
     #endif
 }
Exemple #12
0
        private void treeView1_DragDrop(object sender, DragEventArgs e)
        {
            #region LISTVIEW 拖拽到TREEVIEW上
            if (e.Data.GetDataPresent(typeof(ListView.SelectedListViewItemCollection).ToString(), false))
            {
                Point    loc       = ((TreeView)sender).PointToClient(new Point(e.X, e.Y));
                TreeNode destNode1 = ((TreeView)sender).GetNodeAt(loc);

                ListView.SelectedListViewItemCollection lstViewColl =
                    (ListView.SelectedListViewItemCollection)e.Data.GetData(typeof(ListView.SelectedListViewItemCollection));

                foreach (ListViewItem lvItem in lstViewColl)
                {
                    string source = filename + "\\" + lvItem.Text;
                    if (!source.EndsWith(".htm"))
                    {
                        source += ".htm";
                    }

                    string dest = rootpath + "\\" + destNode1.FullPath + "\\" + lvItem.Text;
                    if (!dest.EndsWith(".htm"))
                    {
                        dest += ".htm";
                    }

                    if (filename == rootpath + "\\" + destNode1.FullPath)
                    {
                        MessageBox.Show("源文件和目标不能是同一个文件");
                        return;
                    }

                    dest = FileCore.NewName(dest);

                    string html  = File.ReadAllText(source, Encoding.UTF8);
                    string title = FileCore.GetHTMLTitleTag(html);
                    if (title != "")
                    {
                        html = html.Replace(title, Path.GetFileNameWithoutExtension(dest));
                    }

                    File.WriteAllText(source, html, Encoding.UTF8);

                    //移动文件
                    File.Move(source, dest);

                    //移动_attachments
                    string source_attachments = DirectoryCore.Get_AttachmentsDirectory(source);
                    string dest_attachments   = DirectoryCore.Get_AttachmentsDirectory(dest);

                    if (Directory.Exists(dest_attachments.ToLower()))
                    {
                        Directory.Delete(dest_attachments);
                    }

                    if (Directory.Exists(source_attachments.ToLower()))
                    {
                        Directory.Move(source_attachments, dest_attachments);
                    }

                    lvItem.Remove();
                }
            }



            #endregion



            #region TreeView自己的拖拽

            destNode = treeView1.GetNodeAt(treeView1.PointToClient(new Point(e.X, e.Y)));
            string destNodeText = rootpath + "\\" + destNode.FullPath;

            if (selNode != destNode && (selNode.Parent != destNode))
            {
                //文件 拖拽 到文件夹中

                if (File.Exists(filename) && Directory.Exists(destNodeText))
                {
                    string destfile = FileCore.NewName(rootpath + "\\" + destNode.FullPath + "\\" + selNode.Text);
                    if (filename == destfile)
                    {
                        MessageBox.Show("源文件和目标不能是同一个文件");
                        return;
                    }


                    string html  = File.ReadAllText(filename, Encoding.UTF8);
                    string title = FileCore.GetHTMLTitleTag(html);
                    if (title != "")
                    {
                        html = html.Replace(title, Path.GetFileNameWithoutExtension(destfile));
                    }
                    File.WriteAllText(filename, html, Encoding.UTF8);


                    File.Move(filename, destfile);


                    TreeNode selnode = (TreeNode)treeView1.SelectedNode.Clone();
                    destNode.Nodes.Add(selnode);

                    DirectoryInfo di = new DirectoryInfo(destfile);
                    selnode.Text = Path.GetFileName(di.Name);

                    treeView1.SelectedNode.Remove();
                    destNode.Expand();


                    //移动_attachments
                    string source_attachments = DirectoryCore.Get_AttachmentsDirectory(filename);
                    string dest_attachments   = DirectoryCore.Get_AttachmentsDirectory(destfile);

                    if (Directory.Exists(dest_attachments.ToLower()))
                    {
                        Directory.Delete(dest_attachments);
                    }

                    if (Directory.Exists(source_attachments.ToLower()))
                    {
                        Directory.Move(source_attachments, dest_attachments);
                    }
                }

                //文件夹 拖拽 到文件夹中
                if (Directory.Exists(filename) && Directory.Exists(destNodeText))
                {
                    string destpath = DirectoryCore.NewName(rootpath + "\\" + destNode.FullPath + "\\" + selNode.Text);
                    Directory.Move(filename, destpath);

                    //if (selNode.Parent == null)
                    //    treeView1.Nodes.Remove(selNode);
                    //else
                    //    selNode.Parent.Nodes.Remove(selNode);

                    TreeNode selnode = (TreeNode)treeView1.SelectedNode.Clone();
                    destNode.Nodes.Add(selnode);
                    DirectoryInfo di = new DirectoryInfo(destpath);
                    selnode.Text = Path.GetFileNameWithoutExtension(di.Name);

                    treeView1.SelectedNode.Remove();
                    destNode.Expand();
                }
            }
            #endregion
        }
Exemple #13
0
        private void treeView1_DragOver(object sender, DragEventArgs e)
        {
            #region 容许拖拽的条件
            //接受来自ListView的拖拽
            //禁止当前的文件夹往当前的文件夹里拖拽
            //目标节点 不存在
            //拖拽节点 不能和 目标节点 相同

            //拖拽节点 不能往它的父一级节点拖拽

            //拖拽节点 的名称 不能为空
            //目标节点 的名称 不能为空
            //拖拽节点 不能和 我的电脑这个节点 相同   (禁止手提我的电脑这个节点)
            //拖拽节点 不能和 回收站这个节点 相同

            #endregion

            TreeNode destNode     = treeView1.GetNodeAt(treeView1.PointToClient(new Point(e.X, e.Y)));
            string   destNodeText = rootpath + "\\" + destNode.FullPath;

            ////闪烁有点厉害
            Graphics g = treeView1.CreateGraphics();
            //绘制目标hover背景
            if (destNode != null)
            {
                treeView1.Refresh();
                treeView1_DrawNode(sender,
                                   new DrawTreeNodeEventArgs(g, destNode,
                                                             new Rectangle(0,
                                                                           destNode.Bounds.Y,
                                                                           treeView1.Width,
                                                                           destNode.Bounds.Height),
                                                             TreeNodeStates.Hot));
            }


            //这个得等待3秒才展开
            //展开的速度太快了
            //if (destNode != selNode && destNode.Nodes.Count > 0 && !destNode.IsExpanded)
            //    destNode.Expand();

            if ((e.Data.GetDataPresent(typeof(ListView.SelectedListViewItemCollection)) && destNode.Text != ""))
            {
                Point loc = ((TreeView)sender).PointToClient(new Point(e.X, e.Y));


                TreeNode destNode1     = ((TreeView)sender).GetNodeAt(loc);
                string   destNode1Text = rootpath + "\\" + destNode1.FullPath;

                //if (destNode1.Nodes.Count > 0 && !destNode1.IsExpanded)
                //    destNode1.Expand();



                ListView.SelectedListViewItemCollection lstViewColl =
                    (ListView.SelectedListViewItemCollection)e.Data.GetData(typeof(ListView.SelectedListViewItemCollection));

                foreach (ListViewItem lvItem in lstViewColl)
                {
                    //源文件和目标不能是同一个文件
                    if (filename == rootpath + "\\" + destNode.FullPath)
                    {
                        e.Effect = DragDropEffects.None;
                        return;
                    }
                    else
                    {
                        if (Directory.Exists(destNode1Text))
                        {
                            e.Effect = DragDropEffects.Move;
                        }
                    }
                }
            }
            else
            {
                if ((destNode != null &&
                     selNode != destNode &&
                     selNode.Parent != destNode &&
                     destNode.Text != "" &&
                     destNode != computerNode
                     ))
                {
                    //文件 拖拽 到文件夹中
                    //文件夹 拖拽 到文件夹中
                    if (File.Exists(filename) && Directory.Exists(destNodeText) ||
                        Directory.Exists(filename) && Directory.Exists(destNodeText))
                    {
                        e.Effect = DragDropEffects.Move;

                        //当一个父节点往它的子节点中拖拽时
                        while (destNode.Parent != null)
                        {
                            if (destNode.Parent == selNode)
                            {
                                e.Effect = DragDropEffects.None;
                                return;
                            }
                            destNode = destNode.Parent;
                        }
                    }
                }
                else
                {
                    e.Effect = DragDropEffects.None;
                }
            }
        }
        private void scenesList_SelectedIndexChanged(object sender, EventArgs e)
        {
            layersList.Items.Clear();
            layersList.CheckBoxes = false;
            _SelectedLayers = null;
            _SelectedScene = _SelectedFolder = _SelectedGlint = "";

            XmlDocument _glintsXmlDoc;
            XmlElement _glintsRoot;

            _glintsXmlDoc = new XmlDocument();

            if (this.scenesList.SelectedItems.Count == 1)
            {
                ListViewItem logToGet = this.scenesList.SelectedItems[0];

                for (int i = 0; i < GlintFiles.Count; i++)
                {
                    if (GlintFiles[i].item == logToGet)
                    {
                        _SelectedScene = GlintFiles[i].path;
                        _SelectedFolder = GlintFiles[i].folder;
                        _SelectedGlint = GlintFiles[i].glintFile;
                    }
                }

                _glintsXmlDoc.Load(_SelectedScene);

                _glintsRoot = (XmlElement)_glintsXmlDoc.DocumentElement;

                XmlElement _layersNode = (XmlElement)FoundChildNode("layers", _glintsRoot);

                if (_layersNode != null)
                    for (int j = 0; j < _layersNode.ChildNodes.Count; j++)
                    {
                        ListViewItem item = new ListViewItem();
                        item.Text = _layersNode.ChildNodes[j].Name;
                        if (item.Text.Contains("active_zone"))
                        {
                            item.ForeColor = Color.Blue;
                        }
                        else if (item.Text.Contains("drop_zone"))
                        {
                            item.ForeColor = Color.Brown;
                        }

                        layersList.Items.Add(item);
                    }

            }
            else
            {
                _SelectedScene = _SelectedFolder = _SelectedGlint = "";
            }
        }
 private void layersList_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this.layersList.SelectedItems.Count != 0)
     {
         _SelectedLayers = this.layersList.SelectedItems;
     }
     else
         _SelectedLayers = null;
 }
Exemple #16
0
        private void treeView_DragDrop(object sender, DragEventArgs e)
        {
            if (!m_editMode)
                return;

            ListView.SelectedListViewItemCollection lvc = m_selecteditems;
            m_selecteditems = null;
            foreach (TreeNode tn in treeView.Nodes)
            {
                tn.BackColor = Color.White;
                tn.ForeColor = Color.Black;
            }
            if (lvc.Count == 0) return;
            if (m_selectednode == null) return;
            if (treeView.SelectedNode == null) return;
            if (OldDragOverNode != null)
            {
                OldDragOverNode.BackColor = Color.White;
                OldDragOverNode.ForeColor = Color.Black;
            }

            // m_selectednode: 拖动的目的
            // treeview.selectedNode: 源

            if (m_selectednode.Level == 0) // 不允许拖到第一层
                return;

            //从内存中移动图标
            ArrayList afrom = treeView.SelectedNode.Tag as ArrayList;
            ArrayList ato = m_selectednode.Tag as ArrayList;
            ArrayList aPreDel1 = new ArrayList();
            ArrayList aPreDel2 = new ArrayList();

            ArrayList afromParent = treeView.SelectedNode.Parent.Tag as ArrayList;
            ArrayList atoParent = m_selectednode.Parent.Tag as ArrayList;
            ArrayList aPreDel1Parent = new ArrayList();
            //ArrayList aPreDel2Parent = new ArrayList();

            foreach (ListViewItem lvi in lvc)
            {
                foreach (Info info in afrom)
                {
                    if (info.fielname == (lvi.Tag as Info).fielname && info.ImageIndex == lvi.ImageIndex)
                    {
                        //修改数据库
                        tgaIO.ResetAllKind(info.id.ToString(), m_selectednode.Parent.Text, m_selectednode.Text); // ahpho这个函数要改
                        //修改数据库完毕
                        aPreDel1.Add(info);
                        aPreDel1Parent.Add(info);

                        info.kind = m_selectednode.Parent.Text;
                        info.subKind = m_selectednode.Text;
                        ato.Add(info);
                        atoParent.Add(info);
                    }
                }
                aPreDel2.Add(lvi);
            }

            foreach (object obj in aPreDel1)
            {
                afrom.Remove(obj);
            }
            foreach (object obj in aPreDel1Parent)
            {
                afromParent.Remove(obj);
            }
            foreach (object obj in aPreDel2)
            {
                listview.Items.Remove(obj as ListViewItem);
            }

            listview.Refresh();
        }
 public TorrentPropertiesDialog(ListView.SelectedListViewItemCollection selections)
 {
     this.selections = selections;
     InitializeComponent();
     trackersButtonPanel.Visible = Program.DaemonDescriptor.RpcVersion >= 10;
 }
 private void learningGoalsView_SelectedIndexChanged(object sender, EventArgs e)
 {
     _goalSelected = _learningGoalsList.SelectedItems;
 }
        private void removeLearningGoals_Click(object sender, EventArgs e)
        {
            if (_goalSelected != null)
            {
                _learningGoalsList.Items.Remove(_learningGoalsList.SelectedItems[0]);
            }

            _goalSelected = null;
        }
Exemple #20
0
        private void 清除选中_Click(object sender, EventArgs e)
        {
            ListView.SelectedListViewItemCollection SelectedItem = new ListView.SelectedListViewItemCollection(listView1);
            for (int i = 0; i < SelectedItem.Count; )
                listView1.Items.Remove(SelectedItem[i]);

            label3.Text = "数量:" + listView1.Items.Count.ToString();
        }
Exemple #21
0
 void CListView1ItemDrag(object sender, ItemDragEventArgs e)
 {
     dragItems = cListView1.SelectedItems;
 }
Exemple #22
0
 void Library_ItemDrag(object sender, ItemDragEventArgs e)
 {
     if(MouseButtons == MouseButtons.Left)
     {
         if(cListView1.SelectedItems.Count>0)
         {
             dragItems = cListView1.SelectedItems;
             cListView1.DoDragDrop(dragItems, DragDropEffects.Copy);
             if (CurrentPlaylist != null)
             {
             }
         }
     }
 }
 private void emotionalDecisionMakingAvailableView_SelectedIndexChanged(object sender, EventArgs e)
 {
     _emotionalDecisionMakingToSelected = emotionalDecisionMakingAvailableView.SelectedItems ;
 }
        public MoveDataPrompt(ListView.SelectedListViewItemCollection selections)
        {
            InitializeComponent();
            this.selections = selections;

            if (selections.Count < 1)
            {
                Close();
            }
            else if (selections.Count == 1)
            {
                Torrent t = (Torrent)selections[0];
                Text = string.Format(OtherStrings.MoveX, t.Text);
            }
            else
            {
                Text = OtherStrings.MoveMultipleTorrents;
            }

            foreach (string s in Program.Settings.Current.DestPathHistory)
            {
                destinationComboBox.Items.Add(s);
            }

            if (destinationComboBox.Items.Count > 0)
                destinationComboBox.SelectedIndex = 0;
        }