Exemple #1
0
 private void listView5_DoubleClick(object sender, EventArgs e)
 {
     var items = listView5.SelectedItems;
     if (items.Count > 0)
     {
         var item = items[0];
         if (item.Tag != null)
         {
             Build bb = (Build)item.Tag;
             using (var ff = new Create())
             {
                 ff.Tag = bb;
                 var res = ff.ShowDialog();
                 if (res == System.Windows.Forms.DialogResult.OK)
                 {
                 }
             }
         }
     }
 }
Exemple #2
0
        private void toolStripButton7_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count > 0)
            {
                using (var ff = new Create())
                {
                    var bb = new Build();
                    bb.New = true;
                    bb.mon = (Monster)listView1.SelectedItems[0].Tag;
                    bb.ID = listView5.Items.Count + 1;
                    ff.Tag = bb;
                    var res = ff.ShowDialog();
                    if (res == System.Windows.Forms.DialogResult.OK)
                    {
                        if (builds.Count > 0)
                            ff.build.priority = builds.Max(b => b.priority) + 1;
                        else
                            ff.build.priority = 1;

                        ListViewItem li = new ListViewItem(new string[]{ff.build.priority.ToString(), ff.build.ID.ToString(), ff.build.mon.Name,"0%"});
                        li.Tag = ff.build;
                        listView5.Items.Add(li);
                        builds.Add(ff.build);

                        var lv1li = listView1.Items.Cast<ListViewItem>().Where(i => i.SubItems.Cast<ListViewItem.ListViewSubItem>().Where(s => s.Text == ff.build.mon.Name).Count() > 0).FirstOrDefault();
                        if (lv1li != null)
                            lv1li.ForeColor = Color.Green;

                    }
                }
            }
        }