示例#1
0
        public void Tweet_PublishTweetWithImageInReplyToAnotherTweet(string text, string filePath, long tweetIdtoRespondTo)
        {
            if (!TextEmpty(text))
            {
                byte[] file1 = File.ReadAllBytes(filePath);

                var substringed = "";
                try
                {
                    var    tweeto = Tweet.GetTweet(tweetIdtoRespondTo);
                    string texto  = "@" + tweeto.Creator.ScreenName + " " + text;
                    if (texto.Length > 140)
                    {
                        texto       = texto.Substring(0, 136);
                        texto      += "...";
                        substringed = " BUT tweet text was cropped because the reply Id was too long.";
                    }

                    var tweet = Tweet.CreateTweetWithMedia(texto, file1);
                    tweet.PublishInReplyTo(tweetIdtoRespondTo);
                    GetPublishedResult(tweet, "Tweet with image in reply to: " + tweetIdtoRespondTo.ToString() + " published!" + substringed);
                }
                catch
                {
                    FActionStatus[0] = "Tweet Id to reply to is not a published tweet!";
                    FLogger.Log(LogType.Debug, "Tweet Id to reply to is not a published tweet!");
                }
            }
        }
示例#2
0
        private void createWorldView_CreateWorldDone(object sender, RoutedEventArgs e)
        {
            Task.Factory.StartNew(delegate
            {
                byte[] file = File.ReadAllBytes(createWorldView.currentWorld.ScreenshotPath);
                var tweet   = Tweet.CreateTweetWithMedia("Look! A new planet was created!", file);
                tweet.Publish();
            }, TaskScheduler.FromCurrentSynchronizationContext());

            Planet planet = universeView.addWorld(createWorldView.currentWorld);

            worldDatabase.saveWorld(createWorldView.currentWorld);

            createWorldView.Hide();

            worldCreated = false;

            universeView.scrollToInstant(planet);
        }
示例#3
0
        public void Tweet_PublishTweetWithImage(string text, string filePath)
        {
            if (!TextEmpty(text))
            {
                byte[] file1 = File.ReadAllBytes(filePath);

                var tweet = Tweet.CreateTweetWithMedia(text, file1);

                // !! MOST ACCOUNTS ARE LIMITED TO 1 File per Tweet     !!
                // !! IF YOU ADD 2 MEDIA, YOU MAY HAVE ONLY 1 PUBLISHED !!
                // ADD: ", string filepath2 = null" as new ARG in the function definition

                /*if (filepath2 != null)
                 * {
                 *  byte[] file2 = File.ReadAllBytes(filepath2);
                 *  tweet.AddMedia(file2);
                 * }*/
                tweet.Publish();
                GetPublishedResult(tweet, "Tweet with image published!");
            }
        }