diff --git a/TuneUp/ProfiledNodeViewModel.cs b/TuneUp/ProfiledNodeViewModel.cs index 53468c9..d6848e7 100644 --- a/TuneUp/ProfiledNodeViewModel.cs +++ b/TuneUp/ProfiledNodeViewModel.cs @@ -71,44 +71,7 @@ public bool IsGroupExecutionTime RaisePropertyChanged(nameof(IsGroupExecutionTime)); } } - private bool isGroupExecutionTime = false; - - /// - /// Getting the original name before graph author renamed the node - /// - /// target NodeModel - /// Original node name as string - private static string GetOriginalName(NodeModel node) - { - if (node == null) return string.Empty; - // For dummy node, return the current name so that does not appear to be renamed - if (node is DummyNode) - { - return node.Name; - } - if (node.IsCustomFunction) - { - // If the custom node is not loaded, return the current name so that does not appear to be renamed - if ((node as Function).State == ElementState.Error && (node as Function).Definition.IsProxy) - { - return node.Name; - } - // If the custom node is loaded, return original name as usual - var customNodeFunction = node as Function; - return customNodeFunction?.Definition.DisplayName; - } - - var function = node as DSFunctionBase; - if (function != null) - return function.Controller.Definition.DisplayName; - - var nodeType = node.GetType(); - var elNameAttrib = nodeType.GetCustomAttributes(false).FirstOrDefault(); - if (elNameAttrib != null) - return elNameAttrib.Name; - - return nodeType.FullName; - } + private bool isGroupExecutionTime = false; /// /// Prefix string of execution time. @@ -336,6 +299,59 @@ public string StateDescription #endregion + /// + /// Getting the original name before graph author renamed the node + /// + /// target NodeModel + /// Original node name as string + private static string GetOriginalName(NodeModel node) + { + if (node == null) return string.Empty; + // For dummy node, return the current name so that does not appear to be renamed + if (node is DummyNode) + { + return node.Name; + } + if (node.IsCustomFunction) + { + // If the custom node is not loaded, return the current name so that does not appear to be renamed + if ((node as Function).State == ElementState.Error && (node as Function).Definition.IsProxy) + { + return node.Name; + } + // If the custom node is loaded, return original name as usual + var customNodeFunction = node as Function; + return customNodeFunction?.Definition.DisplayName; + } + + var function = node as DSFunctionBase; + if (function != null) + return function.Controller.Definition.DisplayName; + + var nodeType = node.GetType(); + var elNameAttrib = nodeType.GetCustomAttributes(false).FirstOrDefault(); + if (elNameAttrib != null) + return elNameAttrib.Name; + + return nodeType.FullName; + } + + internal void ResetGroupProperties() + { + GroupGUID = Guid.Empty; + GroupName = string.Empty; + GroupExecutionOrderNumber = null; + GroupExecutionTime = TimeSpan.Zero; + } + + internal void ApplyGroupProperties(ProfiledNodeViewModel profiledGroup) + { + GroupGUID = profiledGroup.GroupGUID; + GroupName = profiledGroup.GroupName; + GroupExecutionOrderNumber = profiledGroup.GroupExecutionOrderNumber; + BackgroundBrush = profiledGroup.BackgroundBrush; + } + /// /// Create a Profiled Node View Model from a NodeModel /// diff --git a/TuneUp/TuneUpWindow.xaml b/TuneUp/TuneUpWindow.xaml index bcf6aa7..f9599d3 100644 --- a/TuneUp/TuneUpWindow.xaml +++ b/TuneUp/TuneUpWindow.xaml @@ -74,8 +74,8 @@ - - + + - + Visibility="Collapsed" /> + - - - + @@ -185,7 +188,7 @@ - + @@ -218,7 +221,7 @@ - + @@ -227,14 +230,15 @@ - + @@ -253,46 +257,49 @@ - - - + - + - + - + - + - - + + - - - + - + - - + + - - - + + - - + + - - + + - - + + - - - - + + + - +