コード例 #1
0
        private void EditBtn_Click(object sender, RoutedEventArgs e)
        {
            var id = MainTable.SelectedIndex;

            // Если элемент не выбран
            if (id == -1 || id == MainTable.Items.Count - 1)
            {
                return;
            }

            // Создаем форму для редактирования
            if (currentFile == "Data/SuppliersList.xml")
            {
                var form2 = new SupplierWindow(MainTable.SelectedIndex);
                if (form2.ShowDialog() == true)
                {
                    FillMainTable(currentFile);
                }
            }

            if (currentFile == "Data/ClientsList.xml")
            {
                var form2 = new ClientWindow(MainTable.SelectedIndex);
                if (form2.ShowDialog() == true)
                {
                    FillMainTable(currentFile);
                }
            }

            if (currentFile == "Data/ImportList.xml")
            {
                var form2 = new ImportWindow(MainTable.SelectedIndex, 1);
                if (form2.ShowDialog() == true)
                {
                    FillMainTable(currentFile);
                }
            }

            if (currentFile == "Data/ExportList.xml")
            {
                var form2 = new ImportWindow(MainTable.SelectedIndex, -1);
                if (form2.ShowDialog() == true)
                {
                    FillMainTable(currentFile);
                }
            }

            if (currentFile == "Data/BalanceList.xml")
            {
                var form2 = new ProductWindow(MainTable.SelectedIndex);
                if (form2.ShowDialog() == true)
                {
                    FillMainTable(currentFile);
                }
            }
        }
コード例 #2
0
        private void AddBtn_Click(object sender, RoutedEventArgs e)
        {
            if (currentFile == "Data/SuppliersList.xml")
            {
                var form2 = new SupplierWindow(-1);
                if (form2.ShowDialog() == true)
                {
                    FillMainTable(currentFile);
                }
            }

            if (currentFile == "Data/ClientsList.xml")
            {
                var form2 = new ClientWindow(-1);
                if (form2.ShowDialog() == true)
                {
                    FillMainTable(currentFile);
                }
            }

            if (currentFile == "Data/ImportList.xml")
            {
                var form2 = new ImportWindow(-1, 1);
                if (form2.ShowDialog() == true)
                {
                    FillMainTable(currentFile);
                }
            }

            if (currentFile == "Data/ExportList.xml")
            {
                var form2 = new ImportWindow(-1, -1);
                if (form2.ShowDialog() == true)
                {
                    FillMainTable(currentFile);
                }
            }

            if (currentFile == "Data/BalanceList.xml")
            {
                var form2 = new ProductWindow(-1);
                if (form2.ShowDialog() == true)
                {
                    FillMainTable(currentFile);
                }
            }
        }