コード例 #1
0
        public MastodonNotification(int id, string type, MastodonAccount account, MastodonStatus status) : base(id)
        {
            if (account != null)
            {
                this._accounts.Add(account);
            }
            if (status != null)
            {
                this.Status = status;
            }

            switch (type)
            {
            case "mention":
                this.Type = NotificationType.Mention;
                break;

            case "reblog":
                this.Type = NotificationType.Boost;
                break;

            case "favourite":
                this.Type = NotificationType.Favorite;
                break;

            case "follow":
                this.Type = NotificationType.Follow;
                break;

            default:
                this.Type = NotificationType.Unknown;
                break;
            }
        }
コード例 #2
0
        private async void OnAddAccountClickAsync(object sender, RoutedEventArgs e)
        {
            var progdiag = await this.ShowProgressAsync("認証中", "認証処理をしています。しばらくお待ちください。");

            try
            {
                var tokens = await authClient.ConnectWithCode(PinCodeTextBox.Text);

                await Task.Run(() =>
                {
                    var client    = new MastodonClient(registeredApp, tokens);
                    var container = new MastodonAccount(client);
                    Core.ConfigStore.StaticConfig.accountList.Add(container);
                });

                await progdiag.CloseAsync();

                this.Close();
            }
            catch (Exception ex)
            {
                await this.ShowMessageAsync("エラー",
                                            $"何らかのエラーで認証を開始することが出来ませんでした。\n\n{ex}");

                await progdiag.CloseAsync();
            }
        }
コード例 #3
0
 public override DataTemplate SelectTemplate(object item, DependencyObject container)
 {
     return(item switch
     {
         TwitterAccount _ => this.GetTemplate("AccountTemplate.Twitter"),
         MastodonAccount _ => this.GetTemplate("AccountTemplate.Mastodon"),
         _ => base.SelectTemplate(item, container),
     });
コード例 #4
0
        internal MastodonStatus(int id, MastodonAccount account, string content,
                                bool reblogged, bool favorited, MastodonStatus reblog,
                                int?replyToId, int?replyToAccountId,
                                IEnumerable <MastodonAttachment> mediaAttachments, IEnumerable <MastodonTag> tags,
                                DateTime createdAt) : this(id, account)
        {
            if (reblog != null)
            {
                this.BoostedId = reblog.Id;
                this.IsBoost   = true;
            }

            this.Content          = content;
            this.IsFavorited      = favorited;
            this.IsBoosted        = reblogged;
            this.Boost            = reblog;
            this.Account          = account;
            this.IsReply          = replyToAccountId != null || replyToId != null;
            this.ReplyToId        = replyToId ?? 0;
            this.ReplyToAccountId = replyToAccountId ?? 0;
            this.MediaAttachments = mediaAttachments;
            this.Tags             = tags;
            this.CreatedAt        = createdAt;
        }
コード例 #5
0
 internal MastodonStatus(int id, MastodonAccount account) : base(id)
 {
     this.Account = account;
 }
コード例 #6
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="account">アカウント情報</param>
 public MastodonStatusAccessor(MastodonAccount account)
 {
     this._account = account;
 }
コード例 #7
0
ファイル: MastodonValidator.cs プロジェクト: atst1996/Liberfy
 public MastodonValidator(MastodonAccount account)
 {
     this._account = account;
 }
コード例 #8
0
ファイル: MastodonTimeline.cs プロジェクト: atst1996/Liberfy
 public MastodonTimeline(MastodonAccount account)
     : base(account)
 {
     this._account = account;
     this._userId  = account.Info.Id;
 }
コード例 #9
0
 public async Task SaveMastodonAccount(MastodonAccount accountData, CancellationToken cancellationToken)
 {
     await _storage.SaveMastodonAccountData(new MastodonAccountData(accountData.Username.Value,
                                                                    accountData.Instance.Value, accountData.DisplayName.Value, accountData.AccessToken.Token,
                                                                    accountData.IconUrl.IconUrl, accountData.IsReadingPostsFromThisAccount.Value), cancellationToken);
 }
コード例 #10
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="account">アカウント情報</param>
 public MastodonMediaAccessor(MastodonAccount account)
 {
     this._account = account;
 }
コード例 #11
0
 public MastodonApiGateway(MastodonAccount account)
 {
     this._account = account;
     this._api     = account.Api;
 }