Example #1
0
        public override void Highlight()
        {
            List <string> listConfigPaths;

            lock (cacheConfigPaths)
            {
                if (cacheConfigPaths.ContainsKey(package))
                {
                    listConfigPaths = cacheConfigPaths[package];
                }
                else
                {
                    listConfigPaths = new List <string>();
                }
            }

            CachedHighlightStatus status = null;

            if (!cacheTransforms.TryGetValue(transformUniqueID, out status) || Rescan)
            {
                bool bHasConfiguration = false;
                bool bHasExpression    = HasExpression(taskHost, transformName, listConfigPaths, out bHasConfiguration);
                status = new CachedHighlightStatus(package, taskHost, bHasExpression, bHasConfiguration);
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("highlighting from cache for: " + transformUniqueID);
            }

#if DENALI || SQL2014
            this.dataFlowTransformModelElement.Dispatcher.BeginInvoke //enables this code to run on the application thread or something like that and avoids errors
                (System.Windows.Threading.DispatcherPriority.Normal,
                (Action)(() =>
            {
                System.Windows.FrameworkElement fe = (System.Windows.FrameworkElement) this.dataFlowTransformModelElement.View;
                if (fe != null)     //the sequence container for the Package object itself has a null view. TODO is how to add a configuration highlight to the background of the package itself
                {
                    Adorners.BIDSHelperConfigurationAdorner adorner = new Adorners.BIDSHelperConfigurationAdorner(fe, typeof(Microsoft.SqlServer.Graph.Model.ModelElement));
                    adorner.UpdateAdorner(status.bHasExpression, status.bHasConfiguration);
                }
            }
                         ));
#else
            HighlightDdsDiagramObjectIcon(dataFlowDiagram, transformManagedShape, status.bHasExpression, status.bHasConfiguration);
#endif

            if (cacheTransforms.ContainsKey(transformUniqueID))
            {
                cacheTransforms[transformUniqueID] = status;
            }
            else
            {
                cacheTransforms.Add(transformUniqueID, status);
            }
        }
Example #2
0
        public static void HighlightConnectionManagerLVI(ListViewItem lviConn)
        {
            ConnectionManager connection      = (ConnectionManager)lviConn.GetType().InvokeMember("Component", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.GetProperty, null, lviConn, null);
            Package           package         = null;
            List <string>     listConfigPaths = new List <string>();

            lock (cacheConfigPaths)
            {
                foreach (Package p in cacheConfigPaths.Keys)
                {
                    if (p.Connections.Contains(connection.ID) && p.Connections[connection.ID] == connection)
                    {
                        package         = p;
                        listConfigPaths = cacheConfigPaths[package];
                        break;
                    }
                }
                if (package == null)
                {
                    System.Diagnostics.Debug.WriteLine("HighlightConnectionManager: can't find package for connection!!!");
                    return;
                }
            }

            bool bHasConfiguration = false;
            bool bHasExpression    = false;

            if (!cacheConnectionManagers.ContainsKey(connection))
            {
                System.Diagnostics.Debug.WriteLine("HighlightConnectionManager: not cached!!!");
                bHasExpression = HasExpression(connection, listConfigPaths, out bHasConfiguration);
                if (cacheConnectionManagers.ContainsKey(connection))
                {
                    cacheConnectionManagers[connection] = new CachedHighlightStatus(package, bHasExpression, bHasConfiguration);
                }
                else
                {
                    lock (cacheConnectionManagers)
                        cacheConnectionManagers.Add(connection, new CachedHighlightStatus(package, bHasExpression, bHasConfiguration));
                }
            }
            else
            {
                CachedHighlightStatus ccm = cacheConnectionManagers[connection];
                bHasExpression    = ccm.bHasExpression;
                bHasConfiguration = ccm.bHasConfiguration;
            }
            HighlightConnectionManagerLVI(lviConn, bHasExpression, bHasConfiguration, false);
        }
