public static void Add(ListView view, string sfOffset, string name, string type, string value, VariableKind kind, IntPtr sf, IntPtr pc, int callDepth)
        {
            var s = new SFItem {
                Name = name, SFOffset = sfOffset, Type = type, Value = value, Kind = kind, SF = sf, PC = pc, CallDepth = callDepth
            };
            var item = new ListViewItem {
                Content = s
            };

            switch (kind)
            {
            case VariableKind.Global:
                item.Foreground = Brushes.DimGray;
                break;

            case VariableKind.Input:
                item.Foreground = Brushes.Black;
                break;

            case VariableKind.Output:
                item.Foreground = Brushes.Black;
                break;

            case VariableKind.Local:
                item.Foreground = Brushes.Black;
                break;

            case VariableKind.Pseudo:
                item.Foreground = Brushes.Red;
                break;
            }

            view.Items.Add(item);
        }
 private static void OnItemSelected(Project project, SFItem item, ListView view)
 {
     if (item.SF != IntPtr.Zero)
     {
         var variables = project.GetElements(item.Name, item.CallDepth);
         foreach (var v in variables)
         {
             if (FindItem(v, view) == null)
             {
                 Add(view, v.SFOffset.ToString("X"), v.Name, v.Type, v.Value, v.Direction, item.SF, item.PC, item.CallDepth);
             }
         }
     }
 }
        private static void OnItemSelected(Project project, SFItem item, TreeView targetView)
        {
            string sfToItem;

            int result;

            if (int.TryParse(item.SFOffset, out result))
            {
                IntPtr ipResult = new IntPtr(result);
                sfToItem = AddPointer(item.SF, result).ToString("X");
            }
            else
            {
                sfToItem = string.Empty;
            }

            if (item.SF != IntPtr.Zero)
            {
                targetView.Items.Clear();

                var variables = project.GetElements(item.Name, item.CallDepth);

                TreeViewItem topLevel = new TreeViewItem();
                topLevel.Tag = item.Name;
                UpdateItem(topLevel, item.Name, "", "", sfToItem, item.SF, item.PC);

                targetView.Items.Add(topLevel);

                foreach (var v in variables)
                {
                    string head, tail;
                    if (!Strings.SplitHead(v.Name, out head, out tail))
                    {
                        tail = v.Name;
                    }

                    Add(targetView, topLevel, tail, v.Type, v.Value, v.Address.ToString("X"), item.SF, item.PC);
                }
            }
        }