public override void Loaded() { var dictImpl = new DictonaryService(); var list = dictImpl.QueryDictionary("SRDY"); SRDYCollection = new ObservableCollection <Dictonary>(list); SRDYSelectedItem = SRDYCollection.FirstOrDefault(); list = dictImpl.QueryDictionary("FZCS"); FZCSCollection = new ObservableCollection <Dictonary>(list); FZCSSelectedItem = FZCSCollection.FirstOrDefault(); }
public override void Loaded() { base.Loaded(); LHSXViewModel.Loaded(); var dictImpl = new DictonaryService(); var list = dictImpl.QueryDictionary("TDBL"); TDBLCollection = new ObservableCollection <Dictonary>(list); list = dictImpl.QueryDictionary("CSMS"); CSMSCollection = new ObservableCollection <Dictonary>(list); ChannelCollection = new ObservableCollection <ChannelInfo>(); }
public override DataTemplate SelectTemplate(object item, DependencyObject container) { FrameworkElement element = container as FrameworkElement; var parent = element.Parent as FrameworkElement; var dc = parent.DataContext as MonitorParamViewModel; if (dc.InputMode == (int)InputModeEnum.Selector) { var dictImpl = new DictonaryService(); var list = dictImpl.QueryDictionary("CSMS"); var datatemplate = element.FindResource("dtSelector") as DataTemplate; FrameworkElement fe = datatemplate.LoadContent() as FrameworkElement; var combobox = UIHelper.FindChild <ComboBox>(fe, "cmbCSMS"); if (combobox != null) { foreach (Dictonary dict in list) { combobox.Items.Add(new ComboBoxItem { Content = dict.Name }); } } return(datatemplate); } else if (dc.InputMode == (int)InputModeEnum.Input) { if (dc.ValType == (int)OutputEnum.V) { var datatemplate = element.FindResource("dtInputV") as DataTemplate; return(datatemplate); } else if (dc.ValType == (int)OutputEnum.A) { var datatemplate = element.FindResource("dtInputA") as DataTemplate; return(datatemplate); } else if (dc.ValType == (int)OutputEnum.N) { var datatemplate = element.FindResource("dtInputN") as DataTemplate; return(datatemplate); } } return(base.SelectTemplate(item, container)); }