Exemplo n.º 1
0
 private void RemoveSelectedSpecificationFromList(LocalizedSpecification spec)
 {
     // Removes the specification from the specification selection list
     SelectionSpecList.Remove(spec);
     // Refreshes the specification selection datagrid
     BindSpecificationSelectionData();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Adds the specification to the category
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddSpecification(object sender, RoutedEventArgs e)
        {
            // Gets the selected specification
            LocalizedSpecification spec = ((FrameworkElement)sender).DataContext as LocalizedSpecification;

            // Adds the selected specification to the category
            AddSelectedSpecification(spec);
            // Remove the specification from the specification selection datagrid
            RemoveSelectedSpecificationFromList(spec);
        }
Exemplo n.º 3
0
        private void AddSpecificationByID(int id)
        {
            // Gets the specification
            LocalizedSpecification spec = SelectionSpecList.SingleOrDefault(x => x.SpecificationID == id);

            // Adds it to the datagrid with the selected specs
            AddSelectedSpecification(spec);

            // Remove it from the datagrid with the possible specs
            RemoveSelectedSpecificationFromList(spec);
        }
Exemplo n.º 4
0
        private void AddSelectedSpecification(LocalizedSpecification spec)
        {
            // Adds a specification to the category
            CategoryModel.CategorySpecifications.Add(
                new CategorySpecification
            {
                SpecificationName = spec.LookupName,
                SpecificationID   = spec.SpecificationID,
                DisplayOrder      = CategoryModel.CategorySpecifications.Count()
            });

            // Refreshes the category specification datagrid
            BindCategorySpecificationsGrid();
        }
Exemplo n.º 5
0
        private StackPanel CreateRightStackPanelForInput(Language lang)
        {
            // Checks if the specification already has a localized specification belonging to the language
            LocalizedSpecification locSpec = SpecModel.LocalizedSpecifications.FirstOrDefault(x => x.LanguageID == lang.ID);

            // If there is no localized specification yet...
            if (locSpec == null)
            {
                // ... create a new localized specification and add it to the Model
                locSpec = new LocalizedSpecification
                {
                    LanguageID      = lang.ID,
                    SpecificationID = SpecModel.ID
                };

                SpecModel.LocalizedSpecifications.Add(locSpec);
            }

            // Creates a stackpanel
            StackPanel stackRight = new StackPanel
            {
                HorizontalAlignment = HorizontalAlignment.Left
            };

            // Creates a textbox for the name property
            ClickSelectTextBox txtName = new ClickSelectTextBox
            {
                Height = _defaultHeight,
                Width  = _defaultWidth,
                Margin = _defaultMargin,
                VerticalContentAlignment = VerticalAlignment.Center
            };
            // Creates a binding to the LookupName property of the localized specification, and adds the binding to the textbox
            Binding nameBinding = new Binding("LookupName")
            {
                Source = locSpec
            };

            txtName.SetBinding(TextBox.TextProperty, nameBinding);

            // Ditto for the AdviceDescription
            ClickSelectTextBox txtAdviceDescription = new ClickSelectTextBox
            {
                Height        = 300,
                Width         = _defaultWidth,
                TextWrapping  = TextWrapping.Wrap,
                AcceptsReturn = true,
                Margin        = _defaultMargin
            };
            Binding descriptionBinding = new Binding("AdviceDescription")
            {
                Source = locSpec
            };

            txtAdviceDescription.SetBinding(TextBox.TextProperty, descriptionBinding);

            // Adds the textboxes to the stackpanel
            stackRight.Children.Add(txtName);
            stackRight.Children.Add(txtAdviceDescription);

            return(stackRight);
        }