Example #3
0
        public override void Highlight()
        {
            List <string> listConfigPaths;

            lock (cacheConfigPaths)
            {
                if (cacheConfigPaths.ContainsKey(package))
                {
                    listConfigPaths = cacheConfigPaths[package];
                }
                else
                {
                    listConfigPaths = new List <string>();
                }
            }

            bool bHasConfiguration = false;
            bool bHasExpression    = false;

            if (Rescan || !cacheConnectionManagers.ContainsKey(connection)) //note this is not allowing highlighting of connections on event handlers tab since the event handlers tab is not loaded when you first load the package... TODO... consider changing the cacheConnectionManagers object to track which tabs have been highlighted before
            {
                System.Diagnostics.Debug.WriteLine("scanning connection manager for expressions & configurations");
                bHasExpression = HasExpression(connection, listConfigPaths, out bHasConfiguration); //also figures out whether it has configurations
                if (cacheConnectionManagers.ContainsKey(connection))
                {
                    cacheConnectionManagers[connection] = new CachedHighlightStatus(this.package, bHasExpression, bHasConfiguration);
                }
                else
                {
                    lock (cacheConnectionManagers)
                        cacheConnectionManagers.Add(connection, new CachedHighlightStatus(this.package, bHasExpression, bHasConfiguration));
                }
            }
            else
            {
                CachedHighlightStatus ccm = cacheConnectionManagers[connection];
                bHasExpression    = ccm.bHasExpression;
                bHasConfiguration = ccm.bHasConfiguration;
                System.Diagnostics.Debug.WriteLine("scanning connection manager for expressions & configurations from cache");
            }

            lock (listConnectionLVIs)
            {
                foreach (System.Windows.FrameworkElement fe in listConnectionLVIs)
                {
                    if (fe != null)
                    {
                        fe.Dispatcher.BeginInvoke //enables this code to run on the application thread or something like that and avoids errors
                            (System.Windows.Threading.DispatcherPriority.Normal,
                            (Action)(() =>
                        {
                            System.Diagnostics.Debug.WriteLine("ExpressionHighlighter - adding connection adorner " + connection.Name);
                            Adorners.BIDSHelperConfigurationAdorner adorner = new Adorners.BIDSHelperConfigurationAdorner(fe, typeof(ConnectionManagerModelElement));
                            adorner.UpdateAdorner(false, bHasConfiguration);     //only highlight configurations
                        }
                                     ));
                    }
                }
            }

            //the lvwConnMgrs_DrawItem event will take care of painting the connection managers 90% of the time
            //unfortunately we had to use the lvwConnMgrs_DrawItem to catch all the appropriate times we needed to refix the icon
        }
Example #4
0
        public override void Highlight()
        {
            List <string> listConfigPaths;

            lock (cacheConfigPaths)
            {
                if (cacheConfigPaths.ContainsKey(package))
                {
                    listConfigPaths = cacheConfigPaths[package];
                }
                else
                {
                    listConfigPaths = new List <string>();
                }
            }

            CachedHighlightStatus status = null;

            if (!cacheTasks.TryGetValue(executable, out status) || Rescan)
            {
                if (AllTransformsAreCached(transforms)) //all transforms should be cached if we're focused on the data flow window such that transforms are foreground tasks and the control flow task is a background task
                {
                    bool bTaskHasExpression    = false;
                    bool bTaskHasConfiguration = false;

                    lock (transforms)
                    {
                        foreach (string str in transforms)
                        {
                            CachedHighlightStatus transformStatus = cacheTransforms[str];
                            bTaskHasExpression    = bTaskHasExpression || transformStatus.bHasExpression;
                            bTaskHasConfiguration = bTaskHasConfiguration || transformStatus.bHasConfiguration;
                        }
                    }

                    status = new CachedHighlightStatus(package, bTaskHasExpression, bTaskHasConfiguration);
                    System.Diagnostics.Debug.WriteLine("highlighting data flow task from transforms cache");
                }
                else
                {
                    bool bHasConfiguration = false;
                    bool bHasExpression    = HasExpression(executable, listConfigPaths, out bHasConfiguration);
                    status = new CachedHighlightStatus(package, bHasExpression, bHasConfiguration);
                }
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("highlighting task from cache");
            }

            this.controlFlowTaskModelElement.Dispatcher.BeginInvoke //enables this code to run on the application thread or something like that and avoids errors
                (System.Windows.Threading.DispatcherPriority.Normal,
                (Action)(() =>
            {
                System.Windows.FrameworkElement fe = (System.Windows.FrameworkElement) this.controlFlowTaskModelElement.View;
                if (fe != null)     //the sequence container for the Package object itself has a null view. TODO is how to add a configuration highlight to the background of the package itself... this seems to do the trick but there's more formatting work to do: fe = (System.Windows.FrameworkElement)(((Microsoft.SqlServer.IntegrationServices.Designer.Model.SequenceModelElement)(controlFlowTaskModelElement)).GraphModelElement).GraphControl
                {
                    System.Diagnostics.Debug.WriteLine("ExpressionHighlighter - adding task adorner " + controlFlowTaskModelElement.Name);
                    Adorners.BIDSHelperConfigurationAdorner adorner = new Adorners.BIDSHelperConfigurationAdorner(fe, typeof(Microsoft.SqlServer.Graph.Model.ModelElement));
                    adorner.UpdateAdorner(false, status.bHasConfiguration);     //only highlight configurations
                }
            }
                         ));


            if (cacheTasks.ContainsKey(executable))
            {
                cacheTasks[executable] = status;
            }
            else
            {
                cacheTasks.Add(executable, status);
            }
        }