protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e) { #region Загрузка элементов InitialDirectiveArray.Clear(); if (ResultDirectiveArray != null) { ResultDirectiveArray.Clear(); } AnimatedThreadWorker.ReportProgress(0, "load directives"); if (ViewedType.IsSubclassOf(typeof(StaticDictionary))) { PropertyInfo p = ViewedType.GetProperty("Items"); ConstructorInfo ci = ViewedType.GetConstructor(new Type[0]); StaticDictionary instance = (StaticDictionary)ci.Invoke(null); InitialDirectiveArray.AddRange((IDictionaryCollection)p.GetValue(instance, null)); InitialDirectiveArray.RemoveById(-1); } else { var dto = (CAADtoAttribute)ViewedType.GetCustomAttributes(typeof(CAADtoAttribute), false).FirstOrDefault(); var res = GlobalObjects.CaaEnvironment.NewLoader.GetObjectList(dto.Type, ViewedType, loadChild: true, filter: _filters); InitialDirectiveArray.AddRange((IEnumerable <IBaseEntityObject>)res); } AnimatedThreadWorker.ReportProgress(40, "filter directives"); #region Фильтрация директив AnimatedThreadWorker.ReportProgress(70, "filter directives"); FilterItems(InitialDirectiveArray, ResultDirectiveArray); if (AnimatedThreadWorker.CancellationPending) { e.Cancel = true; return; } #endregion AnimatedThreadWorker.ReportProgress(100, "Complete"); #endregion }
protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e) { #region Загрузка элементов InitialDirectiveArray.Clear(); if (ResultDirectiveArray != null) { ResultDirectiveArray.Clear(); } AnimatedThreadWorker.ReportProgress(0, "load directives"); if (ViewedType.IsSubclassOf(typeof(StaticDictionary))) { PropertyInfo p = ViewedType.GetProperty("Items"); ConstructorInfo ci = ViewedType.GetConstructor(new Type[0]); StaticDictionary instance = (StaticDictionary)ci.Invoke(null); InitialDirectiveArray.AddRange((IDictionaryCollection)p.GetValue(instance, null)); InitialDirectiveArray.RemoveById(-1); } else { //TODO:(Evgenii Babak) нужен Helper if (ViewedType.Name == nameof(NonRoutineJob)) { InitialDirectiveArray.AddRange(GlobalObjects.NonRoutineJobCore.GetNonRoutineJobs().ToArray()); } else { if (GlobalObjects.CasEnvironment != null) { InitialDirectiveArray.AddRange(GlobalObjects.CasEnvironment?.Loader.GetObjectCollection(ViewedType, loadChild: true)); } else { var dto = (CAADtoAttribute)ViewedType.GetCustomAttributes(typeof(CAADtoAttribute), false).FirstOrDefault(); var res = GlobalObjects.CaaEnvironment.NewLoader.GetObjectList(dto.Type, ViewedType, loadChild: true); InitialDirectiveArray.AddRange((IEnumerable <IBaseEntityObject>)res); } } } AnimatedThreadWorker.ReportProgress(40, "filter directives"); #region Фильтрация директив AnimatedThreadWorker.ReportProgress(70, "filter directives"); FilterItems(InitialDirectiveArray, ResultDirectiveArray); if (AnimatedThreadWorker.CancellationPending) { e.Cancel = true; return; } #endregion if (_showWorkPackageOperationContextMenu) { AnimatedThreadWorker.ReportProgress(90, "comparison with the Work Packages"); if (GlobalObjects.CasEnvironment != null) { //загрузка рабочих пакетов для определения //перекрытых ими выполнений задач if (_openPubWorkPackages == null) { _openPubWorkPackages = new CommonCollection <WorkPackage>(); } _openPubWorkPackages.Clear(); _openPubWorkPackages.AddRange(GlobalObjects.WorkPackageCore.GetWorkPackagesLite(CurrentAircraft, WorkPackageStatus.Opened)); _openPubWorkPackages.AddRange(GlobalObjects.WorkPackageCore.GetWorkPackagesLite(CurrentAircraft, WorkPackageStatus.Published)); } } #region Загрузка Котировочных ордеров AnimatedThreadWorker.ReportProgress(95, "Load Quotations"); //загрузка рабочих пакетов для определения //перекрытых ими выполнений задач if (_openPubQuotations == null) { _openPubQuotations = new CommonCollection <RequestForQuotation>(); } if (GlobalObjects.CasEnvironment != null) { _openPubQuotations.Clear(); _openPubQuotations.AddRange(GlobalObjects.PurchaseCore. GetRequestForQuotation(CurrentOperator, new[] { WorkPackageStatus.Opened, WorkPackageStatus.Published })); } #endregion if (AnimatedThreadWorker.CancellationPending) { e.Cancel = true; return; } AnimatedThreadWorker.ReportProgress(100, "Complete"); #endregion }