Beispiel #1
0
        private async Task Run()
        {
            Dictionary <string, string> uri_list = new Dictionary <string, string>();

            var appRegistration = new AppRegistration {
                Instance     = hostName,
                ClientId     = clientId,
                ClientSecret = clientSecret,
                Scope        = Scope.Read | Scope.Write
            };
            var authClient = new AuthenticationClient(appRegistration);

            var auth = await authClient.ConnectWithPassword(mail, pass);

            client = new MastodonClient(appRegistration, auth);

            var account = await client.GetCurrentUser();

            this.userId = account.AccountName;

            // LTL処理
            streaming           = client.GetLocalStreaming();
            streaming.OnUpdate += (sender, e) => {
                TextWrite(e.Status);
            };

            //通知処理
            homeStreaming = client.GetUserStreaming();
            homeStreaming.OnNotification += (sender, e) => {
                NotificationWrite(e.Notification);
            };

            // メディア処理用
            media = new MediaEditClass(ref client);

            Timer timer = new Timer();

            timer.Interval = DefaultValues.TOOTS_INTERVAL;
            timer.Tick    += (object sender, EventArgs e) => {
                // トゥート回数のリセット
                tootsCounter = 0;
            };
            timer.Start();

            streaming.Start();
            homeStreaming.Start();
        }