Ejemplo n.º 1
0
 public override bool Equals(object obj)
 {
     if (obj is StoredQueryNodeViewModel)
     {
         StoredQueryNodeViewModel other = obj as StoredQueryNodeViewModel;
         return(string.Equals(other.Name, Name));
     }
     else if (obj is string)
     {
         string other = obj as string;
         return(string.Equals(other, Name));
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 2
0
        void m_worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (m_disposeRequested)
            {
                Dispose();
                return;
            }
            if (e.Error == null)
            {
                Debug.Assert(e.Result is Dictionary <string, bool>, "Wrong result type");
                Dictionary <string, bool> queryList = e.Result as Dictionary <string, bool>;

                List <string> queries = queryList.Keys.ToList();
                queries.Sort();

                foreach (string query in queries)
                {
                    string[] path = query.Split('/');
                    StoredQueryNodeViewModel current = Root;
                    for (int i = 0; i < path.Length; i++)
                    {
                        StoredQueryNodeViewModel childNode = current.Children.FirstOrDefault(x => string.Equals(x.Name, path[i]));
                        if (childNode == null)
                        {
                            childNode = new StoredQueryNodeViewModel(path[i]);
                            current.Children.Add(childNode);
                        }
                        current = childNode;
                        if (i == path.Length - 1)
                        {
                            current.Query   = query;
                            current.IsValid = queryList[query];
                        }
                    }
                }
            }
            IsLoading = false;
        }