예제 #1
0
        private void createMenuItem_Click(object sender, EventArgs e)
        {
            ConnectConfigForm configForm = new ConnectConfigForm(null);

            if (configForm.ShowDialog() == DialogResult.OK)
            {
                dataList.Add(configForm.ItemInfo);
                listView1.BeginUpdate();
                listView1.Items.Add(new RDMListViewItem().BindData(configForm.ItemInfo));
                listView1.EndUpdate();

                JSONUtils.Write(dataList.ToArray(), CONFIG_FILENAME);
            }
        }
 private void downToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count == 1)
     {
         ListViewItem indexItem = listView1.SelectedItems[0];
         int          index     = indexItem.Index;
         if (index < listView1.Items.Count - 1)
         {
             this.listView1.Items.RemoveAt(index);
             this.listView1.Items.Insert(index + 1, indexItem);
             RefreshDataList();
             JSONUtils.Write(dataList.ToArray(), CONFIG_FILENAME);
         }
     }
 }
 private void listView1_MouseUp(object sender, MouseEventArgs e)
 {
     isDrag = false;
     if ((this.itemSelected != null) && (this.itemDraged != null))
     {
         if (this.itemDraged.Index != this.itemSelected.Index)
         {
             this.listView1.Items.RemoveAt(this.itemDraged.Index);
             this.listView1.Items.Insert(this.itemSelected.Index, this.itemDraged);
             this.itemDraged   = null;
             this.itemSelected = null;
             RefreshDataList();
             JSONUtils.Write(dataList.ToArray(), CONFIG_FILENAME);
         }
     }
     this.Cursor = Cursors.Default;
 }
예제 #4
0
        private void deleteMenuItem_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count == 1)
            {
                try
                {
                    RDMListViewItem listViewItem = listView1.SelectedItems[0] as RDMListViewItem;
                    AccountItem     itemData     = dataList[listViewItem.Index];

                    var re = MessageBox.Show(resManager.GetString("delete.messagebox.caption"), resManager.GetString("delete.messagebox.title"), MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (re == DialogResult.Yes)
                    {
                        dataList.Remove(itemData);
                        listView1.Items.Remove(listViewItem);
                        JSONUtils.Write(dataList.ToArray(), CONFIG_FILENAME);
                    }
                }
                catch { }
            }
        }
예제 #5
0
        private void editMenuItem_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count == 1)
            {
                try
                {
                    RDMListViewItem listViewItem = listView1.SelectedItems[0] as RDMListViewItem;
                    AccountItem     itemData     = dataList[listViewItem.Index];

                    ConnectConfigForm configForm = new ConnectConfigForm(itemData);
                    configForm.ShowDialog();
                    if (configForm.DialogResult == DialogResult.OK)
                    {
                        listViewItem.Refresh();
                        JSONUtils.Write(dataList.ToArray(), CONFIG_FILENAME);
                    }
                }
                catch { }
            }
        }