Esempio n. 1
0
        public fieldDisplay(fieldHelper fh, List <string> v)
        {
            InitializeComponent();

            fhLabel.DataContext = fh;
            fhLabel.SetBinding(TextBox.TextProperty, new Binding()
            {
                Path = new PropertyPath("Name"), Source = fh
            });

            fhType.DataContext = fh;
            fhType.SetBinding(Label.ContentProperty, new Binding()
            {
                Path = new PropertyPath("Type"), Source = fh
            });

            fhStatus.DataContext = fh;
            fhStatus.SetBinding(Label.ContentProperty, new Binding()
            {
                Path = new PropertyPath("Status"), Source = fh
            });

            variantCombo.ItemsSource = v;

            variantCombo.DataContext = fh;
            variantCombo.SetBinding(ComboBox.SelectedItemProperty, new Binding()
            {
                Path = new PropertyPath("Variant"), Source = fh
            });
        }
Esempio n. 2
0
        public void diff(ConvertedClass target)
        {
            Dictionary <string, fieldHelper> myPairs     = fields.ToDictionary(x => x.Name, x => x);
            Dictionary <string, fieldHelper> targetPairs = target.fields.ToDictionary(x => x.Name, x => x);

            for (int i = 0; i < fields.Count; i++)
            {
                fieldHelper fh = fields[i];
                if (targetPairs.ContainsKey(fh.Name))
                {
                    //Console.WriteLine("paired {0}", fh.Name);
                }
                else
                {
                    //Console.WriteLine("{0} not found", fh.Name);
                    fields.Remove(fh);
                    i--;
                }
            }

            foreach (fieldHelper fh in target.fields)
            {
                if (!myPairs.ContainsKey(fh.Name))
                {
                    //Console.WriteLine("NEW {0}", fh.Name);
                    fields.Add(fh);
                }
            }

            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs("fields"));
            }
        }