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)) { Label addedItemLabel = FrontEndHelper.CreateLabel(canvas.Width, 30, 15, inputParameterComboBox.SelectedValue + ", " + inputTypeComboBox.SelectedValue + ", " + inputCountTextBox.Text); addedItemsStackPanel.Children.Add(addedItemLabel); data.Add(Tuple.Create((string)inputParameterComboBox.SelectedValue, (string)inputTypeComboBox.SelectedValue, count)); ((List <Tuple <string, string, int> >)addedItemsStackPanel.Tag).Add(new Tuple <string, string, int>((string)inputParameterComboBox.SelectedValue, (string)inputTypeComboBox.SelectedValue, count)); // TODO: remove Message Box //MessageBox.Show("Added"); } else { MessageBox.Show("Count is not a number!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
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; }
public virtual void Hide() { canvas.Children.Clear(); FrontEndHelper.GetMainWindow().CurrentCanvas = null; canvas.Visibility = Visibility.Hidden; IsInitialized = false; }
public override void Initialize() { StackPanel resultStackPanel = new StackPanel { Width = canvas.Width }; canvas.Children.Add(resultStackPanel); Label ufpLablel = FrontEndHelper.CreateLabel(200, 32, 16, "UFP: \t" + CalculateFP.UFP.ToString()); ufpLablel.Margin = new Thickness(0, 0.2 * canvas.Height, 0, 0); resultStackPanel.Children.Add(ufpLablel); Label tcfLabel = FrontEndHelper.CreateLabel(200, 32, 16, "TCF: \t" + CalculateFP.TCF.ToString()); resultStackPanel.Children.Add(tcfLabel); Label functionPointLabel = FrontEndHelper.CreateLabel(200, 32, 16, "FP: \t" + CalculateFP.FP.ToString()); functionPointLabel.Margin = new Thickness(0, 0, 0, 50); resultStackPanel.Children.Add(functionPointLabel); List <string> languages = new List <string> { "Assembly Language", "C", "COBOL/Fortan", "Pascal", "Ada", "C++", "Visual Basic", "Object-Oriented Languages", "Smalltalk", "Code Generators (PowerBuilder)", "SQL/Oracle", "Spreadsheets", "Graphical Languages (icons)" }; Label label = FrontEndHelper.CreateLabel(100, 32, 16, "Language"); label.Margin = new Thickness(0, 0, 0, 5); resultStackPanel.Children.Add(label); ComboBox languageComboBox = new ComboBox { Width = 0.3 * canvas.Width, Height = 30, ItemsSource = languages }; Label locLabel = FrontEndHelper.CreateLabel(200, 32, 16, ""); languageComboBox.Tag = locLabel; languageComboBox.SelectionChanged += language_combobox_selection_changed; languageComboBox.SelectedIndex = 0; languageComboBox.Margin = new Thickness(0, 0, 0, 5); resultStackPanel.Children.Add(languageComboBox); resultStackPanel.Children.Add(locLabel); }
public virtual void Show() { if (!IsInitialized) { Initialize(); IsInitialized = true; } FrontEndHelper.GetMainWindow().CurrentCanvas = this; canvas.Visibility = Visibility.Visible; }
private void Next_Button_Click(object sender, RoutedEventArgs e) { CalculateFP.CalculateUFP(data); // TODO: remove Message Box MessageBox.Show("UFP = " + CalculateFP.UFP.ToString(), "UFP Result", MessageBoxButton.OK, MessageBoxImage.Information); MainWindow mainWindow = FrontEndHelper.GetMainWindow(); if (mainWindow.CurrentCanvas != null) { mainWindow.CurrentCanvas.Hide(); } mainWindow.InitializeTCFCanvas(); }
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); } }
private void Calculate_Button_Click(object sender, RoutedEventArgs e) { Button btn = (Button)sender; List <ComboBox> boxes = (List <ComboBox>)btn.Tag; List <string> data = new List <string>(); foreach (var combobox in boxes) { data.Add(combobox.Text); } CalculateFP.CalculateTCF(data); CalculateFP.CalculateFPValue(); MainWindow mainWindow = FrontEndHelper.GetMainWindow(); if (mainWindow.CurrentCanvas != null) { mainWindow.CurrentCanvas.Hide(); } mainWindow.InitializeResultCanvas(); }
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> >(); }