/// <summary> /// Принадлежит ли тип к XPObject. /// </summary> public static bool isXPBaseObject(Type type) { if (TypeEx.IsSubclassOf(type, typeof(XPBaseObject)) || type == typeof(XPBaseObject)) { return(true); } else { return(false); } }
/// <summary> /// Сохранение данных в БД определенной сессии. /// </summary> public static void SaveTable <Type>(Session targetSession) { if (TypeEx.IsSubclassOf(typeof(Type), typeof(XPObjectEx))) { XPCollection <Type> stores = new XPCollection <Type>(); foreach (Type store in stores) { XPObjectEx newItem = Activator.CreateInstance(typeof(Type), targetSession) as XPObjectEx; newItem.GetData <Type>(store); newItem.Save(); } } }
void CreateItem(DBFormItemBase item) { if (item != null && item.ViewType != null && TypeEx.IsSubclassOf(item.ViewType, typeof(DBViewBase))) { if (item.Document == null) { SplashScreenManager.ShowForm(null, typeof(WaitFormEx), true, true, false); SplashScreenManager.Default.SetWaitFormDescription(string.Format("Загружается форма \"{0}\"", item.Caption)); CheckAndActivateItem(item); item.View = Activator.CreateInstance(item.ViewType) as DBViewBase; if (item.View is DBViewInterface) ((DBViewInterface)item.View).RightMouseDown += DBFormItem_RightMouseDown; item.Document = BaseTabbedView.AddDocument(item.View); if (item.Document != null) { item.Document.Caption = item.Caption; item.Document.ImageIndex = item.ImageIndex; } if (!item.IsDocumentActivated) item.IsDocumentActivated = true; item.View.InvokeFormUpdate(this, null); SplashScreenManager.CloseForm(false); } else { SplashScreenManager.ShowForm(null, typeof(WaitFormEx), true, true, false); SplashScreenManager.Default.SetWaitFormDescription(string.Format("Обновляется форма \"{0}\"", item.Caption)); CheckAndActivateItem(item); BaseTabbedView.Controller.Activate(item.Document); item.View.InvokeFormUpdate(this, null); SplashScreenManager.CloseForm(false); } } }
public static List <Type> GetDerivedTypes(Type baseType, Assembly assembly) { // Get all types from the given assembly Type[] types = assembly.GetTypes(); List <Type> derivedTypes = new List <Type>(); for (int i = 0, count = types.Length; i < count; i++) { Type type = types[i]; if (TypeEx.IsSubclassOf(type, baseType)) { // The current type is derived from the base type, // so add it to the list derivedTypes.Add(type); } } return(derivedTypes); }
public override void InitializeNewComponent(IDictionary defaultValues) { object form = defaultValues["Parent"]; if (form != null && (TypeEx.IsSubclassOf(form.GetType(), typeof(Form)) || form.GetType() == typeof(Form))) { base.InitializeNewComponent(defaultValues); DBForm.InitializeVisibleComponents((Form)form); DBForm.OwnerForm = form as Form; } else { XtraMessageBox.Show("Данный объект не типа Form.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); DBForm.DestroyItself(); } }
public static void Transfer <TypeReal>(XPCollection xpCollection, Collection <TypeReal> collectionReal) { if (TypeEx.IsSubclassOf(typeof(TypeReal), typeof(LinkXPObject))) { Collection <XPObject> collection = new Collection <XPObject>(); foreach (XPObject server in xpCollection) { collection.Add(server); } foreach (TypeReal serverReal in collectionReal) { LinkXPObject link = serverReal as LinkXPObject; XPObject server = link.FindXPOject(collection) as XPObject; if (server != null) { collection.Remove(server); } } } }