Exemple #1
0
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            StringOperations _tmp    = item as StringOperations;
            FrameworkElement element = container as FrameworkElement;

            if (_tmp != null && element != null)
            {
                if (_tmp.NameOfOperation == "Replace")
                {
                    return(element.FindResource("ReplaceTemplate") as DataTemplate);
                }
                else
                if (_tmp.NameOfOperation == "GUID Generate")
                {
                    return(element.FindResource("GUIDTemplate") as DataTemplate);
                }
                else
                if (_tmp.NameOfOperation == "NewCase")
                {
                    return(element.FindResource("NewCaseTemplate") as DataTemplate);
                }
                else
                if (_tmp.NameOfOperation == "Normalize")
                {
                    return(element.FindResource("NormalizeTemplate") as DataTemplate);
                }
                else
                {
                    return(element.FindResource("MoveTemplate") as DataTemplate);
                }
            }
            return(null);
        }
Exemple #2
0
        private void addOperation_Click(object sender, RoutedEventArgs e)
        {
            StringOperations newOper = comboBoxToChooseOperations.SelectedItem as StringOperations;

            if (newOper != null)
            {
                readyLoadOper.Add(newOper.Clone());
                previewOperations();
            }
            else
            {
                MessageBox.Show("Please choose Operation to add!");
            }
            listBoxOperations.SelectedIndex = listBoxOperations.Items.Count - 1;
            listBoxOperations.ScrollIntoView(listBoxOperations.SelectedItem);
        }