Beispiel #1
0
 private void mi_CopyValue_Click(object sender, RoutedEventArgs e)
 {
     if (lv_Props.SelectedItem != null)
     {
         SAPElementProperty prop = lv_Props.SelectedItem as SAPElementProperty;
         Clipboard.SetData(DataFormats.Text, prop.Value);
     }
 }
Beispiel #2
0
        private void displayData(GuiComponent c)
        {
            string type = c.GetDetailType();

            Type t = SAPAutomationHelper.Current.GetSAPTypeInfo(type);
            //Type detailType = null; GuiShell shellObj = null;
            //if (c.Type.ToLower().Contains("shell"))
            //{
            //    shellObj = c as GuiShell;
            //    if (shellObj != null)
            //    {
            //        foreach (Type t in SAPAutomationHelper.Current.SAPGuiApiAssembly.GetTypes().Where(tp => tp.IsInterface))
            //        {
            //            if (t.Name.Contains("Gui" + shellObj.SubType))
            //            {
            //                detailType = t;
            //                break;
            //            }
            //        }
            //    }
            //}

            //string typeName = detailType == null ? c.Type : detailType.Name;

            //var props = SAPAutomationHelper.Current.GetSAPTypeInfoes<PropertyInfo>(typeName, t => t.GetProperties().Where(p => p.IsSpecialName == false));

            List <SAPElementProperty> pps = new List <SAPElementProperty>();

            foreach (var p in t.GetProperties().Where(p => p.IsSpecialName == false))
            {
                SAPElementProperty prop = new SAPElementProperty();
                prop.Name       = p.Name;
                prop.IsReadOnly = !p.CanWrite;
                try
                {
                    prop.Value = p.GetValue(c).ToString();
                }
                catch
                {
                    prop.Value = "";
                }
                pps.Add(prop);
            }
            List <string> mds = getMethods(t);

            lv_Props.Dispatcher.BeginInvoke(new Action(() =>
            {
                lv_Props.DataContext   = pps;
                lv_Methods.DataContext = mds;
            }));
        }