/// <summary> /// /// </summary> /// <param name="provider"></param> /// <param name="callContext"></param> /// <param name="context"></param> /// <returns></returns> protected override bool QueryEnabled(Digiwin.Common.Advanced.IResourceServiceProvider provider, Digiwin.Common.ServiceCallContext callContext, System.Windows.Forms.IDataObject context) { ICurrentDocumentWindow win = provider.GetService(typeof(ICurrentDocumentWindow), "SALES_ORDER_DOC") as ICurrentDocumentWindow; if (win == null || win.EditController.Document.DataSource == null) { return(false); } bool flag = true; DependencyObject coll = win.EditController.Document.DataSource as DependencyObject; if (3.Equals(coll["XSOURCE_TYPE"])) { flag = false; } return(flag); }
/// <summary> /// /// </summary> /// <param name="provider"></param> /// <param name="callContext"></param> /// <param name="context"></param> /// <returns></returns> protected override bool QueryEnabled(Digiwin.Common.Advanced.IResourceServiceProvider provider, Digiwin.Common.ServiceCallContext callContext, System.Windows.Forms.IDataObject context) { ICurrentBrowseWindow win = provider.GetService(typeof(ICurrentBrowseWindow), "SALES_ORDER_DOC") as ICurrentBrowseWindow; if (win == null || win.BrowseView.DataSource == null) { return(false); } bool flag = true; //^_^ 20171010 MODI BY HEHF FOR CBBM11709199 ↓ //DependencyObjectCollection coll = win.BrowseView.DataSource as DependencyObjectCollection; //var selectedColl = coll.Where(a => Convert.ToBoolean(a["IsSelected"], CultureInfo.InvariantCulture)).Select(b => b); var selectedColl = win.BrowseView.SelectObjects; //^_^ 20171010 MODI BY HEHF FOR CBBM11709199 ↑ selectedColl.ToList().ForEach(p => { if (3.Equals(((DependencyObject)p)["XSOURCE_TYPE"])) { flag = false; } }); return(flag); }