public static IObservable<StatusCollection> GetListStatuses( this TwitterAccount account, ListId listId, StatusId? sinceId = null, StatusId? maxId = null, int? count = null, bool? includeEntities = null, bool? includeRts = true) { const string endpoint = "lists/statuses"; var client = account.ToOAuthClient(endpoint); client.Parameters.Add("list_id", listId); client.Parameters.Add("owner_id", account.UserId); if (sinceId.HasValue) client.Parameters.Add("since_id", sinceId.Value); if (maxId.HasValue) client.Parameters.Add("max_id", maxId.Value); if (count.HasValue) client.Parameters.Add("count", count.Value); if (includeEntities.HasValue) client.Parameters.Add("include_entities", includeEntities.Value); if (includeRts.HasValue) client.Parameters.Add("include_rts", includeRts.Value); return Observable .Defer(() => client.GetResponseText()) .Select(json => StatusCollection.Parse(json)) .OnErrorRetry(3) .WriteLine(endpoint); }
public TweetsViewModel(ListProvider ListIdProvider, ITabFactory tabFactory) { Disposable = new CompositeDisposable(); TabFactory = tabFactory; this.ListProvider = ListIdProvider; ListId = this.ListProvider.Id.ToReadOnlyReactivePropertySlim(); Tabs = new ObservableCollection <TabBase>(); // TODO 前回起動時のタブを呼び出す処理を追加 OnLoaded = new ReactiveCommand <RoutedEventArgs>() .AddTo(Disposable); OnCurrentTabChanged = new ReactiveCommand <SelectionChangedEventArgs>() .AddTo(Disposable); ReloadPast = new ReactiveCommand() .AddTo(Disposable); TabCloseCommand = new ReactiveCommand <RoutedEventArgs>() .AddTo(Disposable); CurrentTabChangedCommandByButtonCommand = new ReactiveCommand <RoutedEventArgs>() .AddTo(Disposable); ListId.Subscribe(async e => await OpenListTabAction(e)) .AddTo(Disposable); OnLoaded.Subscribe(e => OnLoadedAction(e)) .AddTo(Disposable); OnCurrentTabChanged.Subscribe(e => OnCurrentTabChangedAction()) .AddTo(Disposable); ReloadPast.Subscribe(_ => ReloadPastAction()) .AddTo(Disposable); TabCloseCommand.Subscribe(e => OnTabClose(e)) .AddTo(Disposable); CurrentTabChangedCommandByButtonCommand.Subscribe(e => CurrentTabChangedCommandByButton(e)) .AddTo(Disposable); }
public override int GetHashCode() { return(Gid.GetHashCode() ^ ListId.GetHashCode() ^ LinkId.GetHashCode() ^ Url.GetHashCode()); }
public static IObservable<List> ShowList(this TwitterAccount account, ListId listId) { const string endpoint = "lists/show"; var client = account.ToOAuthClient(endpoint); client.Parameters.Add("list_id", listId); return ShowListCore(client, endpoint, account.UserId); }
public List this[ListId id, UserId ownerId] { get { var key = Tuple.Create(id, ownerId); return this.DoReadLockAction(() => this.lists.ContainsKey(key) ? this.lists[key] : null); } }
public override void Validate() { if (string.IsNullOrEmpty(Username) || Username.ContainsSpace()) { throw new ArgumentException("username not valid", nameof(Username)); } if (string.IsNullOrEmpty(ListId) || ListId.ContainsSpace()) { throw new ArgumentException("list id not valid", nameof(ListId)); } }
public static int DeleteRange(params object[] ListId) { var db = new DBCon <T>(); for (int i = 0; i < ListId.Count(); i++) { var Table = db.Table.Find(ListId[i]); Table.UpdatedDate = DateTime.Now; Table.Deleted = true; } return(db.SaveChanges()); }
public List Add(ListId id, UserId ownerId, string name = "") { var key = Tuple.Create(id, ownerId); var after = new List<Action>(); // ロック区間外で実行したいものたち List result; try { this.lockslim.EnterUpgradeableReadLock(); // アップグレード可能モードでロック // 読み取りモードでリストが存在しているかチェック var contains = this.lists.ContainsKey(key); if (contains) { // 既に取得済みのリストの場合は、読み取り専用モードのままそのリストを返す result = this.lists[key]; } else { // 未取得のリストの場合、ロックを書き込みモードにアップグレード try { this.lockslim.EnterWriteLock(); // 新しいリスト情報の場合、新しいオブジェクトを作成 result = new List(id, ownerId) { FullName = name }; this.lists.Add(key, result); after.Add(() => this.RaiseAdded(result)); } finally { if (this.lockslim.IsWriteLockHeld) this.lockslim.ExitWriteLock(); } } } catch (Exception ex) { throw new Exception(string.Format("リストの追加に失敗しました (id: {0})。", id), ex); } finally { if (this.lockslim.IsUpgradeableReadLockHeld) this.lockslim.ExitUpgradeableReadLock(); } after.ForEach(a => a()); return result; }
public override int GetHashCode() { int hash = 1; if (ListId != 0) { hash ^= ListId.GetHashCode(); } hash ^= strings_.GetHashCode(); hash ^= updates_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
/// <summary> /// Determines whether the specified Object is equal to the current Object. /// </summary> /// <param name="obj"></param> /// <returns></returns> public override bool Equals(object obj) { if (obj == null) { return(false); } if (Object.ReferenceEquals(this, obj)) { return(true); } if (this.GetType() != obj.GetType()) { return(false); } var other = (VLClientList)obj; //reference types if (!Object.Equals(Name, other.Name)) { return(false); } //value types if (!Client.Equals(other.Client)) { return(false); } if (!ListId.Equals(other.ListId)) { return(false); } if (!TotalContacts.Equals(other.TotalContacts)) { return(false); } return(true); }
public static IObservable<ICollection<User>> GetListMembers(this TwitterAccount account, ListId listId, bool? skipStatus = true) { const string endpoint = "lists/members"; var cursor = -1L; return Observable .Defer(() => { var client = account.ToOAuthClient(endpoint); client.Parameters.Add("cursor", cursor); client.Parameters.Add("list_id", listId); if (skipStatus.HasValue) client.Parameters.Add("skip_status", skipStatus.Value); return client.GetResponseText(); }) .Select(Collection.ParseUser) .Do(users => cursor = users.NextCursor) .DoWhile(() => cursor != -1 && cursor != 0) .Aggregate((user1, user2) => { user1.Objects.AddRange(user2.Objects); return user1; }) .Select(users => users.Objects) .Do(users => { var list = TwitterClient.Current.Lists[listId, account.UserId] ?? TwitterClient.Current.Lists.Add(listId, account.UserId); list.Members = new HashSet<UserId>(users.Select(u => u.Id)); list.HasMembers = true; }) .OnErrorRetry(3) .WriteLine(endpoint, ids => ids.Count + " users"); }
public override string ToString() { //return ListId.ToString() + ";" + FieldId.ToString() + ";" + _searchFields + ";" + MaxSearchResults + ";" + EntityEditorRows + ";" + WebId.ToString(); return(ListId.ToString() + ";" + WebId.ToString() + ";" + ItemId.ToString() + ";" + QueryBox.ToString()); }
public List(ListId id, UserId ownerId) { this.Id = id; this.OwnerId = ownerId; if (!this.TrySetAccount(ownerId)) { this.listener = new CollectionChangedEventListener( TwitterClient.Current.Accounts, (sender, e) => this.TrySetAccount(ownerId)); } }
public override string ToString() { return(ListId.ToString() + ";" + FieldId.ToString() + ";" + _searchFields + ";" + MaxSearchResults + ";" + EntityEditorRows + ";" + WebId.ToString()); }
public override int GetHashCode() { return((ListId.ToString() + Key).GetHashCode()); }
public IEnumerable <CardId> GetCardsInListsInTimeframe(DateTime start, DateTime end, CardStatus status) { string[] listIds; switch (status) { case CardStatus.Other: throw new ArgumentOutOfRangeException(nameof(status), status, null); case CardStatus.Doing: listIds = _doingListsIds; break; case CardStatus.Done: listIds = _doneListsIds; break; default: throw new ArgumentOutOfRangeException(nameof(status), status, null); } var nisse = _trello.Actions.ForCard(new CardId("57dfe7fb3ef9ee3a31263c23")) .OfType <UpdateCardMoveAction>() .Select(a => new MoveCardAction(a)) .ToList(); nisse.Sort((a1, a2) => { if (a1.CardId == a2.CardId) { return(a1.Date <a2.Date ? -1 : a1.Date> a2.Date ? 1 : 0); } return(string.CompareOrdinal(a1.CardId, a2.CardId)); }); var cardsInLists = new Dictionary <int, CardId>(); var allLists = _trello.Lists.ForBoard(Board); var actions = new Dictionary <int, MoveCardAction>(); foreach (var listId in allLists) { var list = new ListId(listId.Id); var listMoves = _trello.Actions.ForList(list).OfType <UpdateCardMoveAction>().Where(a => a.Date <= end).Select(a => new MoveCardAction(a)).ToList(); foreach (var move in listMoves) { var key = move.GetHashCode(); if (!actions.ContainsKey(key)) { actions.Add(key, move); } } } var moves = actions.Values.ToList(); moves.Sort((a1, a2) => { if (a1.CardId == a2.CardId) { return(a1.Date <a2.Date ? -1 : a1.Date> a2.Date ? 1 : 0); } return(string.CompareOrdinal(a1.CardId, a2.CardId)); }); foreach (var move in moves) { var card = new CardId(move); var key = card.GetHashCode(); if (listIds.Any(id => id == move.ListAfter.Id)) { if (!cardsInLists.ContainsKey(key)) { cardsInLists.Add(key, card); } } else if (move.Date < start && cardsInLists.ContainsKey(key)) { cardsInLists.Remove(key); } } return(cardsInLists.Values); }
public int GetETListIdByCommitteeID() { using (var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DynamicsExtension"].ConnectionString)) { return(conn.Query <int>(@"SELECT ETListID from [dbo].[ETAutomation_Committee_ETList_Map] WHERE [CommitteeID] = @CommitteeID", new { CommitteeID = ListId.ToString() }).SingleOrDefault()); } }
/// <summary> /// Determines whether the specified Object is equal to the current Object. /// </summary> /// <param name="obj"></param> /// <returns></returns> public override bool Equals(object obj) { if (obj == null) { return(false); } if (Object.ReferenceEquals(this, obj)) { return(true); } if (this.GetType() != obj.GetType()) { return(false); } var other = (VLContact)obj; //reference types if (!Object.Equals(Organization, other.Organization)) { return(false); } if (!Object.Equals(Title, other.Title)) { return(false); } if (!Object.Equals(Department, other.Department)) { return(false); } if (!Object.Equals(FirstName, other.FirstName)) { return(false); } if (!Object.Equals(LastName, other.LastName)) { return(false); } if (!Object.Equals(Email, other.Email)) { return(false); } if (!Object.Equals(Comment, other.Comment)) { return(false); } //value types if (!ClientId.Equals(other.ClientId)) { return(false); } if (!ListId.Equals(other.ListId)) { return(false); } if (!ContactId.Equals(other.ContactId)) { return(false); } if (!AttributeFlags.Equals(other.AttributeFlags)) { return(false); } return(true); }