Exemplo n.º 1
0
        private void CloneToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (locked)
            {
                return;
            }
            locked = true;
            if (selectedItem != null && dataGridView_item.CurrentCell != null)
            {
                int itemId = listBox_items.CurrentCell.RowIndex;
                listBox_items.SuspendLayout();
                listBox_items.RowCount = 0;
                NestedFileDatabase.Collection.CloneAdd(GetList, selectedItem);
                listBox_items.ResumeLayout();
                locked = false;
                listBox_items.RowCount = NestedFileDatabase.ItemCount(GetList);
                listBox_items.PerformLayout();

                int lastItem = listBox_items.RowCount - 1;
                if (lastItem > 0)
                {
                    listBox_items.Rows[lastItem].Selected = true;
                    listBox_items.CurrentCell             = listBox_items.Rows[lastItem].Cells[0];
                }
            }
            locked = false;
        }
Exemplo n.º 2
0
        private void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (locked || listBox_items.CurrentCell == null)
            {
                return;
            }
            locked = true;
            int itemId = listBox_items.CurrentCell.RowIndex;

            listBox_items.SuspendLayout();
            listBox_items.RowCount = 0;
            NestedFileDatabase.Collection.RemoveItem(GetList, itemId);
            listBox_items.ResumeLayout();
            locked = false;
            listBox_items.RowCount = NestedFileDatabase.ItemCount(GetList);
            listBox_items.PerformLayout();

            int lastItem = itemId - 1;

            if (lastItem > 0)
            {
                listBox_items.Rows[lastItem].Selected = true;
                listBox_items.CurrentCell             = listBox_items.Rows[lastItem].Cells[0];
            }
        }
Exemplo n.º 3
0
 private void OnClickAddItem(object sender, EventArgs e)
 {
     locked = true;
     listBox_items.SuspendLayout();
     listBox_items.RowCount = 0;
     NestedFileDatabase.AddNew(GetList);
     locked = false;
     BuildLists();
     listBox_items.ResumeLayout();
     listBox_items.RowCount = NestedFileDatabase.ItemCount(GetList);
     listBox_items.PerformLayout();
 }
Exemplo n.º 4
0
 private void DeleteList(object sender, EventArgs e)
 {
     locked = true;
     listBox_items.SuspendLayout();
     listBox_items.RowCount = 0;
     NestedFileDatabase.Collection.DeleteList(GetList);
     locked = false;
     BuildLists();
     listBox_items.ResumeLayout();
     listBox_items.RowCount = NestedFileDatabase.ItemCount(GetList);
     listBox_items.PerformLayout();
 }
Exemplo n.º 5
0
 private void saveToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (NestedFileDatabase.IsLoaded)
     {
         NestedFileDatabase.SaveFile(path);
         MessageBox.Show("Saved!");
     }
     else
     {
         OpenFileDialog eLoad = new OpenFileDialog();
         eLoad.Filter           = "Elements File (*.data)|*.data|All Files (*.*)|*.*";
         eLoad.RestoreDirectory = false;
         if (eLoad.ShowDialog() == DialogResult.OK && File.Exists(eLoad.FileName))
         {
             path = eLoad.FileName;
             NestedFileDatabase.SaveFile(path);
             MessageBox.Show("Saved!");
         }
     }
 }
Exemplo n.º 6
0
        private void OpenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog eLoad = new OpenFileDialog())
            {
                eLoad.Filter           = "Elements File (*.data)|*.data|All Files (*.*)|*.*";
                eLoad.RestoreDirectory = false;
                if (eLoad.ShowDialog() == DialogResult.OK && File.Exists(eLoad.FileName))
                {
                    locked = true;
                    path   = eLoad.FileName;
                    NestedFileDatabase.ReadFile(eLoad.FileName);
                    BuildLists();

                    locked = false;
                    comboBox_lists.SelectedIndex = 0;
                    listBox_items.RowCount       = NestedFileDatabase.ItemCount(GetList);
                    listBox_items.PerformLayout();
                }
            }
        }
Exemplo n.º 7
0
        private void ComboBox_lists_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (locked)
            {
                return;
            }
            locked = true;
            FileItems list = NestedFileDatabase.Collection.GetList(GetList);

            if (list != null)
            {
                textBox_Name.Text = list.ListName; locked = true;
                listBox_items.SuspendLayout();
                listBox_items.RowCount = 0;
                locked = false;
                listBox_items.ResumeLayout();
                listBox_items.RowCount = NestedFileDatabase.ItemCount(GetList);
                listBox_items.PerformLayout();
                ListBoxSelectItem(null, null);
            }
            locked = false;
        }