Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("MeetingDate,MeetingDescription,MeetingLocation,MeetingPresenter,MeetingStartTime,MeetingEndTime")] Meeting meeting, ICollection <IFormFile> files, TwitterAuthAPI _params)
        {
            if (ModelState.IsValid)
            {
                if (files != null)
                {
                    await Helpers.Upload.UploadFile(files, _environment);

                    meeting.FileName = Helpers.Upload.UploadFile(files);
                }

                _context.Add(meeting);

                TweetSender tweetMeeting = new TweetSender(_params);
                var         tweet        = meeting.MeetingDescription
                                           + " at " + meeting.MeetingLocation
                                           + " on " + meeting.MeetingDate.ToString("D")
                                           + " at " + meeting.MeetingStartTime;

                tweetMeeting.PostTwitter(tweet);



                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(meeting));
        }
Esempio n. 2
0
	void Start () {
		sInstance = this;
		DontDestroyOnLoad (gameObject);
		#if UNITY_IPHONE
		TwitterBinding.init(consumerKey,consumerSecret);
		#endif
		
		#if UNITY_ANDROID
		TwitterAndroid.init( consumerKey, consumerSecret );
		#endif

	}
Esempio n. 3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,MeetingDate,MeetingDescription,MeetingLocation,MeetingPresenter,MeetingStartTime,MeetingEndTime")] Meeting meeting, ICollection <IFormFile> files)
        {
            if (id != meeting.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    if (files != null)

                    {
                        await Helpers.Upload.UploadFile(files, _environment);

                        meeting.FileName = Helpers.Upload.UploadFile(files);
                    }

                    _context.Update(meeting);

                    TweetSender tweetMeeting = new TweetSender(_params);
                    var         updateTweet  = "UPDATE:"
                                               + meeting.MeetingDescription
                                               + " at " + meeting.MeetingLocation
                                               + " on " + meeting.MeetingDate.ToString("D")
                                               + " at " + meeting.MeetingStartTime;

                    tweetMeeting.PostTwitter(updateTweet);

                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MeetingExists(meeting.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(meeting));
        }
Esempio n. 4
0
 async Task beat(DateTime time)
 {
     if (TweetQueueBeat < time)
     {
         Abbybot_III.Abbybot.print("Sending Tweet");
         TweetQueueBeat = TweetQueueBeat.AddMilliseconds(tweetQueueMilis.TotalMilliseconds);
         int tries = 0;
         do
         {
             await TweetSender.SendTweet(
                 onFail : fail =>
             {
                 tries++;
                 Console.WriteLine($"I failed to send a tweet:\n{fail}\ngonna try again...");
             },
                 onSucceed : () => tries = 10
                 );
         } while (tries < 3);
     }
 }