예제 #1
0
        public DrawFiguresControl()
        {
            InitializeComponent();
            FiguresData fd = new FiguresData();

            Circle      = new Circle(fd);
            Triangle    = new Triangle(fd);
            Rectangle   = new ClassLibrary_CalculateFiguresArea.Rectangle(fd);
            FiguresList = new List <string>();
            FiguresList.Add("Not selected");
            FiguresList.AddRange(Enum.GetNames(typeof(Figures)));
            FigureTypesComboBox.ItemsSource   = FiguresList;
            FigureTypesComboBox.SelectedIndex = 0;
        }
예제 #2
0
 private void FigureTypesComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     ClearInputFields();
     ClearDrawArea();
     if (FigureTypesComboBox.SelectedIndex == 0)
     {
         SideA_Value.IsEnabled = false;
         SideB_Value.IsEnabled = false;
         SideC_Value.IsEnabled = false;
         SideA_Tip.Content     = "Введите длину:";
         SideB_Tip.Content     = "Введите длину:";
         SideC_Tip.Content     = "Введите длину:";
         DrawButton.IsEnabled  = false;
     }
     else if (FigureTypesComboBox.SelectedIndex == 1)
     {
         SideA_Value.IsEnabled = true;
         SideB_Value.IsEnabled = false;
         SideC_Value.IsEnabled = false;
         SideA_Tip.Content     = "Введите радиус круга:";
         FiguresData fd = new FiguresData();
         Circle = new Circle(fd);
         DrawButton.IsEnabled = true;
     }
     else if (FigureTypesComboBox.SelectedIndex == 2)
     {
         SideA_Value.IsEnabled = true;
         SideB_Value.IsEnabled = true;
         SideC_Value.IsEnabled = false;
         SideA_Tip.Content     = "Введите длину стороны A:";
         SideB_Tip.Content     = "Введите длину стороны B:";
         SideC_Tip.Content     = "Длина стороны C:";
         FiguresData fd = new FiguresData();
         Triangle             = new Triangle(fd);
         DrawButton.IsEnabled = true;
     }
     else if (FigureTypesComboBox.SelectedIndex == 3)
     {
         SideA_Value.IsEnabled = true;
         SideB_Value.IsEnabled = true;
         SideC_Value.IsEnabled = false;
         SideA_Tip.Content     = "Введите длину стороны A:";
         SideB_Tip.Content     = "Введите длину стороны B:";
         FiguresData fd = new FiguresData();
         Rectangle            = new ClassLibrary_CalculateFiguresArea.Rectangle(fd);
         DrawButton.IsEnabled = true;
     }
 }