Exemple #1
0
        public void Refresh(ObservableCollection<TreeViewItemModel> items, DataController controller)
        {
            if (KnownSystemServices == null)
            {
                KnownSystemServices = new Dictionary<string, bool>() {
                    { "smss", true },
                    { "svchost", true },
                    { "services", true },
                    { "csrss", true }
                };
            }

            /// buildup dictionary of existing items
            Dictionary<string, TreeViewItemModel> dict = new Dictionary<string, TreeViewItemModel>(StringComparer.CurrentCultureIgnoreCase);
            foreach(TreeViewItemModel model in items)
            {
                dict[model.Key] = model;
                model.IsValid = false;
                model.IsNew = false;
            }

            controller.Refresh(dict);

            foreach(TreeViewItemModel model in dict.Values)
            {
                if(model.IsNew)
                    items.Add(model);
            }

            // remove stale items
            foreach (TreeViewItemModel model in items)
            {
                if(!model.IsValid)
                    items.Remove(model);
            }
        }
Exemple #2
0
 public DataView(DataController controller, Button button)
 {
     Controller = controller;
     Button     = button;
 }
 public DataView(DataController controller, Button button)
 {
     Controller = controller;
     Button = button;
 }