public override void OnPageLoad(object sender, EventArgs e) { base.OnPageLoad(sender, e); comStatus.ItemsSource = EnumConverter.GetKeyValuePairs <ADStatus>(EnumConverter.EnumAppendItemType.All); facade = new DefaultKeywordsQueryFacade(this); filter = new DefaultKeywordsQueryFilter(); model = new DefaultKeywordsQueryVM(); model.CompanyCode = Newegg.Oversea.Silverlight.ControlPanel.Core.CPApplication.Current.CompanyCode; QuerySection.DataContext = model; //默认选第一个渠道 this.lstChannel.SelectedIndex = 0; }
private void UCAddDefaultKeywords_Loaded(object sender, RoutedEventArgs e) { Loaded -= new RoutedEventHandler(UCAddDefaultKeywords_Loaded); facade = new DefaultKeywordsQueryFacade(CPApplication.Current.CurrentPage); comStatus.ItemsSource = EnumConverter.GetKeyValuePairs <ADStatus>(); if (SysNo > 0) { //编辑模式 isAdd = false; this.ucPageType.PageTypeLoadCompleted += new EventHandler(ucPageType_PageTypeLoadCompleted); this.ucPageType.PageLoadCompleted += new EventHandler(ucPageType_PageLoadCompleted); facade.LoadDefaultKeywordsInfo(SysNo, (obj, args) => { if (args.FaultsHandle()) { return; } VM = args.Result.Convert <DefaultKeywordsInfo, DefaultKeywordsVM>((info, vm) => { if (info.WebChannel != null) { vm.ChannelID = info.WebChannel.ChannelID; } }); LayoutRoot.DataContext = VM; }); } else { //新建模式 VM = new DefaultKeywordsVM(); VM.Status = ADStatus.Active; LayoutRoot.DataContext = VM; //创建时默认选中第一个渠道 this.lstChannel.SelectedIndex = 0; } }