Exemplo n.º 1
0
        public IEnumerable <ActiveSearch> DoMatchmaking(ActiveSearch search)
        {
            var matches = _context.ActiveSearchs.Find(s => s.SearchingGame == search.SearchingGame).ToList().Where(s =>
                                                                                                                   search.Parameters.TrueForAll(s.Parameters.Contains));

            return(matches);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handles the Click event of the searchButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void SearchButtonClick(object sender = null, RoutedEventArgs e = null)
        {
            if (string.IsNullOrWhiteSpace(textBox.Text))
            {
                return;
            }

            if (_searching)
            {
                ActiveSearch.CancelAsync();
                DownloadSearchDone();
                return;
            }

            _results = new ConcurrentBag <LinkItem>();
            DownloadLinksListViewItemCollection.Clear();

            textBox.IsEnabled    = false;
            searchButton.Content = "Cancel";

            ActiveSearch = new DownloadSearch(AutoDownloader.ActiveSearchEngines, filterResults.IsChecked);

            ActiveSearch.DownloadSearchDone          += DownloadSearchDone;
            ActiveSearch.DownloadSearchEngineNewLink += DownloadSearchEngineNewLink;
            ActiveSearch.DownloadSearchEngineDone    += DownloadSearchEngineDone;
            ActiveSearch.DownloadSearchEngineError   += DownloadSearchEngineError;

            SetStatus("Searching for download links on " + (string.Join(", ", ActiveSearch.SearchEngines.Select(engine => engine.Name).ToArray())) + "...", true);

            _searching = true;

            ActiveSearch.SearchAsync(textBox.Text);

            Utils.Win7Taskbar(0, TaskbarProgressBarState.Normal);
        }
Exemplo n.º 3
0
        private void RunSearch()
        {
            Action proc = () => {
                var criteria = new List <Expression <Func <Employee, bool> > >();

                if (!string.IsNullOrWhiteSpace(FirstNameSearch))
                {
                    criteria.Add(e => e.FirstName.StartsWith(FirstNameSearch));
                }

                if (!string.IsNullOrWhiteSpace(LastNameSearch))
                {
                    criteria.Add(e => e.LastName.StartsWith(LastNameSearch));
                }

                if (ActiveSearch.ToLower() == "yes")
                {
                    criteria.Add(e => e.Active == true);
                }

                if (ActiveSearch.ToLower() == "no")
                {
                    criteria.Add(e => e.Active == false);
                }

                if (DepartmentSearch != -1)
                {
                    criteria.Add(e => e.Department.Id == DepartmentSearch);
                }

                EmployeesFound = new EmployeeBL(_database).Search(criteria).ToObservable();
            };

            SharedCode.Try(proc);
        }
Exemplo n.º 4
0
        public static bool AddUserToExistingChannel(this ActiveSearch search, long userId)
        {
            if (search.DiscordRoleId == 0 || search.DiscordChannelId == 0)
            {
                return(false);
            }

            AddRoleToUsers(search.DiscordRoleId, userId);
            return(true);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Initiates a search on this usercontrol.
        /// </summary>
        /// <param name="query">The query.</param>
        public void Search(string query)
        {
            Dispatcher.Invoke((Action)(() =>
            {
                // cancel if one is running
                if (_searching)
                {
                    ActiveSearch.CancelAsync();
                    DownloadSearchDone();
                }

                textBox.Text = query;
                SearchButtonClick();
            }));
        }
Exemplo n.º 6
0
        public static bool CreateChannelForActiveSearch(this ActiveSearch search, params long[] userIds)
        {
            var server = GetLeastPopulatedServer();

            //Creating a new Channel
            if (search.DiscordInviteCode == null)
            {
                search.DiscordChannelId = CreateChannel("dis another more random name" + new Random().Next(10000), server);
                //Creating a channel invite for the new channel
                search.DiscordInviteCode = CreateChannelInvite(search.DiscordChannelId, server);
            }

            if (search.DiscordRoleId == 0)
            {
                //Setting new permissions for the Channel
                search.DiscordRoleId = CreateRoleForLobby(search.DiscordChannelId, server);
                EditEveryonePermissions(search.DiscordChannelId);
                AddRoleToChannel(search.DiscordChannelId, search.DiscordRoleId);
                AddRoleToUsers(search.DiscordRoleId, server, 359727752372420608);
            }

            return(true);
        }
Exemplo n.º 7
0
 public async Task <IActionResult> Post([FromBody] ActiveSearch value)
 {
     return(Ok(await cont.Create(value)));
 }