예제 #1
0
        private void AddElemBtn_Click(object sender, EventArgs e)
        {
            AddRemoveElemForm f2 = new AddRemoveElemForm();

            f2.ShowDialog();

            my_sb = f2.ReturnStringBuilt();

            if (!my_sb.ToString().Equals(String.Empty))
            {
                array_LE.Add(ConvertStringArrayToListElem(my_sb.ToString().Split(Separator)));
                array_LE.Sort();
                viewArray_LE.Clear();

                foreach (var elem_in_array in array_LE)
                {
                    viewArray_LE.Add(elem_in_array);
                }

                listView1.Items.Clear();
                foreach (var le in viewArray_LE)
                {
                    listView1.Items.Add(new ListViewItem(ConvertListElemToStringArray(le)));
                }

                listView1.Sort();
                listView1.Refresh();
                lff.WriteValues(array_LE);
            }
        }
예제 #2
0
        private void EditElemBtn_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedIndices.Count != 0)
            {
                int index            = listView1.SelectedIndices[0];
                AddRemoveElemForm f2 = new AddRemoveElemForm(ConvertListElemToStringArray(viewArray_LE.ElementAt(index)));
                f2.ShowDialog();

                my_sb = f2.ReturnStringBuilt();

                if (!my_sb.ToString().Equals(string.Empty))
                {
                    int index_array_LE = -1;
                    foreach (var elem_in_array in array_LE)
                    {
                        index_array_LE++;
                        if (viewArray_LE[index] == elem_in_array)
                        {
                            break;
                        }
                    }

                    viewArray_LE[index] = ConvertStringArrayToListElem(my_sb.ToString().Split(Separator));
                    viewArray_LE.Sort();

                    array_LE[index_array_LE] = viewArray_LE[index];

                    listView1.Items.Clear();
                    foreach (var le in viewArray_LE)
                    {
                        listView1.Items.Add(new ListViewItem(ConvertListElemToStringArray(le)));
                    }

                    listView1.Sort();
                    listView1.Refresh();
                    lff.WriteValues(array_LE);
                }
            }
        }