Tweet Posting: Setup
Updated: Jul 12, 2021
If you have any questions or comments about this post, leave a comment or a like.
And... we're off. Post 1 of our Tweet Posting project. In this post I'll guide you through how the project and environment is going to be set up. But first you are going to need to set up an Azure account. You can set up a free one, I followed this guide to set mine up: https://azure.microsoft.com/en-us/free/
Now with that in place on to the fun stuff :) but, before we begin I have a post all about function apps. Go check it out to give yourself a briefing on what they are and how they can be setup, it goes into more depth than what I'll be going though.
Step 1 - Setting up our Resource Group
The title says it all. We are going to be creating a Resource Group in Azure and then add our initial resources to it. A Resource Group is like a container, for our resources. It makes cleaning up/ managing the project much better. I'd suggest that you set up at least one new one for each project. To create one go to Resource Groups in Azure (should be on the side panel), then click the Add (+) button and fill out the form. Finally click "Review + create".
With that done we have to set up our function app. To do this, go into your newly created Resource Group and click add. Next search the marketplace, type in Function App. Click "Create" under the resource name. Then fill out the form.
You'll want to make sure that you select the existing resource group when inputting that field in. The rest of the fields don't really matter as much.
Ideally we would set the region of each resource in the Resource Group to be the same, then they will all run a bit quicker as they are all located in the same area. Also make sure you select the "Hosting Type" as consumption plan.
Finally, click create and with that your function app should have been created :) well... after it's done being deployed that is.
Super! That wasn't so hard.
Step 2 - Setting up our Project
The "front-end" of this is a wpf application. With controls and all sorts. A wpf project is a project that has a form attached to it that you can edit. The form is written in xaml, which is like xml and html all rolled into one.
On to what our form is going to look like. First off we want to have a post button to post to our linked social media accounts. A textbox that we are going to use to let the user say something about the post. Another textbox, to allow the user to input in the url of the blog post that is to be shared. With that done, our form should look like this:
Quick note, both of the textboxes should have their content property set to an empty string("") in the xaml page. Also I you will notice a bit of change between the form in this blog post as apposed to the one on the repo. This is because I had to restart the project.
Step 3 - Form Testing
To finish off this step we need to set up click triggers for each of the buttons. To do this double click on the button and a new event code snippet will be added to the Main.cs. Inside of here we need to do our validation. Simply put we won't allow anything to be posted until, there is text in both of our textboxes. With that done our task is to clear the textboxes when the validation has gone through and to display an alert when the post has been successful.
That concludes part one in this series as, well as far as first steps go that wasn't that hard...
Dark theme for the win!!!