示例#1
0
        public override void Initialize()
        {
            StackPanel mainWindowStackPanel = new StackPanel
            {
                Width = canvas.Width
            };

            canvas.Children.Add(mainWindowStackPanel);

            Label welcomeLabel = FrontEndHelper.CreateLabel(300, 50, 24, "Function Point Calculator");

            welcomeLabel.Margin = new Thickness
            {
                Top    = canvas.Height / 3,
                Bottom = 20
            };
            welcomeLabel.HorizontalContentAlignment = HorizontalAlignment.Center;
            welcomeLabel.VerticalContentAlignment   = VerticalAlignment.Center;
            mainWindowStackPanel.Children.Add(welcomeLabel);

            Button calculateButton = FrontEndHelper.CreateButton(110, 45, "Start!");

            calculateButton.HorizontalContentAlignment = HorizontalAlignment.Center;
            calculateButton.VerticalContentAlignment   = VerticalAlignment.Center;
            mainWindowStackPanel.Children.Add(calculateButton);
            calculateButton.Click += FrontEndHelper.GetMainWindow().Calculate_Button_Click;
        }
示例#2
0
        private void Add_Button_Click(object sender, RoutedEventArgs e)
        {
            List <object> list = (List <object>)((Button)sender).Tag;
            ComboBox      inputParameterComboBox = (ComboBox)list[0];
            ComboBox      inputTypeComboBox      = (ComboBox)list[1];
            TextBox       inputCountTextBox      = (TextBox)list[2];
            StackPanel    addedItemsStackPanel   = (StackPanel)list[3];
            int           count;

            if (int.TryParse(inputCountTextBox.Text, out count))
            {
                if (count < 0)
                {
                    MessageBox.Show("The number should be Positive.");
                    return;
                }
                Grid itemsGrid = new Grid();
                addedItemsStackPanel.Children.Add(itemsGrid);
                Label addedItemLabel = FrontEndHelper.CreateLabel(canvas.Width, 30, 15,
                                                                  inputParameterComboBox.SelectedValue
                                                                  + ", " + inputTypeComboBox.SelectedValue
                                                                  + ", "
                                                                  + inputCountTextBox.Text);
                Button deleteButton = FrontEndHelper.CreateButton(40, 15, "Del");
                deleteButton.FontSize = 10;
                Grid.SetColumn(deleteButton, 1);
                Grid.SetColumn(addedItemLabel, 0);
                itemsGrid.Children.Add(addedItemLabel);
                itemsGrid.Children.Add(deleteButton);

                var insertedData = Tuple.Create((string)inputParameterComboBox.SelectedValue,
                                                (string)inputTypeComboBox.SelectedValue, count);
                deleteButton.Tag = new List <Object>();
                ((List <object>)deleteButton.Tag).Add(insertedData);
                ((List <object>)deleteButton.Tag).Add(itemsGrid);
                deleteButton.Click += DeleteButtonOnClick;
                data.Add(insertedData);
                ((List <Tuple <string, string, int> >)addedItemsStackPanel.Tag).Add(insertedData);
                ((List <object>)deleteButton.Tag).Add(addedItemsStackPanel);
                // TODO: remove Message Box
                //MessageBox.Show("Added");
            }
            else
            {
                MessageBox.Show("Count is not a number!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
示例#3
0
        public override void Initialize()
        {
            StackPanel tcfStackPanel = new StackPanel
            {
                Width  = canvas.Width,
                Margin = new Thickness
                {
                    Top  = 20,
                    Left = 10
                }
            };

            canvas.Children.Add(tcfStackPanel);

            Grid tcfGrid = new Grid
            {
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(0.5 * canvas.Width)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(0.5 * canvas.Width)
                    }
                }
            };

            tcfStackPanel.Children.Add(tcfGrid);

            StackPanel labelsStackPanel = new StackPanel
            {
                Width  = 0.5 * canvas.Width,
                Margin = new Thickness
                {
                    Left = 20
                }
            };

            Grid.SetColumn(labelsStackPanel, 0);
            tcfGrid.Children.Add(labelsStackPanel);

            List <Label> labels = new List <Label>
            {
                FrontEndHelper.CreateLabel(0.5 * canvas.Width, 30, 14, "Data Communication"),
                FrontEndHelper.CreateLabel(0.5 * canvas.Width, 30, 14, "Distributed Data Processing"),
                FrontEndHelper.CreateLabel(0.5 * canvas.Width, 30, 14, "Performance Criteria"),
                FrontEndHelper.CreateLabel(0.5 * canvas.Width, 30, 14, "Heavily Utilized Hardware"),
                FrontEndHelper.CreateLabel(0.5 * canvas.Width, 30, 14, "High Transactions Rates"),
                FrontEndHelper.CreateLabel(0.5 * canvas.Width, 30, 14, "Online Data Entry"),
                FrontEndHelper.CreateLabel(0.5 * canvas.Width, 30, 14, "Online Updating"),
                FrontEndHelper.CreateLabel(0.5 * canvas.Width, 30, 14, "End-user Efficiency"),
                FrontEndHelper.CreateLabel(0.5 * canvas.Width, 30, 14, "Complex Computations"),
                FrontEndHelper.CreateLabel(0.5 * canvas.Width, 30, 14, "Reusability"),
                FrontEndHelper.CreateLabel(0.5 * canvas.Width, 30, 14, "Ease of Installation"),
                FrontEndHelper.CreateLabel(0.5 * canvas.Width, 30, 14, "Ease of operation"),
                FrontEndHelper.CreateLabel(0.5 * canvas.Width, 30, 14, "Portability"),
                FrontEndHelper.CreateLabel(0.5 * canvas.Width, 30, 14, "Maintainability")
            };

            for (int i = 0; i < 14; i++)
            {
                labelsStackPanel.Children.Add(labels[i]);
            }

            StackPanel comboBoxStackPanel = new StackPanel
            {
                Width = 0.5 * canvas.Width
            };

            Grid.SetColumn(comboBoxStackPanel, 1);
            tcfGrid.Children.Add(comboBoxStackPanel);

            List <ComboBox> comboBoxList = new List <ComboBox>();
            List <string>   optionList   = new List <string>
            {
                "No Influence",
                "Incidental",
                "Moderate",
                "Average",
                "Significant",
                "Essential"
            };


            for (int i = 0; i < 14; i++)
            {
                ComboBox comboBox = new ComboBox
                {
                    Width         = 0.3 * canvas.Width,
                    Height        = 30,
                    ItemsSource   = optionList,
                    SelectedIndex = 0
                };
                comboBoxList.Add(comboBox);
                comboBoxStackPanel.Children.Add(comboBox);
            }

            Button calculateButton = FrontEndHelper.CreateButton(220, 45, "Calculate");

            tcfStackPanel.Children.Add(calculateButton);
            calculateButton.Tag    = comboBoxList;
            calculateButton.Click += Calculate_Button_Click;
            calculateButton.Margin = new Thickness
            {
                Top   = 5,
                Right = 20
            };
            calculateButton.HorizontalAlignment = HorizontalAlignment.Center;
        }
        public override void Initialize()
        {
            StackPanel ufpStackPanel = new StackPanel
            {
                Width = canvas.Width
            };

            canvas.Children.Add(ufpStackPanel);

            Grid ufpInputDataGrid = new Grid
            {
                Margin = new Thickness
                {
                    Left = 30,
                    Top  = 50
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(0.3 * canvas.Width)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(0.3 * canvas.Width)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(0.3 * canvas.Width)
                    }
                }
            };

            ufpStackPanel.Children.Add(ufpInputDataGrid);

            ComboBox inputParameterComboBox = new ComboBox
            {
                Height      = 30,
                ItemsSource = new List <String>
                {
                    "External Input",
                    "External Output",
                    "External Inquiry",
                    "Internal Logical Files",
                    "External Interface Files"
                },
                SelectedIndex = 0
            };

            Grid.SetColumn(inputParameterComboBox, 0);
            ufpInputDataGrid.Children.Add(inputParameterComboBox);

            ComboBox inputTypeComboBox = new ComboBox
            {
                Height      = 30,
                ItemsSource = new List <String>
                {
                    "Simple",
                    "Average",
                    "Complex"
                },
                SelectedIndex = 0
            };

            Grid.SetColumn(inputTypeComboBox, 1);
            ufpInputDataGrid.Children.Add(inputTypeComboBox);

            TextBox inputCountTextBox = new TextBox
            {
                Height   = 30,
                FontSize = 14,
            };

            Grid.SetColumn(inputCountTextBox, 2);
            ufpInputDataGrid.Children.Add(inputCountTextBox);

            Grid ufpButtonsGrid = new Grid
            {
                Width  = canvas.Width,
                Margin = new Thickness
                {
                    Left = 15,
                    Top  = 20
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(0.7 * canvas.Width)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(0.3 * canvas.Width)
                    }
                }
            };

            ufpStackPanel.Children.Add(ufpButtonsGrid);

            Button addButton = FrontEndHelper.CreateButton(220, 45, "Insert");

            addButton.Tag    = new List <object>();
            addButton.Click += Add_Button_Click;
            ((List <object>)addButton.Tag).Add(inputParameterComboBox);
            ((List <object>)addButton.Tag).Add(inputTypeComboBox);
            ((List <object>)addButton.Tag).Add(inputCountTextBox);
            Grid.SetColumn(addButton, 0);
            ufpButtonsGrid.Children.Add(addButton);

            Button nextButton = FrontEndHelper.CreateButton(110, 45, "Next");

            nextButton.Click += Next_Button_Click;
            Grid.SetColumn(nextButton, 1);
            ufpButtonsGrid.Children.Add(nextButton);

            Expander addedItemsExpander = new Expander
            {
                Width      = canvas.Width / 2 + 200,
                Height     = 300,
                Header     = "Input Data",
                IsExpanded = true,
                Margin     = new Thickness
                {
                    Top  = 30,
                    Left = 20
                }
            };

            addedItemsExpander.HorizontalContentAlignment = HorizontalAlignment.Center;
            ufpStackPanel.Children.Add(addedItemsExpander);
            ScrollViewer addedItemsScrollViewer = new ScrollViewer()
            {
                VerticalScrollBarVisibility = ScrollBarVisibility.Auto
            };
            StackPanel addedItemsStackPanel = new StackPanel();

            addedItemsExpander.Content     = addedItemsScrollViewer;
            addedItemsScrollViewer.Content = addedItemsStackPanel;
            ((List <object>)addButton.Tag).Add(addedItemsStackPanel);
            addedItemsStackPanel.Tag = new List <Tuple <string, string, int> >();
        }