예제 #1
0
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            Window add = new ModifyObjectWindow(WindowMode.ADD, mode);

            add.ShowDialog();
            ListBox.Items.Refresh();
        }
예제 #2
0
        private void EditButton_Click(object sender, RoutedEventArgs e)
        {
            Window edit = new ModifyObjectWindow(WindowMode.EDIT, mode);

            edit.ShowDialog();

            if (SelectedObj != null)
            {
                switch (mode)
                {
                case PropertyBinding.Customer:
                {
                    MainWindow.activeWorkspace.Customers[ListBox.SelectedIndex] = SelectedObj;
                    break;
                }

                case PropertyBinding.Building:
                {
                    MainWindow.activeWorkspace.Objects[ListBox.SelectedIndex] = SelectedObj;
                    break;
                }

                case PropertyBinding.LightSource:
                {
                    MainWindow.activeWorkspace.LightSources[ListBox.SelectedIndex] = SelectedObj;
                    break;
                }

                case PropertyBinding.Gauge:
                {
                    MainWindow.activeWorkspace.Gauges[ListBox.SelectedIndex] = SelectedObj;
                    break;
                }

                case PropertyBinding.DoingPerson:
                {
                    MainWindow.activeWorkspace.People[ListBox.SelectedIndex] = SelectedObj;
                    break;
                }

                case PropertyBinding.VeryfingPerson:
                {
                    MainWindow.activeWorkspace.People[ListBox.SelectedIndex] = SelectedObj;
                    break;
                }

                case PropertyBinding.Opinion:
                {
                    MainWindow.activeWorkspace.Opinions[ListBox.SelectedIndex] = SelectedObj;
                    break;
                }

                default:
                {
                    this.Close();
                    break;
                }
                }
                ListBox.SelectedItem = SelectedObj;
            }
            else
            {
                EditButton.IsEnabled   = false;
                SelectButton.IsEnabled = false;
            }

            ListBox.Items.Refresh();
        }