PositionParam.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Collections.ObjectModel;
  8. using RecipeEditorLib.DGExtension.CustomColumn;
  9. namespace RecipeEditorLib.RecipeModel.Params
  10. {
  11. public class PositionParam : Param
  12. {
  13. private string _Value = string.Empty;
  14. public string Value
  15. {
  16. get { return this._Value; }
  17. set
  18. {
  19. this._Value = value;
  20. this.OptionChanged(value);
  21. this.NotifyOfPropertyChange("Value");
  22. }
  23. }
  24. public ObservableCollection<ComboxColumn.Option> Options { get; set; }
  25. private void OptionChanged(string value)
  26. {
  27. IEnumerable<ComboxColumn.Option> opts = Options.Where(op => op.ControlName == value);
  28. if (opts.Count() > 0)
  29. {
  30. string[] relatedparams = opts.ToList()[0].RelatedParameters.Split(',');
  31. this.Parent.ToList().ForEach(param =>
  32. {
  33. if (relatedparams.Contains(param.Name) || param.Name == "Position" || param.Name == "StepNo" || param.Name == "Module")
  34. param.Visible = Visibility.Visible;
  35. else
  36. param.Visible = Visibility.Hidden;
  37. });
  38. }
  39. else
  40. {
  41. this.Parent.ToList().ForEach(param =>
  42. {
  43. if (param.Name == "Position" || param.Name == "StepNo" || param.Name == "Module")
  44. param.Visible = Visibility.Visible;
  45. else
  46. param.Visible = Visibility.Hidden;
  47. });
  48. }
  49. }
  50. }
  51. }