private void DispatchAllModels() { lock (m_Lock) { foreach (var model in m_ModelsDispatchQueue) { SwDocument doc; switch (model) { case IPartDoc part: doc = new SwPart(part, m_App, m_Logger, true); break; case IAssemblyDoc assm: doc = new SwAssembly(assm, m_App, m_Logger, true); break; case IDrawingDoc drw: doc = new SwDrawing(drw, m_App, m_Logger, true); break; default: throw new NotSupportedException(); } Dispatched?.Invoke(doc); } m_ModelsDispatchQueue.Clear(); } }
private void DispatchAllModels() { lock (m_Lock) { m_Logger.Log($"Dispatching all ({m_ModelsDispatchQueue.Count}) models"); foreach (var model in m_ModelsDispatchQueue) { SwDocument doc; switch (model) { case IPartDoc part: doc = new SwPart(part, (SwApplication)m_App, m_Logger, true); break; case IAssemblyDoc assm: doc = new SwAssembly(assm, (SwApplication)m_App, m_Logger, true); break; case IDrawingDoc drw: doc = new SwDrawing(drw, (SwApplication)m_App, m_Logger, true); break; default: throw new NotSupportedException(); } NotifyDispatchedSafe(doc); } m_ModelsDispatchQueue.Clear(); m_Logger.Log($"Cleared models queue"); } }
private void DispatchAllModels() { lock (m_Lock) { m_Logger.Log($"Dispatching all ({m_ModelsDispatchQueue.Count}) models", LoggerMessageSeverity_e.Debug); var errors = new List <Exception>(); foreach (var modelInfo in m_ModelsDispatchQueue) { SwDocument doc; if (TryFindModel(modelInfo, out IModelDoc2 model)) { switch (model) { case IPartDoc part: doc = new SwPart(part, m_App, m_Logger, true); break; case IAssemblyDoc assm: doc = new SwAssembly(assm, m_App, m_Logger, true); break; case IDrawingDoc drw: doc = new SwDrawing(drw, m_App, m_Logger, true); break; case null: errors.Add(new NullReferenceException("Model is null")); continue; default: errors.Add(new NotSupportedException($"Invalid cast of '{modelInfo.Path}' [{modelInfo.Title}] of type '{((object)model).GetType().FullName}'. Specific document type: {(swDocumentTypes_e)model.GetType()}")); continue; } NotifyDispatchedSafe(doc); } else { m_Logger.Log($"Failed to find the loaded model: {modelInfo.Title} ({modelInfo.Path}). This may be due to the external reference which is not loaded", LoggerMessageSeverity_e.Error); } } m_ModelsDispatchQueue.Clear(); m_Logger.Log($"Cleared models queue", LoggerMessageSeverity_e.Debug); if (errors.Any()) { throw new DocumentsQueueDispatchException(errors.ToArray()); } } }
public SwComponentFeatureManager(SwComponent comp, SwAssembly assm, ISwApplication app) : base(assm, app) { m_Assm = assm; Component = comp; }