>> And this week Xamarin show,
I have my awesome and amazing friend,
Dan coming on. Dan what are you talking about?
>> Be talking about the Prism Project Studio
with lots of awesomeness for Visual Studio Mac.
>> This thing is awesome
whether you're using Prism or not,
so make sure you tune in.
> Welcome back everyone to the Xamarin show.
I'm your host James Montemagno,
and today I have a special guest Dan,
coming in and talking about the Prism Project.
>> Studio.
>> Awesomeness?
>> Yes.
>> Studio?
>> Yes.
>>It's a brand.
>> This is hot off the press.
I literally compiled this about five minutes ago.
>> I love it. I'm a big fan of Prism and I've been using
the Visual Studio 2017 extension and it seems like
you guys have built essentially
an awesome VS for Mac extension,
that doesn't only just Prism stuff but
also help us for any Application.
>> This is everything that
I've learned over the years doing Xamarin Development.
It's all those little paper cuts that you have.
Whether you're using Prism
or any other framework as well.
>> Got you. So first off before we get into the code,
maybe tell everyone a little
bit about yourself and what you do.
>> Well I'm Dan Siegel,
I'm a Xamarin Consultant.
I work heavily on the Prism MVVM framework.
I do mobile, I'm not a coder at heart.
>> Awesome and we"ll be talking pretty heavily about
Prism and I also did a show with Brian Lagunas,
so I'll put that in the show notes below,
so you don't know about Prism,
it's a pretty awesome cross platform MVVM framework.
Came long ago from like WPF days.
>> Yes from the WPF days for sure.
We've been doing a lot of work on Prism too,
to help facilitate
those developers that have come from WPF,
so we'll actually be
releasing some major updates to Prism soon.
That'll bring even more
of the WPF power in the Xamarin forms.
>> And saying that Brian really got across when we demo
prism for Xamarin forms it's like a separate,
it's own thing really highly optimized, so,
people think we are going to bring in
this huge framework,
it's actually quite small.
>> It's really small. It's very very
small but it gives you a testable code.
That was one of the biggest complaints I always had.
I got this really tightly
coupled code for my Xamarin project.
I love Xamarin forms but I don't want something I can't
really test and verify that it really works.
>> Especially when your Application
grows and grows in your enterprise.
>> Exactly.
>> Testability, you need that separation.
>> Exactly.
>> A complete understanding and it's pretty great.
So I'm really excited to see this stuff.
Do you just want to hop into it?
>> Yes lets hop in. It's going to-
>> Let's go to your mac.
>> Yes. So if you take a look here,
I've actually got a few different categories.
I have a ton of tests but
a little bit in contradiction to my shirt today.
>> We should see that. So you've installed
the Prism Project's Studio
here, into Visual Studio for Mac.
>> Yes. So this is just an extension
that comes right from
the same extension marketplace
that's already available in VS Mac.
>> So then you've added
the central Prism known as the App, module and tests.
>>Correct.
>> So what does this mean tests,
is it specific that I am using Prism or what is it?
>> No this is not specific to Prism.
This is really for any Xamarin Forms Application at all.
This is probably the least opinionated part
of everything here.
So I've really opened it up for I
don't know what test framework you like to use,
that you're most comfortable with.
I know when I look at a lot of your stuff,
you seem to really love MS test.
I use a lot of X unit
and a lot of people love and M unit.
So I don't want to limit anybody
based on what framework that they're
already used to using.
>> Got it.
>> I want to make sure that they're able to just jump
right in and test their Xamarin Forms Application.
So these project templates,
they're not there like the basic,
if you just went "File", "New",
X Unit, MS test project.
These are already wired up so that where
you can test the Xamarin Forms Application.
>> Got you. So it takes off some of
that friction from "File", "New".
>> Exactly. It's how do I get started.
Because I have to call the Xamarin Forms in it.
And how do you do that in a test framework?
>> Now will this generate not only my Apps
but also the test project,
or this generate just the test project.
>> These are just the test project.
>> Okay cool. So I've already created an App.
>> You can create it as a
stand-alone or you can create it in an existing solution.
>> Cool, awesome.
>> Yes. So we've got our Prism Applications of course.
I have just a blank pieces.
No frills, it is a Xamarin Forms Application with Prism.
>> Okay.
>> And you can select what container you want.
That is about the extent of it and then we have
this QuickStart Application and
there's all kinds of goodies in here.
>> Oh cool. So if
people are used to today, "File", "New",
you select maybe iOS and
Android and if you want Xamarin or not.
>> Exactly.
>> Few other tiny options there seems like you
built your own crazy awesome wizard.
>> Oh yes.
>> Goodie bags.
>> Yes. So with this crazy awesome ones,
so I can say, I want to
create a new project called The Xamarin show.
It's going to pick up my naming,
it's going to humanize that so I have
a nice beautiful name to display on the home screen.
It lets me customize
that bundle ID and it'll remember it too.
We all have our presets
that we might have for what company we work with.
So we will remember that from
App to App as I'm creating stuff.
It'll remember your container.
Now, I like to use dry iOS,
now the last one that I
did here was Unity, so it picked that up.
>> Not to be confused with Unity the game.
>> Not to be confused with that.
Yes the Unity, the DI container. So I can.
>> Now any of those containers are those come from
the Prism team or these are third party containers?
>> These are third party containers.
>> Okay.
>> Yes. So Prism is very extensible so you can write
your own extension point for your own containers as well.
>> Interesting.
>> So I can include a Xamarin UI test,
I can include iOS or Android.
You'll notice when I click Android it
actually lights up this option here.
I can select what the minimum Android SDK level
is as well.
I have a bunch of different community projects
that we can install.
By default it'll actually give me a sample Application.
So give me that, to do experience.
I would joke that that's like
the hello world to Xamarin right?
So it gives you that experience of how do I jump
in with a Prism Application for Xamarin Forms.
But if I don't want all of that boilerplate I just
click a checkbox and it pulls that out.
But any of those community projects,
any of the other options I select along
the way or all that boilerplate will get put in,
so I don't have to initialize stuff
or add a new gutter or anything like that.
>> Cool.
>> I can choose a data provider like Relm or SQL lite.
I can also say here, I want to use App Center.
>> Yes.
>> I can put in my App Center secrets
for Android and iOS.
So of course dynamic for whatever platforms I have.
I can say I want to use
Azure Active Directory and
it'll let me configure that as well.
>> Well that essentially is then setup
all the scaffolding hooks.
We had a map you on somewhat
Azure AD and some sample as we've gotten.
>> Yes.
>> Most and almost all of it's crossed
platforms have a little bit of
here and there and that Info appear as stuff
so basically keeps all that stuff for you.
>> It keeps all for you.
>> Very cool. That's very nice.
>> Yes.
>> So it's all in there.
You don't have to do anything else.
>> Nice.
>> I've also got
an App Icon Generator as part of that new experience,
so I can just come in here.
I can select an icon,
and it'll resize everything.
Now, it's not meant for that.
I need that pixel perfect
like you need to shift this over.
>> Yeah.
>> If your designer is giving you
the icons in all the size, you should go at it.
>> Yeah, absolutely.
>> If you've got a 1024 by 1024,
and you were going to put it in sketch,
and have it spit out icons
anyway. This is what's going to be doing.
>> Exactly. Exactly. If you need something
like real quick just to show your boss,
or your client, or whatever,
that's probably what you would use.
>> Got it.
>> Okay. And just with that,
I can go ahead and create a new project.
It's going to automatically initialize as a Git Repo.
It's got Custom Git Ignore
to do some things. I really believe.
I know you've written a few blog posts about using VSTS.
And I think everybody should have some sort of CI setup.
>> Yeah, a big fan.
>> So, I've optimized this
for checking that in and having that build pipeline.
Everything here is all
optimized for that build experience.
>> That's fine. The next thing to add in this
is also a spin up my VSTS instance.
>> That's actually, that's the topic.
>> Because there's a command line for it now.
>> Yeah.
>> I think Donovan was telling me about this.
>> Yeah, that's actually coming.
>> Yeah. That's awesome. I like that.
>> So, I'll go ahead and jump
into a project here that we've created.
Now, this one is actually using Unity.
>> Yes.
>> Now, one of the kind of gotchas that
we've got with Unity is,
our navigation service has to be a named parameter.
So, when I go into my "View Model," and you see,
I have the "NavigationService" here.
So, if I say this is not right,
it should pop-up as broken.
>> So, part of Prism's is
a Prism application using Unity.
And additionally, some things that Prism
does is a full navigation service.
So, most developers are
probably using them. I'm going to push this page.
>> Exactly.
>> And a Prism kind of thing is the flip,
is I want to push this unique identifier,
which is more of the view model.
>> Exactly.
>> It'll kind of
marry the world together, so it brings them together.
>> Exactly.
>> This page is associated with this view model.
Just make that connect.
>> Exactly. Exactly.
>> And it has to be a specific name,
is that what you're saying?
>> In Unity, one of the limitations with the Container,
and this is not a Prism thing,
this is a Container issue that we have
is it has to be a named service.
>> Got it.
>> So, if it's not named correctly, it won't inject.
And we certainly have some issues where
people put something a little bit off.
So, this will automatically
detect anything that isn't correct,
and it will give me that tool tip for you,
"Hey, you need to rename this to".
>> So, that part there is
coming in from the Project Studio,
kind of like a Roslyn analyzer or something like that.
>> Exactly, it's a Roslyn analyzer to do that.
So, and there are a few other things in
there that we've added in that.
We'll be adding over time
as well to kind of help developers.
>> Very cool.
>> So, before I was talking about
the secrets for App Center or for Active Directory.
Now, there are, of course, a few things in
there that you want to protect,
so you can actually use this mobile build tools library,
and that's included in these templates,
and you have the "secrets.json",
that you put whatever parameters you want.
It'll automatically generate the class injected
in it build time, and it runs anywhere.
It'll run in App Center without
ever configuring a build script.
>> Nice. Yes. And today,
people might be used to,
so you don't bury your keys in
there using some variable swapping.
I did a blog post on how to
set that up, which isn't too bad.
>> Yeah.
>> That's pretty nice, just kind of magically happened.
>> Exactly. And it also will
do that with your manifest, too.
So, if you have a tokenized manifest
for your AndroidManifest, your info P list.
>> Yeah.
>> It will reset those tokens.
It will copy them over.
So, you never check things into
source control that have any kind
of application secret or
something that you want to define or build
like a backend host or something.
>> Got it. Makes sense. Nice.
>> Yeah.
>> And then, what if I'm like
scaffolding out the application,
and what do I mean by scaffolding?
It's like I need to add a new view.
I need to add new pages.
>> Sure.
>> What else is this kind of thing help me with that?
Because I know that's the thing
with when I'm building a Xamarin Forms application.
I have my page.
I have my ViewModel. I have my model.
I'm kind of then bundling those together.
But, the idea of Prism was
to do it all magically kind of thing, right?
>> Yeah. So, with that,
you need your views and
your views Namespace and the View Model,
and the ViewModels Namespace with Prism.
It's just a convention that we follow.
That way, it helps that the View Model Locator
actually find where your View Model
is and wired all up for you.
But, sometimes I click on
the wrong node in a project, so it doesn't matter.
I'll click up here on the "Solution."
And when I go to "Add New
File," I've got some new templates here.
So, I've got templates for all your Xamarin pages.
I've also got like the pop-up pages,
all of the layouts,
if I want to develop a custom control
or any partial view,
so all of that is there.
And when I go ahead, and I add,
it will say, "View B" here.
It will wire that up automatically.
It detected that I've got
this "ViewModelBase" class in here.
>> Okay.
>> And it automatically added it.
That's not hardwired, that is automatic,
so I could make a change here in my "ViewModelBase."
And I can say I want to use some other service.
>> Sure.
>> Or I don't need all of the services here,
and it'll inject in the "Constructor" automatically.
>> Does it also create the "Views" for me as well?
>> It does. It will also create the "Views" in here,
so I've got my "View A," "View B" already wired up.
And I'm going to throw a real curveball that you did it,
make the marriage and the connection
between the strings and
the navigation service in my App "Xaml.cs?"
>> In this particular build, no.
>> Coming soon, I got there.
I was like, "Real magic."
>> Yeah.
>> Yeah. It was something I
didn't have time to finish on that particular thing,
but that will be there by the end of today.
>> Easy enough because it pulls it
all in there and gives you
everything really, really nice.
>> Exactly.
>> Now, in this application,
let's say that I come back in this application,
that QuickStart wizard gave me a bunch
of stuff, awesome stuff,
too, like the Azure AD,
but also gave me the icons.
And let's say, I'm not using Prism,
can I still use some of that stuff?
>> Absolutely. So, as long as you have it installed,
again, I can click it, the solution level.
I've got a new option here to "Create the App Icons."
And I can do that either the project
or the solution level.
>> It kind of just brings up a very similar dialog.
>> Exactly. It's literally
the same widget with just a different wrapper,
so you'll see again that same exact.
>> Very nice.
>> Yes.
>> So, that's really nice because even if you're
just building an application,
maybe it's already getting ready to go.
You are not using Prism, that's fine.
If you install this thing, it's going to actually
you some productivity extension.
>> Exactly. Exactly.
>> Very cool. The last thing I had a question onto,
maybe you have a little bit more to show us.
You keep saying that it's very extensible Prism,
and I saw this module thing in the template.
I don't know what a module is.
I don't think Brian covered it.
Can you cover it real quick
for people that maybe interested in it?
>> Sure. So, you know,
a real common scenario is I
have some sort of authentication in my application.
And maybe I'm developing
two or three different applications for my company,
but I'm only using one backend to authenticate.
I have that common identity service that I'm using.
>> Got it.
>> So, I can create a module that I can reuse
across all the applications without redoing everything.
>> And it has like all the Prism kind of wiring.
>> Exactly. So, you can put any kind of service that
you might be using, Views, ViewModels.
It's really, it's up
to you what you want to put in there,
and then you can initialize
any additional code once it's loaded as well.
>> Very nice. I like that.
>> And I'll show you like as well.
We won't save it.
So, there's actually two
different module templates in here.
>> Okay.
>> The difference here is the first one, it's a blank.
It's just one project that's a module.
There's actually no longer in need in
Prism Seven to tie a module
to a specific container because we've
abstracted out inversion of control completely.
And so, we've got that.
And then, you can also create
a module with a Shell application.
So, the scenario for this,
I actually ran into recently with one of my clients,
and they have three different teams that are
working in parallel on a single project.
So, each team has
its own feature that they're working on,
so each one needs to be able to test, well.
>> Got it.
>> This now allows for that kind of scenario,
so you get a sample application to
load up that one module and test.
And then, when you build, it will
generate a new gate that you
can push to your private feed.
>> That's really nice, really cool. All right.
Anything else bundled in here
that you want to show off to all.
You think we've crushed it all?
>> I think we got quite a bit in there for sure.
>> That's a lot. That's a lot of awesomeness.
>> Yeah.
>> This has been really cool.
I'll put all the links in the shown as
below including now into the video of Prism,
but also the Prism GitHub.
Is it all open source?
>> It's all open source.
The mobile build tools I mentioned, that's open source.
The pop-up plug in, which I didn't really show,
but it's in there as well.
That's all open source.
>> Awesome.
>> Yeah.
>> Yeah, this has been
awesome. Thank you for coming over.
>> Yeah, absolutely. Thank you for having me.
>> I love it when people extend
the tools that their building in every day.
It kind of shows not only how great the
ideas but how flexible it is and also,
all these awesome libraries there.
Thanks for coming, John.
>> Well, thank you for having me.
>> Absolutely. Well, thanks everyone for tuning in.
This has been another episode of The Xamarin Show.
Don't forget to subscribe in your favorite application.
If you're on Channel Nine down over there,
YouTube up there, wherever it's at,
ting that bell, makes sure you get
those notifications right in your
inbox each and every week.
Until next time, I'm James, and thanks for watching.