In this video we're just going to review some final chord changes and then check in.
Our solution to get hub for source control.
So I'm going to start off with explaining this class that I have here on screen which is public static
class and I call that utilize it.
So first the static class allows you to declare a class where you can call on the other static functions
and properties without needing to declare an object.
So I'm going to explain exactly what that means.
So firstly in the solution I explore all I did was right click on this on the project.
Well to add in C class and then I gave it the name you.
So you would get the same dialog box that we're used to.
Whereas a class.
And then I call it utilize and then I said add and then got added to the project.
So we see you.
Some people would put that in a folder maybe by itself and in a folder called maybe helpers or something
like that.
At this point it doesn't really matter.
But my UTAS class is static so that means I can just say utilize dot and then call on the static function
which I have here which is called form is open.
All right.
Normally when it's a class we know that we need to declare an object.
So like in the case of declaring an object off one of the forms which is which our classes what I've
had to say give me an object and initialize it to an instance of that and then I can start interacting
with the properties and the functions when it is a static class.
Then in this situation I'm seeing give me utilize dot the function so I didn't need to declare UTAS
as an object and then use or declare an object of type beauties and then use the object I could just
say utilize dot form is open then I'm passing in the name of the form.
All right.
So instead of writing the code here like I did in the previous video where I wrote it one time and I
wrote it in that one situation well then every time I need to check if the form is open I'm going to
have to rewrite that code.
What I did was create value to this class create a function called a Form is open which is going to
return a boolean and it is expecting a parameter of type name or type string called name and then it
does that change.
So I get all off the open forms in the application.
Check if the one with the name that is being passed in is open right.
So we just did all of those so I just took that code and all it did was put in a function and return
is open which would either be true or false based on the outcome of this function right.
Or this operation and then the function is really returned in the true or false which is boolean right.
So that means every time I click event where or every time I have a situation where I was able to launch
a window all I'm doing is seeing if not and then whatever the result is when I call utilized what form
is open and then I pass in the name and room that the name of the form is the same as the type.
Right so I know I want to launch manage vehicle listing.
That's the farm I'm about to launch.
When that is clicked all right.
So I know that that is the name I'm passing in so I'm just saying check call that function and if it
is not meaning it is forms then I want to open it.
So if it is not open that's basically saying if it is not open then sure.
So remember that we did it as an if statement but once again would have to rewrite that code every single
time.
So all I did was put it in a function where all I'm doing is passing in the relevant name according
to the click event.
Right.
So that was it for the money vehicle listing listed on our money or our records.
I use the same function.
All I do is change the name because I know it's a different form that I want to lodge this time.
Is it open.
If it's not open then go ahead and launch it as an MBA child and proceed.
Right.
So that's one change that I've made.
Otherwise I have normalized the management records I put in the same delete kind of functionality with
the dialog box and the law as you would have done in the manage vehicle listing.
And I've normalized everything or most things up until this point so no I'm about to check this code
into GitHub.
Right so I'm going to create the repository and then by the time you would have watched this video you
would be able to go on github and access the repository with all of these code files and you know if
you don't understand something or move too quickly in the video you weren't able to get it clear and
you just want to see the code itself then you can go to the repository that we're able to create.
So I'm assuming you've already created I get tobacco into and if you haven't then it's pretty simple.
I also have a video on that yet I've seen it earlier it's I get tobacco and you can go to get top dot
com and then you can go to sign up and it's a pretty straightforward process once you sign up and you
provide all those details you want to choose free account because there are loads of free or enterprise
icons of course if you're an individual just wanting to use it for educational purposes then you go
ahead and use the free version of course once it's free you can choose if the repository is public or
private at the time and you can proceed accordingly.
So I'm not going to go through that in this video.
There's another video there that deals with that.
So right now we're going to focus on adding our solution to the source control all right.
So the first thing you want to do is look in the bottom right hand corner you see add to source control.
If you don't see this then you probably want to download the visual studio plugins for it and GitHub.
But if you're a visual studio was installed properly then you would have the plugins that I'm talking
about.
If you don't then you can drop me a line and then I can assist you with getting them so you can click
Add to source control and then you'll see it you go ahead and click that.
And what this does is it creates local repository on the machine that you are on.
So source control those it's a tracking changes of course you have to make sure everything is saved
and once you're tracking it changes you can tell who changed what file and when.
Right.
So it's a good way to know when your code is working what changes you made that probably broke your
code and you can always go back to the previous working code.
It's always recommended that you don't check in any code that has arrows especially if you're working
at a team.
But you know those are all principles that you learn along the way.
But right know what I just did was I created the local repository on my machine.
The next step however is to publish this to give up.
So my machine is going to be tracking changes but then I can synchronize it with the service called
the github or as your dev ops but it gets all these easier for every and anybody to get onto so that's
why I'm focusing on github.
But you can synchronize it with GitHub so that your local machine is tracking changes and you are basically
backing up all of those tracks changes to the code repository that github affords you.
And then that makes it easier for you to work in a team because then your team members can interact
with that killed repository at a global level and contribute to your code or share your code.
So right now what I am doing is pushing it to github so that you can access the code when you need to
write.
So I publish a github and I just get that published on github and then he's going to ask me OK it's
just going to verify that it's GitHub.
Know what it may do is prompt you to sign in so if you have created Oracle and successfully then you
just sign in with the credentials that you used to create that account.
I'm already signed in to my visual studio with GitHub so it's already takes me and I'm going to leave
the name there as car into app.
You can add a description so you can see you know wind farms or introductory.
Let me just write out the description.
All right so I wrote a little paragraph.
This is an introduction to Windows form application though an impartial fulfillment of the course enterprise
application development with Windows Forms using C sharp and Ada all done it.
So this is a nice it's a description and so that if anybody stumbles up on this repository they can
have an idea of what exactly they are what it is exactly that they're looking at the checkbox here to
make it private or public.
So if you make it private then obviously nobody will be able to just stumble upon it on the Internet
or in the you and whoever you invite to interact with the repository will be able to see it.
But to leave this unchecked because I want mine to be public right I want you to be able to go on my
profile and seat at the end of all of this.
I can just click publish and then I can give it a few moments.
And once that operation is finished then you'll see the phone.
Sean sorry to see the visual cue that says repository created successful you know if this step fails
it could be that to probably put in incorrect credentials or you probably need to change a connection
that you're sitting behind because I've seen firewalls block this operation so it could be one of those
things.
So at the end of the day whenever you make changes to your first let me log in to my github account
and show you exactly what has been done so you see car into up and there it is with the introductory
that is the description right.
So if I click on car into app then you're going to see my entire repository with that description that
I just wrote in Visual Studio.
It appears here.
So if I go into the folder I was here all the files.
So that's a solution.
They get files that would have been hidden or created once we added it to the repository.
And then I go to car into up and then when it goes into that folder you'll be able to see all of those
classified.
So this is the project folder right.
And these these are all of the files that are associated with our project.
So if you wanted to see what I did in that particular file you can just click on it.
So this is a log in that CSC again is click on log in that's yes.
And it would bring up the entire class file with all of the code that I would have checked in.
And you can always browse peruse and you know reacquaint yourself with the code if you need to from
the repository if you want to fetch a copy of the entire project then you can go to clone or download
and then this gives you three options you can open in desktop.
So in the video where we set up the guitar icons you would have also downloaded github for desktop so
you can open it in that desktop application if you already have it you can open it in Visual Studio
so this will actually problem to to launch my source code in an instance of your own visual studio Zeke
and see it in your project sitting in your visual studio as if you had my project and you can also just
download the zip file for later use at will.
Right.
So that is how you go about adding your positivity to YouTube.
No just to show you what the purpose of GitHub is.
If I make adjustments if I look in the solution explorer first you're going to see the blue padlocks
blue padlocks mean that these files are unchanged.
All right.
No if I go to utilize and I'm just going to do a simple change nothing too intrusive what I just made
a speech.
So whatever the change is and then I see of it if I look back at that file and want to see tick.
So then if I hover over there do you see that it's pending an edit or there's an edit that was made
that is being tracked and it is pending being checked in.
All right.
So let me let me make something more hatching a more useful Jean.
So I'm going to put you in the comment that is check if window is already open.
Right.
So before if I go to my repository and look at my utility file.
All right.
So I just went into the repository opened up the UTAS.
That's yes and I'll just zoom in a bit so you can see better.
You're going to notice that it's just there.
There is no comment or anything so I just added a comment to that line to line 14.
The original has no comment in line 14.
So what I'm going to do is check it in from Visual Studio.
So I'm just going to right click on the solution and then I'm going to say come in and then when I see
a comment I want to be as explicit as possible because once again this is good for team settings.
So if I'm in a team setting I want to let the team members know exactly what change I made to the code.
So I'm want to say I did comment to utilize that.
Yes because that's what I did right after I write that comment.
I can click on this Don correct.
So I can say commit but I want to show you a shortcut where you click on this Don correct.
And then you say commit all and sync so commit to means that is going to commit the change but it's
only going to be to your local repository which means you get on board and know about it at least not
yet.
When I say comet all and sync it we'll say Okay committed to the local repository and then synchronize
it with GitHub synchronizing means that if I have changes made it will push them to GitHub.
And then if anybody else on my team made changes it will also pull those changes to me.
So when I do that you'll see that it's doing operations while I'm here talking and no it's synchronizing
this might take a while because of the internet connection that I'm sitting behind.
But once it's done then you will see that it's successfully synchronize outgoing and incoming comments
so any changes that might be made will no be on my machine.
And any changes I made will be on github and then my team can also come here.
So this is team Explorer I have up in here called Team explorer.
If you don't see it you can go to view and look for Team explorer and that will give you this pain and
that by default it will be on this screen.
Let me just go to the home screen just to show you what it will look like.
So that's you.
All right.
So I have this is the home screen right.
This is when the repository is set up and that's your home screen.
If you want to get the changes so somebody made changes and you want to retrieve those changes then
what you can do is click sync.
All right.
So when you click sync it will automatically just pull any changes are what it will bring up this menu
and then you can just say pull.
So when you say pull it will bring in all the changes that your team has made.
If you just click sync it will do the push and pull so pull means get the changes push me and send my
changes.
Sync means I'll just do both of them in one operation anyway.
All right so you have a number of ways to do it.
Abdul showing you your options but in a team setting that is whole it can be done to help collaboration.
So now that this is checked in let's just verify that it has been checked in successfully so if I refresh
this view then you're going to see my comment is no in GitHub.
So the change I just made on my machine is now available on GitHub.
And then if I just go back to the list of files I'm just going to show you the visual cue that getup
gives you.
So these were ad project files that's all I was on auto generated I was the first comment.
But then when I I did the changes made to tell you to that CSR uses us.
Yes I wrote the comment added a comment to YouTube.
That's CSR right.
So it will be whatever you put as your Kobe message will inform anybody else what changes made to the
particular file or at least the last change that was made to the particular file.
No.
I talked a lot about working a team I'm just going to show you how you can invite other people to be
on your team.
So firstly your teammates need to have gettable Collins all of you need to have GitHub icons and then
you what you do is go to settings.
So whoever would have created the repository one person get create the repository first and then you
can invite the other.
So you would have gone to settings and then you would say manage access and then this will probably
problem to to you know put in your credentials.
So let me do that quickly.
And then from here I can invite collaborators.
Right.
So I have a few persons who I follow on GitHub who I trust but then collaborators really are the ones
who will be able to access and push changes to your repository without you needing to you know be there
all the time.
So that's why I said team.
All right.
So if I invite a collaborator I would just need to provide a name or an e-mail.
So I think maybe I can look for somebody named Bill Ritchie.
I have an associate by that panel.
I don't remember exactly the handle but you can see that it's bringing up a number of people.
So maybe using will e-mail address would probably be the most sure way to make sure that you're inviting
the correct person.
So you put in the person's e-mail address
Just put it in one.
OK.
There is none.
But on that smile though Jamila cones I thought I still had a YouTube account.
All right so I'm just going to use my friend Sean McClean and then I just clicked.
Sean Maclean and then I say add Sean McClean to car into up so by doing that it would trigger an e-mail
invitation to him and then you'd be able to accept and then have full access to the application just
like I say to see that spending invitation.
You can always cancel it if you want someone to cancel it.
I'm sure he's going to comment ask me why did I do that.
That's fine.
I can handle that situation.
But that is how you go about adding other collaborators to your project.
With all this said and done that's it for our introduction to Windows Forms application development
using C sharp and Ada net.
I hope you had fun and I look forward to seeing the additional functionality that you put in I would
recommend that you put in something to manage maybe the users.
You can probably put in something else to do the audit log in like I mentioned to see which user interacts
with which file and you know you can do a number of different things.
And I'm interested to hear exactly what ideas you have in mind to improve this application.
You can always jump me like any of my contact information and let me know your thoughts.