public TypeView(Powerscript.Type type, LibEntryView parent) { this.type = type; this.parent = parent; }
private void listPowerObjects_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { PBDotNetLib.orca.ILibEntry lib; LibEntryView libView = null; TypeView typeView = null; Powerscript.Type[] types; Powerscript.Datawindow dw; if (e.NewValue is LibEntryView) { libView = (LibEntryView)e.NewValue; typeView = libView.Type; } else if (e.NewValue is TypeView) { typeView = (TypeView)e.NewValue; libView = (typeView).Parent; } if (libView != null) { lib = libView.LibEntry; txtSource.TextArea.Document.Text = lib.Source ?? ""; switch (lib.Type) { case Objecttype.Datawindow: tabUserobject.Visibility = System.Windows.Visibility.Collapsed; tabDatawindow.Visibility = System.Windows.Visibility.Visible; dw = Powerscript.Datawindow.GetDatawindowFromSource(lib.Source); txtDwRelease.Text = dw.Release; if (dw.Object != null) { listDatawindowObjs.ItemsSource = dw.Object.Childs; } break; case Objecttype.Structure: tabUserobject.Header = "Structure"; goto case Objecttype.Window; case Objecttype.Menu: tabUserobject.Header = "Menu"; goto case Objecttype.Window; case Objecttype.Function: tabUserobject.Header = "Function"; goto case Objecttype.Window; case Objecttype.Application: tabUserobject.Header = "Application"; goto case Objecttype.Window; case Objecttype.Userobject: tabUserobject.Header = "UserObject"; goto case Objecttype.Window; case Objecttype.Window: tabUserobject.Visibility = System.Windows.Visibility.Visible; tabDatawindow.Visibility = System.Windows.Visibility.Collapsed; if (lib.Type == Objecttype.Window) { tabUserobject.Header = "Window"; } types = Powerscript.Type.GetTypesFromSource(lib.Source); if (types == null) { MessageBox.Show("keine Types"); return; } gridUoTypes.ItemsSource = types; if (libView.Types == null) { List <TypeView> typeViews = new List <TypeView>(); foreach (Powerscript.Type t in types) { if (t.Name == libView.Name) { libView.Type = new TypeView(t, libView); typeView = libView.Type; } else { typeViews.Add(new TypeView(t, libView)); } } libView.Types = typeViews; } gridUoProps.ItemsSource = typeView.Type.Properties; if (types.Length > 0) { txtUoIVariables.TextArea.Document.Text = types[0].InstanceVariables ?? ""; txtUoSVariables.TextArea.Document.Text = types[0].SharedVariables ?? ""; txtUoGVariables.TextArea.Document.Text = types[0].GlobalVariables ?? ""; txtUoExtFunctions.TextArea.Document.Text = types[0].ExternalFunctions ?? ""; gridUoMethods.ItemsSource = types[0].Methods; } break; } } }