private void UpdateStudConnectorList() { if (CurrentProject == null) { ConnectorList.Clear(); } else { var studConnections = CurrentProject.GetAllElements <PartConnection>() .Where(x => x.ConnectorType == ConnectorType.Custom2DField).ToList(); foreach (var studConn in studConnections) { if (string.IsNullOrEmpty(studConn.ID)) { continue; } var comboItem = ConnectorList.FirstOrDefault(x => x.ID == studConn.ID); if (comboItem == null) { comboItem = new ConnectorComboItem(studConn); comboItem.ConnTypeText = studConn.SubType == 22 ? BottomStudsLabel.Text : TopStudsLabel.Text; ConnectorList.Add(comboItem); } } var validConnectionIDs = studConnections.Select(x => x.ID).ToList(); var usedConnectionIDs = CurrentProject.GetAllElements <StudReference>() .Select(x => x.ConnectionID).Distinct().ToList(); foreach (var comboItem in ConnectorList.ToArray()) { if (!validConnectionIDs.Contains(comboItem.ID) && !usedConnectionIDs.Contains(comboItem.ID)) { ConnectorList.Remove(comboItem); } } } }
public void start() { while (true) { var now = DateTime.Now; try { var twList = twitterListDataSource.ToArray(); var alartLvList = new List <TwitterInfo>(); foreach (var ti in twList) { var timelineLvList = getUserTweetLvidList(ti); if (timelineLvList == null) { continue; } process(timelineLvList, ti); } } catch (Exception e) { util.debugWriteLine(e.Message + e.Source + e.StackTrace + e.TargetSite); } Thread.Sleep(60 * 10 * 1000); } }
private void ScanThread() { //List<Imageboard> goneThreads = new List<Imageboard>(); lock (threadLock) { // Removes 404'd threads Thread[] array = ThreadListBindingSource.ToArray(); for (int i = 0; i < array.Length; i++) { Thread thread = array[i]; if (thread.Gone) { RemoveThread(thread); //goneThreads.Add(thread); } } if (Properties.Settings.Default.saveOnClose) { Utils.SaveURLs(BoardList, ThreadListBindingSource.ToList()); } } lock (boardLock) { // Searches for new threads on the watched boards for (int i = 0; i < BoardList.Count; i++) { string[] threads = { }; try { threads = BoardList[i].GetThreadLinks(); } catch { } finally { for (int i1 = 0; i1 < threads.Length; i1++) { Thread newThread = (Thread)Utils.CreateNewTracker(threads[i1]); if (newThread != null && IsUnique(newThread.URL, ThreadListBindingSource)) { AddURLToList(newThread); } } } } } lock (threadLock) { // Download threads for (int i = 0; i < ThreadListBindingSource.Count; i++) { ThreadPool.QueueUserWorkItem(new WaitCallback(ThreadListBindingSource[i].Download)); } } }