private void WindowBase_Loaded(object sender, RoutedEventArgs e) { this.Available.ItemsSource = YesOrNoType.Yes.ToArrayList(); this.Position.ItemsSource = BerthPositionType.Top.ToArrayList(); this.cmbFFMState.ItemsSource = PLCStateType.Working.ToArrayList(); this.cmbCreateType.ItemsSource = CreateControlType.Stove.ToArrayList(); if (this.Model != null) { YesOrNoType yesOrNo = (YesOrNoType)Convert.ToInt32(Model.FFMIsAvailable); Available.Text = yesOrNo.FetchDescription(); BerthPositionType BerthPosition = (BerthPositionType)Convert.ToInt32(Model.FFMBerthPosition); Position.Text = BerthPosition.FetchDescription(); PLCStateType plcState = (PLCStateType)Convert.ToInt32(Model.FFMState); cmbFFMState.Text = plcState.FetchDescription(); CreateControlType createType = (CreateControlType)Convert.ToInt32(Model.FFMCreateType); cmbCreateType.Text = createType.FetchDescription(); this.Title = "修改信息"; } else { this.Title = "添加信息"; this.Model = new FixtureFurnaceMainEntity(); } this.DataContext = this.Model; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value != null) { PLCStateType plcState = (PLCStateType)value; return(plcState.FetchDescription()); } return(string.Empty); }