public bool Add(ParseUser member)
        {
            var match = _members.FirstOrDefault(u => u.ObjectId == member.ObjectId);

            if (match != null)
            {
                SelectedMember = match;
                return(false);
            }
            else
            {
                _members.Add(member);
                SelectedMember = member;
                return(true);
            }
        }
Пример #2
0
        public void BeginOpenAssemblies(string[] filenames, bool partialTrust)
        {
            if (filenames.Length == 0)
            {
                return;
            }

            // Create Assembly objects with AppDomains
            foreach (string fn in filenames)
            {
                string baseFolder = Path.GetFullPath(Path.Combine(fn, ".."));
                if (!_assemblies.Any(a => a.Path == fn))
                {
                    var ass = _assemblies.FirstOrDefault(a => a.Domain.BaseFolder == baseFolder && a.Domain.PartialTrust == partialTrust);
                    var adh = ass != null ? ass.Domain : new AppDomainHolder(baseFolder, Path.GetFileNameWithoutExtension(fn), partialTrust);
                    _assemblies.Add(new Assembly {
                        Path = fn, Domain = adh
                    });
                }
            }

            // Start scan tasks
            var newTasks = new List <AssemblyScanTask>();

            foreach (var ass in _assemblies.Where(a => a.Row == null))
            {
                                #pragma warning disable 618 // method is "obsolete" in .NET4 but its replacement does not exist in .NET 3.5
                var task = (AssemblyScanTask)Activator.CreateInstanceFrom(ass.Domain.Domain,
                                                                          typeof(AssemblyScanTask).Assembly.ManifestModule.FullyQualifiedName,
                                                                          typeof(AssemblyScanTask).FullName, false,
                                                                          0, null, new object[] { ass.Path, ass.Domain.BaseFolder }, null, null, null).Unwrap();
                ass.Row = new TaskRowModel(Path.GetFileName(ass.Path), TestNodeType.Assembly, task, false);
                newTasks.Add(task);
            }
            _runner.AddTasks(newTasks.Upcast <ITask, AssemblyScanTask>());
            _runner.AutoStartTasks();
        }
Пример #3
0
 public Session LoadSession(int sessionId)
 {
     return(_sessions.FirstOrDefault(s => s.Id == sessionId));
 }