none
Customize the login screen? RRS feed

  • Question

  • Similar questions have been asked, but I don't see an answer to the simple question of how to customize the LightSwitch-generated login screen.  I'm not looking for a server-side login page that can then pass the authentication on (I have that working without any trouble).  However, I'd like to add an image or two or change the style or whatever inside the Silverlight client application.  How would I do that?  I would think this should be trivial, and it well may be, but I haven't found any documentation on how to do it.

    Thanks!

    Brad.

    Wednesday, September 7, 2011 8:10 AM

Answers

  • Thanks Steve,

    Great advice...

    http://visualstudio.uservoice.com/forums/127959-visual-studio-lightswitch/suggestions/2269502-allow-a-background-image-on-login-screen-

    Vote if this is a "Hot Button" issue for your app...

    Or, if your users enjoy the cool calming effect of a "White" soothing Login screen, then move along (and you shouldn't have read this far down)...

    -SD.



    I'd voted, but why the question is "Allow a Background Image on Login Screen" only? For example, it would be nice to store username into the IsolatedStorageSettings, enable debugging, new user registration, etc. By the way, there is an ability to add a "background image":

    using System.Reflection;
    using Microsoft.LightSwitch.Runtime.Shell.Internal.Implementation;
    
    
            Frame rootFrame = null;
            partial void Application_Initialize()
            {
    Microsoft.LightSwitch.Threading.Dispatchers.Main.BeginInvoke(() => {
                    rootFrame = ((Page)((ContentPresenter)System.Windows.Application.Current.RootVisual).Content).Content as Frame;
                    if (rootFrame != null)
                        rootFrame.Navigated += new System.Windows.Navigation.NavigatedEventHandler(rootFrame_Navigated);
                });
            }
            void rootFrame_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
            {
                if (e.Content is LoginPage) {
                    // prepare image, that is laying in the Resources folder as Embedded Resource
                    System.Windows.Media.Imaging.BitmapImage image = new System.Windows.Media.Imaging.BitmapImage();
                    image.SetSource(Assembly.GetExecutingAssembly().GetManifestResourceStream(Application.Current.Details.Name + ".Resources.MyLogoBackgroundImage.jpg"));
                    Image mylogo = new Image() { Source = image, Stretch = System.Windows.Media.Stretch.Uniform };
                    mylogo.SetValue(Grid.ColumnSpanProperty, 5);
                    mylogo.SetValue(Grid.RowSpanProperty, 7);
                    // add image
                    Grid grid = ((LoginPage)e.Content).Content as Grid;
                    grid.Children.Insert(0, mylogo); // not Add, for background
                    rootFrame.Navigated -= rootFrame_Navigated;
                }
            }
    
    
    p.s. may be using rootFrame.Navigating handler it will be possible to shove own (custom) LoginPage, i didn't try yet...
    p.p.s. excuse my english ))





    Friday, September 30, 2011 12:34 PM

All replies

  • Good Question I wonder if that is part of a Shell Extension?
    See my blog C# Bits | Twitter @sjnaughton Always seeking an elegant solution.
    Wednesday, September 7, 2011 10:07 AM
  • It does seem to be a "generated" screen, & none of the generated screens are customisable.

    I haven't seen any way to customise it through a Shell Extension. Again, if it's generated that'll be why.


    Yann

    (plus ça change, plus c'est la même chose!)

    Wednesday, September 7, 2011 1:53 PM
    Moderator
  • It's actually not generated, if you look at the LightSwitch.Client.Internal.dll in the object browser, you can see it's right there ("LoginPage.cs & LoginPage.xaml").  Actually, it's a public class so if you add a reference to LightSwitch.Client.Internal.dll, you can even create new instances in code.

    I tried to make a style that resets the ControlTemplate of the page to a new one (with images / links / ...) but didn't manage to get a working sample...  I do believe it should be possible, because when you publish the sample I made on ControlTemplates,  you can see that at least the buttons on the loginscreen already use my specific ButtonStyle...

    I probably failed in my style.  I have never created a new default style for a specific System.Browser.Navigation.Page before.  Is it even possible?  Can anyone provide a sample (silverlight quick 'n dirty application) where this is done?  It's quite hard to test in a LightSwitch application by the way, because you only see the LoginPage when you have published your application. 

     

    Kind regards

     

    Jan


    Lightswitch blog: http://janvanderhaegen.wordpress.com || About me: http://about.me/jan.van.der.haegen || "The improbable we do, the impossible just takes a little longer." (Steven Parker)
    Thursday, September 8, 2011 5:40 AM
  • Hi Brad,

    This isn't something that is officially exposed in LightSwitch. Customization of the login screen was considered as a "nice to have" feature, but not something that is necessary for the majority of business applications. Yes, it should be trivial, but it didn't make the cut for V1.

    As suggested in other answers to this post, it may very well be possible to find a way around this design limitation, however there is no guarantee that those workarounds would continue to work in future versions of LightSwitch.

    LightSwitch makes it easy to create applications that get the job done, without writing a lot of code. LightSwitch doesn't make it easy to create highly customized UI. If you need a highly customized UI, LightSwitch may not be the appropriate tool for the job. Just sayin...

    Regards,


    Steve Hoag Microsoft aka the Lights Witch (IEnumerable of Newt)
    Thursday, September 8, 2011 6:52 AM
    Moderator
  • Wow, picture spending weeks gathering requirements, learning a new product and building a killer Business App that does exactly what you dreamed of... Then realizing that the first thing the Business Users see is a white screen with generic User and Password boxes??

    Imagine a primer colored Ferrari and that is what we have!

    Hmmm, doesn't the Lightswitch team realize that first impressions are made from that log in screen? "Not important"? "Didn't make the cut"?

    So if the user can get over that first blank, very amateurish screen then everything will be great? Think again!!! A great looking login screen (even with just an image on it) makes a big impression on whats inside.

    We have built an absolutely KILLER app that not only looks awesome (once you log in) but was built in 1/4 of the time than using SL alone. Our problem is that using the re-direct technique doesn't work when the browser Security is set to high.

    So how 'bout it Lightswitch Team... Can you open the door for us to at least put a background image on our "White" login screen?

    Steve Hoag, I'm not sure how you can be so complacent about this? Have you actually used LS to develop a real app? If you have then ask your users what they think of the login screen? and maybe if they would like their logo or something on it?

    I also beg to differ on your "Opinion" about Lightswitch not making it easy to create highly customized UI!! Sure you may need a little Custom Control here and there but highly customize-able it is!!!!!

    -SD






    Thursday, September 22, 2011 7:46 PM
  • Hi SD,

    If it's really that much of a hot button issue for you, please enter a suggestion on connect (http://connect.microsoft.com/lightswitch) and let others vote on it. My guess is that it won't be high on the list of desired features, but I could be wrong.

    In the meantime, have you investigated Jan's suggestion of customizing the login screen via a theme?

    I stick by my comment about Lightswitch not making it easy to create highly customized UI. Yes, with Visual Studio Pro you can create Custom Controls and extensions, and I do believe that is a powerful part of the LightSwitch ecosystem. But you can't easily create a highly cusotmized UI with LightSwitch alone.

    Regards,


    Steve Hoag Microsoft aka the Lights Witch (IEnumerable of Newt)
    Thursday, September 22, 2011 8:27 PM
    Moderator
  • Thanks Steve,

    Great advice...

    http://visualstudio.uservoice.com/forums/127959-visual-studio-lightswitch/suggestions/2269502-allow-a-background-image-on-login-screen-

    Vote if this is a "Hot Button" issue for your app...

    Or, if your users enjoy the cool calming effect of a "White" soothing Login screen, then move along (and you shouldn't have read this far down)...

    -SD.



    Thursday, September 22, 2011 8:58 PM
  • Whilst I would also like this feature, I think you are being a bit hard on Steve and Microsoft. Given that LS is only in v1, and they packed a tremendous amount of brilliant features into v1, I don't think it's unfair to say that this wasn't the highest priority.

    If you really have created a killer app, then I can't believe that your users would be put off by a vanilla log-on screen. Even if their very first impression isn't "Wow, look at that!!!!" then their second impression (when they've logged in) should be. If it isn't, then I woluld humbly suggest that your app isn't quite as "killer" as you thought!

    Also, Steve didn't say that they aren't going to add this functionality, he said that it wasn't a high enough priority to make it into v1. There are plenty of things that didn't make it into v1 that are far more important (go look at connect and see some of the suggestions that have a lot of votes). This product is going to grow and develop. If a feature isn't in v1, it doesn't make the product worthless.

    Just my 2c of course!


    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/
    Thursday, September 22, 2011 10:17 PM
  • You apparently work for MS and maybe LS but you are definitely not a LS evangelist!   

     

     

                                                                      Bad  Boogie answer  !!!!!!!!

                                                                      show some more respect


    Eric
    Friday, September 23, 2011 1:12 PM
  • You apparently work for MS and maybe LS but you are definitely not a LS evangelist!   

    Wrong on both counts I'm afraid! I don't have any connection with Microsoft, but I'm a huge fan of Lightswitch, and will happily evangelise to anyone about it.

    Perhaps the difference between you and I is that I am looking at what Lightswitch is now, compared to what we had without it, and looking at what are the key pieces of functionality that we need. Whilst a customised log-on screen would be nice, my opinion is that it is not as important as many of the other feature requests that we've been discussing here.

    I have no idea about your background, but I have over thirty years experience as a software developer, and I have seen tools grow and mature. Compared to most of the v1 software I've seen, Lightswitch is amazing in what it does do. Sure, it misses some things, but you show me a piece of software that had everything in v1. It just doesn't happen.

    Bad  Boogie answer  !!!!!!!!

    show some more respect

    I'm not quite sure what part of my reply you consider disrespectful. I was trying to explain why I don't think your criticism of Lightswitch was fair. You are quite entitled to disagree, but given the way you bashed Lightswitch because it is missing one small feature, I hardly think my reply shows a lack of respect.

    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/
    Friday, September 23, 2011 2:37 PM
  • You apparently work for MS and maybe LS but you are definitely not a LS evangelist!   

    Wrong on both counts I'm afraid! I don't have any connection with Microsoft, but I'm a huge fan of Lightswitch, and will happily evangelise to anyone about it.

    Perhaps the difference between you and I is that I am looking at what Lightswitch is now, compared to what we had without it, and looking at what are the key pieces of functionality that we need. Whilst a customised log-on screen would be nice, my opinion is that it is not as important as many of the other feature requests that we've been discussing here.

    I have no idea about your background, but I have over thirty years experience as a software developer, and I have seen tools grow and mature. Compared to most of the v1 software I've seen, Lightswitch is amazing in what it does do. Sure, it misses some things, but you show me a piece of software that had everything in v1. It just doesn't happen.

    Bad  Boogie answer  !!!!!!!!

    show some more respect

    I'm not quite sure what part of my reply you consider disrespectful. I was trying to explain why I don't think your criticism of Lightswitch was fair. You are quite entitled to disagree, but given the way you bashed Lightswitch because it is missing one small feature, I hardly think my reply shows a lack of respect.

    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/
         Misunderstanding ---> This is my reaction to Shadow?! about Steve NOT to you in person.  it's a reply to earlier post in this conversation above

    Eric
    Friday, September 23, 2011 2:46 PM
  • Misunderstanding ---> This is my reaction to Shadow?! about Steve NOT to you in person.  it's a reply to earlier post in this conversation above
    Many apologies, the way it showed up under my post made it look like it was a reply to me. Hope my reply didn't upset you!

    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/
    Friday, September 23, 2011 2:52 PM
  • Wow, sry bout that BEA2701... I get what your saying and see that Mr Yossu got his wires crossed and was directing his displeasure at me :)

    Great stuff... 

    Steve no disrespect. Lightswitch is probably the best product to come along from MS in years and ties alot of technologies together that after reading a post from last year where basically the same question was asked and the same answer was given that the point needed a new visit.

    Friday, September 23, 2011 3:17 PM
  • Guys,

    Log In Screen customisation required compulsory. We launched one small application recently and 100% of  users are requested else it looks bit odd with out header / image.

     

    Regards

    Rama

     

     


    Rama dwarapudi
    Friday, September 23, 2011 5:14 PM
  • hi!

    same here, me and my boss created same type of app (kind of internal contest), but me in lightswitch, and he in asp.net with devexpress controls, lightswitch app looks nicer when you login into app, and it seems to be more functional, but asp.net version of my boss have "killer" login screen and start-up page (i must admit, he done that part very good), and to be short - customer choose his app.. i was little frustrated, but ok.. life goes on.. lightswitch will get to V2.. :)

    cheers!

    Kivito

    Friday, September 23, 2011 5:41 PM
  • No disrespect, but are you really saying that everything else was equal, and the customer chose the boss' app because it had a nicer log-on screen? Who did the demo, was it the boss? If so, it's not wonder the customer chose his app!

    Like I said earlier, this is one of those issues that would be nice, but I really can't see it being anywhere near as important as most of the other feature requests that have been discussed. You only see the log-on screen for a brief moment, then spend the whole time inside the app. If the main app is any good, the log-on screen will be long forgotten by the time they come to make a decision.

    You mentioned that the boss used devexpress controls in his asp.net version. Did you do the same in the LS version? If not, that's far more likely to have made an impression than the log-on screen. Haven't used those specifically, but most of these component vendors produce sleek stuff that spiffs up any app. From the little info you've given about it, I would venture to suggest that this would have made a far bigger impression than a log-on screen ever could.

    Don't get me wrong, I'm all in favour of being able to customise the log-on screen, but I can't believe that this would be the deciding factor against everything else, especially given the vastly improved development times that LS offers. Sounds like your boss did a really biased presentation!


    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/
    Sunday, September 25, 2011 1:53 PM
  • I agree. Sounds like politics instead of function. Anyone choose a login screen over function deserves what they get. Did all the other stuff work.  This is typical sales stuff.  However, for good or bad, the first 10 seconds of curb appeal do leave impressions in peoples minds. That said, you could have created a asp page also and have that token used in security of LS app. That is one way to get a custom login.
    - "Five is right out!"
    Sunday, September 25, 2011 8:01 PM
  • hi!

    for my case, im not saying that my app is better, it is same type of app, and my boss did great job, functionality and everything, man knows his job.. and of course, they have their own reasons for choosing "his" app (after all, WE sell that app), and i agree that login screen cannot be reason for choosing another product, but one of reactions was "that" login screen.. somehow we agreed that lightswitch (currently) is maybe better to create backend part of IE. web shop, visual representation and first impressions are on side of asp.net..

    Kivito

    Sunday, September 25, 2011 8:38 PM
  • hmm.  I feel the reverse. asp forms apps I can spot a mile away. They feel so console or something and you have all the back button stuff that aways messes up your input somehow.  Visual rep is firmly on LS side IMHO. But opinions will vary.
    - "Five is right out!"
    Sunday, September 25, 2011 11:01 PM
  • 96 votes in 3 days. I hope you didn't vote 96 for your own request :P Just kidding. Sorry couldn't resist

    Ahmed is an independent consultant in Ottawa, Canada specialized in .NET, Biztalk, WCF, WPF, TFS and other Microsoft technologies.

    Blog: http://lajak.wordpress.com

    Twitter: ahmedalasaad

    Monday, September 26, 2011 4:14 AM
  • Like I said earlier, this is one of those issues that would be nice, but I really can't see it being anywhere near as important as most of the other feature requests that have been discussed. You only see the log-on screen for a brief moment, then spend the whole time inside the app. If the main app is any good, the log-on screen will be long forgotten by the time they come to make a decision.

    Don't get me wrong, I'm all in favour of being able to customise the log-on screen, but I can't believe that this would be the deciding factor against everything else, especially given the vastly improved development times that LS offers. Sounds like your boss did a really biased presentation!

    While I can agree that there are other features/ideas that are pretty important, you have to step back for a second and realize that those of us in a corporate business environment are interacting with all kinds of people. It's easy for us programmers to understand that functionality trumps everything else when it comes to the application and its processes. Despite this, "New" software for big businesses has to deliver both functionality AND aesthetics, and if either of the two are lacking... well your product is losing value. The first thing the CEO/client/investor sees when pulling up your app is the login screen. From that moment on if it doesn't look as good as it sings, that person's first impression is not a great one.

    Is there a work around for this? Yes. 
    Would it be easy to expose the xaml and allow developers to customize the screen? Yes.

    A seemingly trivial issue to some, this seems like it has been overlooked and deemed unimportant. I urge those of you working in a large corporate environment who can relate to voice your opinions as well. 

    Thank you Kivito for that story which is a prime example of what I am referring to and also, kudos to MS for this amazing product which is a development powerhouse. 

     

    Wednesday, September 28, 2011 4:02 PM
  • I've said it before, & I'll say it again now. The "technical expertise" of the LightSwitch team is beyond question, they are fantasic in this regard. However, whoever is making the "business-related" decisions (my apologies to whoever I'm insulting here, I'm just stating the facts) needs to get better advice than what they're getting now.

    Unfortunately Steve has picked up on the "extensibility" aspect of what's being said in this thread, & has quite rightly said that this is a "nice to have" feature, but that there are more important features that peole want than that.

    However, and it's a BIG however, the *real* issue behind this thread is that the login page is so woefully inadequate in the first place. Whoever created that "page" should really hang their head in shame. I'm sorry, but it's just not good enough to have two textboxes sitting out in the middle of nowhere like that. It just doesn't fit in with the reasonably polished look of the rest of the application. If the author of that page wants to contact me, please feel free to do so (I won't expose your name, but I'd LOVE to hear why the page is like it is).

    First impressions DO matter, & anyone who tries to argue against that just doesn't "get it" in the real world.

    Just once, I'd like to see Steve, or anyone else in the team who tries to justify the unjustifiable) go "Oh, maybe we got it wrong. Good point. We'll look at what we can do about that", instead of trying to tell US that we don't know what we need, or what our customers want, or that it's just not important enough to warrant attention. It's this type of "justification" that engenders the kind of remark made earlier. People just want to feel like they're being "heard", not "lectured to", be "summarily dismissed" all the time.

    There are so many *simple* things that could have been done to that particular page to make it 1000% better:

    • A simple border surrounding the textboxes (you only have to look at my TextBlock control, or GroupLayout control) to see the enormous difference even something that simple makes to any screen.
    • The application name, the current date/time, a title, ANYTHING, could have been added above the grouped textboxes, to make the page look a little more "professional".
    • And *glaringly* obvious, when the "Logo Image" was removed from where it was displayed in B2/RTM, this would have been the PERFECT place to show it.

    So, it's not so much that the page isn't completely customisable (though why you can't customise it in a shell extension, I just don't know), it's that what we're "stuck with" is SO inadequate in the first place.

    Any one of the small things that I've just suggested above would have been a HUGE improvement, & a lot less people would be compaining now (& rightly so IMNSHO).

    This is one of the reasons that I doubt that I'd ever be considered for an MVP, but my primary concern is to say what I think *needs* to be said (whereas some other people will only tell the team how wonderful they are, which they need to hear of course, but there needs to be a balance). I tell them when I think something is good (I think I do, don't I?). I try to do whatever I can to help people, to improve their experience with LightSwitch (be it posts, answers, opinions, suggestions, extensions etc), but if the Emporer has no clothes on, I'm going to be one of the first saying that he's naked. Full stop. That's not going to change.


    Yann

    (plus ça change, plus c'est la même chose!)

    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, remember to "Mark as Answer".

    This will help people find the answers that they're looking for more quickly.

    Wednesday, September 28, 2011 11:53 PM
    Moderator
  • I having lunch with Billy at Monday. I don't see any problems for MVP but don't become MFP!

     

    cheers!


    Eric
    Thursday, September 29, 2011 1:49 AM
  • The funny part is.  Google made billions on a white page with a single textbox for years. Maybe they thought it would still work :-)
    - "Five is right out!" Please mark as answered if this answers the question :-)
    Thursday, September 29, 2011 3:43 AM
  • Who's Billy? And what's an MFP???

    :-P

    @William - not quite the same thing! Besides, there's always been the GOOGLE header, so it's never been JUST a white page with a single textbox. And they've changed it quite a few times over the years as well.


    Yann

    (plus ça change, plus c'est la même chose!)

    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, remember to "Mark as Answer".

    This will help people find the answers that they're looking for more quickly.

    Thursday, September 29, 2011 4:37 AM
    Moderator
  • Eric - Have a great lunch!?? (not sure what that was about?)

    Yann - You Rock Man!!! Thanks for the backup!!! You have added some validity from a real LS user... I agree with you, I think we just want some kind of acknowledgment that this is a real concern for business applications and not to just dismiss it...

    We are actually looking to use Lightswitch on most of our future projects (in a business environment) that will be used both internally and externally throughout the US. Hopefully this is the direction and focus the LS team is taking? so having more than just a White screen is critical for us.

    Here is the post from over a year ago that prompted me to add input to this thread.

    http://social.msdn.microsoft.com/Forums/en-AU/lsextensibility/thread/66df9bef-fcdd-480f-b231-44eb6c36e9db

     

    Thursday, September 29, 2011 2:21 PM
  • No problem! I'm only stating what I believe personally, and from my experience with my own clients.

    I've made myself pretty unpopular with certain people at MS, for daring to express opinions that don't agree with what they believe, have been told to believe, or what *they* want the product to be, but rest assured that the people on the team who actually count really *are* listening, they just don't have the time to post on here.

    We won't always get what we need as quickly as we'd like, but the kind of defensive/dismissive/argumentative attitude that we've been getting from a couple of the more vocal "representatives" of the team really doesn't help the situation at all.

    I do believe there's hope though.


    Yann

    (plus ça change, plus c'est la même chose!)

    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, remember to "Mark as Answer".

    This will help people find the answers that they're looking for more quickly.

    Thursday, September 29, 2011 2:41 PM
    Moderator
  • just one comment from my side. May be we should be more aware of our different cultures and opinions what's friendly or unfriendly and what's a well-intentioned hint or a verbal attack. My wife has a lot of business contacts with people all over the world. She told me that it's sometimes incredible difficult to strike the right note (hopefully it's the right term).

    I understand if Microsoft defends certain functionalities because I'm sure they don't do things without a reason but this is also true for us, the people using LightSwitch when requesting functionality. I also know that's often not so easy for Microsoft for making descions what to implement and how to implement it, because different cultures sometimes have different needings. For me internationalization is a absolut first class request, for someone creating business apps just for english language area it's of no interesst.

    I guess a great majority of people in this forum are happy with LightSwitch even in it's V1 version and concentrating a lot of effort creating business solution with it.So at the end Microsoft and we as users should have the same target. Having the leading tool for creating business apps for small to medium sized  solutions, with the best functionality and the best eco system.


    Keeping this at the back of our mind, I think we have a perfect base for our discussions

    Uwe

    P.S.: Sometimes it would be great if the LS-Team would allow us a deeper sight in their souls, that we know what's going on in the future (they could eliminate a lot of discussion), but I'm sure they are not allowed to tell us what they know.

    Friday, September 30, 2011 10:50 AM
  • Thanks Steve,

    Great advice...

    http://visualstudio.uservoice.com/forums/127959-visual-studio-lightswitch/suggestions/2269502-allow-a-background-image-on-login-screen-

    Vote if this is a "Hot Button" issue for your app...

    Or, if your users enjoy the cool calming effect of a "White" soothing Login screen, then move along (and you shouldn't have read this far down)...

    -SD.



    I'd voted, but why the question is "Allow a Background Image on Login Screen" only? For example, it would be nice to store username into the IsolatedStorageSettings, enable debugging, new user registration, etc. By the way, there is an ability to add a "background image":

    using System.Reflection;
    using Microsoft.LightSwitch.Runtime.Shell.Internal.Implementation;
    
    
            Frame rootFrame = null;
            partial void Application_Initialize()
            {
    Microsoft.LightSwitch.Threading.Dispatchers.Main.BeginInvoke(() => {
                    rootFrame = ((Page)((ContentPresenter)System.Windows.Application.Current.RootVisual).Content).Content as Frame;
                    if (rootFrame != null)
                        rootFrame.Navigated += new System.Windows.Navigation.NavigatedEventHandler(rootFrame_Navigated);
                });
            }
            void rootFrame_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
            {
                if (e.Content is LoginPage) {
                    // prepare image, that is laying in the Resources folder as Embedded Resource
                    System.Windows.Media.Imaging.BitmapImage image = new System.Windows.Media.Imaging.BitmapImage();
                    image.SetSource(Assembly.GetExecutingAssembly().GetManifestResourceStream(Application.Current.Details.Name + ".Resources.MyLogoBackgroundImage.jpg"));
                    Image mylogo = new Image() { Source = image, Stretch = System.Windows.Media.Stretch.Uniform };
                    mylogo.SetValue(Grid.ColumnSpanProperty, 5);
                    mylogo.SetValue(Grid.RowSpanProperty, 7);
                    // add image
                    Grid grid = ((LoginPage)e.Content).Content as Grid;
                    grid.Children.Insert(0, mylogo); // not Add, for background
                    rootFrame.Navigated -= rootFrame_Navigated;
                }
            }
    
    
    p.s. may be using rootFrame.Navigating handler it will be possible to shove own (custom) LoginPage, i didn't try yet...
    p.p.s. excuse my english ))





    Friday, September 30, 2011 12:34 PM
  • Now that's a damned good start! Not perfect, but with a bit of judicious editing of an image (tedious though), it's a BIG improvement.

    Well done!

    I'm going to experiment with this technique some more. Would you mind if I wrote this up as a sample for everyone (giving you credit, of course)?

    Here's what I managed so far:


    Yann

    (plus ça change, plus c'est la même chose!)

    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, remember to "Mark as Answer".

    This will help people find the answers that they're looking for more quickly.

    Saturday, October 1, 2011 1:52 PM
    Moderator
  • WOW... that is really a good start.

     

    Thx to LR__ & Yann. :)


    -Bala
    Saturday, October 1, 2011 2:55 PM
  • I'm going to experiment with this technique some more. Would you mind if I wrote this up as a sample for everyone (giving you credit, of course)?

    Yann

    Yann, it wil be fine, thank you :)

    I tried to make custom login page and made some skeleton (basing on decompiled LoginPage code)... there are few imperfections, because impossible to use RuntimeMessageBoxService (on login failed) and to call CodeMarker.Mark(ShellCodeMarkers.ShowLoginPage.End) due to ShellCodeMarkers is internal class :( i don't know what the last may lead to... However, "custom login page" works fine, and may be customized very well.

    I'm sorry for a lot of code (i woud like to attach file but couldn't find this feature here), hope this code wil be useful for somebody. So, MyLoginPage is SL Page item, consists of xaml and c# parts:

    XAML (probably this part have to be customized mostly)

    <navigation:Page x:Class="LightSwitchApplication.MyLoginPage" 
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
               xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
               xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
               mc:Ignorable="d"
               d:DesignWidth="640" d:DesignHeight="480"
               Loaded="loginPage_Loaded"
               >
        <Grid Background="Transparent">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="2"/>
                <ColumnDefinition Width="180"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="2"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="2"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <TextBlock x:Name="userNameLabel" Grid.Column="1" Grid.Row="1" FontWeight="Bold"/>
            <TextBox x:Name="userNameTextBox" Grid.Column="3" Grid.Row="1" Text="{Binding Path=UserName,Mode=TwoWay}" TextChanged="userName_TextChanged"/>
            <TextBlock x:Name="passwordLabel" Grid.Column="1" Grid.Row="3" FontWeight="Bold"/>
            <PasswordBox x:Name="passwordBox" Grid.Column="3" Grid.Row="3" Password="{Binding Path=Password,Mode=TwoWay}"/>
            <Button x:Name="loginButton" Grid.Column="3" Grid.Row="5"
                     Command="{Binding Path=LoginCommand}"
                     CommandParameter="{Binding}"
                     Click="loginButton_Click"
                     HorizontalAlignment="Right"/>
        </Grid>
    </navigation:Page>
    
    

    C#

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Navigation;
    
    using Microsoft.LightSwitch.Runtime.Shell.Internal;
    //using Microsoft.VisualStudio.ExtensibilityHosting;
    using Microsoft.LightSwitch.Runtime.Shell.ViewModels.Login;
    using Microsoft.LightSwitch.Runtime.Shell.Helpers;
    using Microsoft.LightSwitch.Runtime.Shell.Implementation.Resources;
    using System.Globalization;
    using System.Windows.Browser;
    using System.Windows.Data;
    using System.ComponentModel;
    
    namespace LightSwitchApplication
    {
        public partial class MyLoginPage : Page
        {
            public readonly static DependencyProperty ViewModelProperty;
            //private IRuntimeMessageBoxService messageBoxService;
    
            static MyLoginPage()
            {
                MyLoginPage.ViewModelProperty = DependencyProperty.Register("ViewModel", typeof(ILoginViewModel), typeof(MyLoginPage), new PropertyMetadata(new PropertyChangedCallback(MyLoginPage.ViewModelPropertyChanged)));
            }
    
            public MyLoginPage()
            {
                this.InitializeComponent();
                this.SetValue(ComponentViewModelService.ViewModelNameProperty, "Default.LoginViewModel");
                Title = string.Format(CultureInfo.CurrentCulture, Strings.LoginPage_Login, new object[0]);
                userNameLabel.Text = Strings.LoginPage_UserName;
                passwordLabel.Text = Strings.LoginPage_Password;
                loginButton.Content = Strings.LoginPage_Login;
            }
    
            //private IRuntimeMessageBoxService MessageBoxService
            //{
            //    get
            //    {
            //        if (this.messageBoxService == null) {
            //            VsExportProviderService.TryGetExportedValue<IRuntimeMessageBoxService>(Scopes.Local, out this.messageBoxService);
            //        }
            //        return this.messageBoxService;
            //    }
            //}
    
            public INavigate Navigable
            {
                get
                {
                    DependencyObject parent = this;
                    while ((parent as INavigate) == null) {
                        parent = VisualTreeHelper.GetParent(parent);
                    }
                    return (INavigate)parent;
                }
            }
    
            Dictionary<string, string> navigationQueryStringValues = new Dictionary<string, string>();
            public IDictionary<string, string> NavigationQueryStringValues
            {
                get
                {
                    return navigationQueryStringValues;// base.NavigationContext.QueryString;
                }
            }
    
            private ILoginViewModel ViewModel
            {
                get
                {
                    return (ILoginViewModel)base.DataContext;
                }
            }
    
            private void loginButton_Click(object sender, RoutedEventArgs e)
            {
                this.OnLoggingInChanged(true);
            }
    
            private void LoginCommand_CanExecuteChanged(object sender, EventArgs e)
            {
                this.UpdateLoginButtonIsEnabled();
            }
    
            private void LoginFailedPropertyChanged()
            {
                if (!this.ViewModel.LoginInfo.LoginFailed)
                    return;
                string message;
                if (this.ViewModel.LoginInfo.Exception != null) {
                    message = this.ViewModel.LoginInfo.Exception.Message;
                    this.ViewModel.LoginInfo.Exception = null;
                } else
                    message = Strings.LoginPage_InvalidLoginInfo;
                //this.MessageBoxService.ShowAlert(message, Microsoft.LightSwitch.BaseServices.Alert.MessageAlertType.Error, (Action)(() => this.userNameTextBox.Focus()));
                // unfortunately, code above results in "formidable" error:
                //The application has stopped responding due to an error and needs to be restarted.
                //Error details: The local scope can only be retrieved by a microsoft signed assembly.
                // so using simple "messagebox service" ))
                MessageBox.Show(message, Strings.LoginPage_Login, MessageBoxButton.OK);
                this.userNameTextBox.Focus();
                this.ViewModel.LoginInfo.LoginFailed = false;
                this.OnLoggingInChanged(false);
                this.ViewModel.UserName = string.Empty;
                this.ViewModel.Password = string.Empty;
            }
    
            private void LoginInfo_PropertyChanged(object sender, PropertyChangedEventArgs e)
            {
                if (e.PropertyName == "LoginFailed") {
                    this.LoginFailedPropertyChanged();
                }
            }
    
            private void loginPage_Loaded(object sender, RoutedEventArgs e)
            {
                if (HtmlPage.IsEnabled) {
                    HtmlPage.Plugin.Focus();
                }
                this.userNameTextBox.Focus();
                Binding binding = new Binding();
                base.SetBinding(MyLoginPage.ViewModelProperty, binding);
                this.UpdateLoginButtonIsEnabled();
                //Microsoft.LightSwitch.Performance.Internal.CodeMarker.Mark(ShellCodeMarkers.ShowLoginPage.End); // what this may lead to?
                // Microsoft.LightSwitch.Runtime.Shell.CodeMarkers.Internal.ShellCodeMarkers is internal class :(
            }
    
            protected override void OnKeyDown(KeyEventArgs e)
            {
                base.OnKeyDown(e);
                if (this.loginButton.IsEnabled && !e.Handled && e.Key == Key.Enter) {
                    this.userNameTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource();
                    this.passwordBox.GetBindingExpression(PasswordBox.PasswordProperty).UpdateSource();
                    this.OnLoggingInChanged(true);
                    this.ViewModel.LoginCommand.Execute(this.ViewModel);
                }
            }
    
            private void OnLoggingInChanged(bool isLoggingIn)
            {
                this.userNameTextBox.IsEnabled = isLoggingIn == false;
                this.passwordBox.IsEnabled = isLoggingIn == false;
                if (isLoggingIn) {
                    base.Cursor = Cursors.Wait;
                } else {
                    base.Cursor = null;
                }
                this.UpdateLoginButtonIsEnabled();
            }
    
            private void UpdateLoginButtonIsEnabled()
            {
                this.loginButton.IsEnabled = (!this.ViewModel.LoginCommand.CanExecute(this.ViewModel) ? false : !string.IsNullOrEmpty(this.userNameTextBox.Text));
            }
    
            private void userName_TextChanged(object sender, RoutedEventArgs e)
            {
                this.UpdateLoginButtonIsEnabled();
            }
    
            private static void ViewModelPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
            {
                MyLoginPage loginPage = (MyLoginPage)obj;
                ILoginViewModel dataContext = (ILoginViewModel)loginPage.DataContext;
                dataContext.LoginInfo.Navigable = loginPage.Navigable;
                dataContext.LoginInfo.NavigationQueryStringValues.Clear();
                foreach (KeyValuePair<string, string> navigationQueryStringValue in loginPage.NavigationQueryStringValues) {
                    dataContext.LoginInfo.NavigationQueryStringValues.Add(navigationQueryStringValue.Key, navigationQueryStringValue.Value);
                }
                dataContext.LoginInfo.PropertyChanged += new PropertyChangedEventHandler(loginPage.LoginInfo_PropertyChanged);
                dataContext.LoginCommand.CanExecuteChanged += new EventHandler(loginPage.LoginCommand_CanExecuteChanged);
            }
        }
    }
    
    

    and, finally, rootFrame_Navigated handler (see my previous message)

            void rootFrame_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
            {
                if (e.Content is LoginPage) {
                    LoginPage lp = e.Content as LoginPage;
                    MyLoginPage mlp = new MyLoginPage();
                    foreach (KeyValuePair<string, string> navigationQueryStringValue in lp.NavigationContext.QueryString) {
                        mlp.NavigationQueryStringValues.Add(navigationQueryStringValue.Key, navigationQueryStringValue.Value);
                    }
                    rootFrame.Content = mlp;
    
                    // perhaps it's onetime operation?
                    rootFrame.Navigated -= rootFrame_Navigated;
                    rootFrame = null;
                }
            }
    
    

    p.s. i used two free decompilers - Telerik JustDecompile (fast and comfortable, but beta) and JetBrains dotPeek (slow and uncomfortable, but more reliable)

    p.p.s. excuse my english :)

     


    • Edited by LR__ Sunday, October 2, 2011 9:30 AM
    Saturday, October 1, 2011 10:48 PM
  • hi Pletzky i used ASPX to customize my own sign in screen and am already use it in many project and its Suffice

     

    1. Switch your LightSwitch solution to “File View”

    2. Click on Show All Files

    3. Right click on the Server Generated project and Add New Item

    4. Add the ASPX page called SingIn with the appropriate code.

      <form id=”form1″ runat=”server”><div>

     

    <p>Sign in</p>

    <asp:Label ID=”Label1″ runat=”server” Text=”User Name”></asp:Label>

    <asp:TextBox ID=”TextBox1″ runat=”server” Width=”128px”></asp:TextBox>

    <asp:Label ID=”Label2″ runat=”server” Text=”Password”></asp:Label>

    <asp:TextBox ID=”TextBox2″ runat=”server”

    TextMode=”Password” Width=”128px”></asp:TextBox>

    <asp:Button ID=”BtnSingIn” runat=”server” Text=”Sign In”

    onclick=”BtnSingIn_Click”/>

    <center><label id=”lblForgot”>Forgot password </label>

    <a href=”https://www.in4doctor.com” target=”_self”>click here</a></center>

    </div>

    </form>

    5- Now we need to write BtnSingIn_Click event:

    protected void BtnSingIn_Click(object sender, EventArgs e)

     

    {

    Microsoft.LightSwitch.Security.ServerGenerated.Implementation.User user;

    Microsoft.LightSwitch.Security.ServerGenerated.Implementation.AuthenticationService x = new Microsoft.LightSwitch.Security.ServerGenerated.Implementation.AuthenticationService();

    user = x.Login(TextBox1.Text, TextBox2.Text, false, “”);

    if (user != null)

    {

    Response.Write(“<script>window.parent.location=\”http://www.StudentCourse.Com/default.htm\”</script>”);

    } // you need to change the URL according to your Project

    }

    6. We now need to get SingIn.aspx to be included in the build output.  Right click on your project in solution explorer and select Unload Project.

    7. Right click the project and select Edit.

    8. Search the file and for default.htm.  You should find a section called _BuildFile.

    9. Underneath the _BuildFile section for default.htm, add the following.

    <_BuildFile Include=”ServerGenerated\Singin.aspx”>
    <SubFolder>
    </SubFolder>
    <PublishType>
    </PublishType>
    </_BuildFile>

    10. Now Insert your login account  the and enjoy

    ——————————————–

    Jamil Bin Milhem

    IN4MA 

    Jamil.milhem@in4ma.com


    Jamil MilheM IN4 Developer ----------------- IN4MA Development Team
    • Proposed as answer by Jamil MilheM Monday, October 3, 2011 6:34 AM
    Sunday, October 2, 2011 12:05 PM
  • Hi LR_

    Nice Tricks

    But

    where you use this code?

    can you give me a step by step procedure?


    Rashmi Ranjan Panigrahi
    Sunday, October 2, 2011 12:31 PM
  • Absolutely spot-on post Yann! I agree with everything you sad, and hope someone from MS reads it (don't hold out much hope though).


    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/
    Sunday, October 2, 2011 2:53 PM
  • Unfortunately, I'm no longer working on the Lightswitch project that brought about this question and I don't have time to confirm them, but both the answers by "LR__" and "Jamil MilheM" look promising to me.  If someone could verify them, I'd gladly mark them as answers.

    Brad.

    Monday, October 3, 2011 8:09 AM
  • LR's suggestion absolutely works! (see the image in a reply I posted further up the page).

    I'm working on a sample to post with step-by-step instructions, I'm just hoping to make the process a little easier before I post it.

    I'm not saying Jamil's suggestion doesn't work, I just haven't tried it. I will say though, that it's *replacing* the login screen, rather than customising the existing one as LR's technique does.


    Yann

    (plus ça change, plus c'est la même chose!)

    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, remember to "Mark as Answer".

    This will help people find the answers that they're looking for more quickly.

    Monday, October 3, 2011 9:02 AM
    Moderator
  • Thanks for posting this code, it's a huge improvement over what we had before.

    Do you know of a way to test this without deploying the application? When debugging, you never see a login screen, so you can't see if the one you've supplied is being displayed correctly, fits the window, etc. Is there a way to test this without deploying?

    Thanks again.


    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/
    Monday, October 3, 2011 1:25 PM
  • where you use this code?

    can you give me a step by step procedure?


    Rashmi Ranjan Panigrahi

    Hi, Rashmi Ranjan Panigrahi

    i'm not a good explanator, it would be better to wait until Yann Duran post his sample, which he kindly promised :)

    In two lines, you have to switch your ls proj to File View in solution explorer, find Application.cs in Client\UserCode folder, modify code of the Application class with those code from my first message. In case of adding image to default LoginPage it be enough :)

    Another case, if you want ui designing with say vs xaml designer tool, then you need add a silverlight item. On Client proj context menu -> Add -> New Item ->  Silverlight Page (it's for MyLoginPage from my prev message). But now i want to suggest a little differ way of the customization.

    Excuse me again for a lot of code, but may be this way will be the most optimal... Idea is to replace LoginPage content with a custom one (Silverlight User Control), save three login controls. LoginPage will be works properly, and we will get ability to design our SL User Control...

    So add to the Client proj a Silverlight User Control, in the sample i named it LoginPageCustomContent:

    XAML

    <UserControl x:Class="LightSwitchApplication.LoginPageCustomContent"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        d:DesignHeight="300" d:DesignWidth="400">
    
        <Grid x:Name="LayoutRoot" Background="Transparent">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="180"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Image Grid.ColumnSpan="4" Grid.RowSpan="5" Opacity="0.25" Stretch="Fill"
                Source="http://images.nationalgeographic.com/wpf/media-live/photos/000/410/custom/bats-fastest-muscles_41065_744x417.jpg"/>
            <TextBlock x:Name="userNameLabel" Grid.Column="1" Grid.Row="1" FontWeight="Bold" VerticalAlignment="Center"/>
            <TextBlock x:Name="passwordLabel" Grid.Column="1" Grid.Row="2" FontWeight="Bold" VerticalAlignment="Center"/>
            <!--<TextBox Grid.Column="2" Grid.Row="1" FontWeight="Bold" Margin="2" Text="UserName(design preview)"/>
            <PasswordBox Grid.Column="2" Grid.Row="2" FontWeight="Bold" Margin="2" Password="Password(design preview)"/>
            <Button Grid.Column="2" Grid.Row="3" FontWeight="Bold" Margin="2" HorizontalAlignment="Right" Content="(design preview)"/>-->
        </Grid>
    </UserControl>
    
    

    C#

    using System;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Media;
    
    using Microsoft.LightSwitch.Runtime.Shell.Implementation.Resources;
    using Microsoft.LightSwitch.Runtime.Shell.Internal.Implementation;
    
    namespace LightSwitchApplication
    {
        public partial class LoginPageCustomContent : UserControl
        {
            TextBox userNameTextBox;
            PasswordBox passwordBox;
            Button loginButton;
    
            public static void CustomizeContent(LoginPage loginpage)
    { loginpage.Content = new LoginPageCustomContent(loginpage); } public LoginPageCustomContent() { InitializeComponent(); userNameLabel.Text = Strings.LoginPage_UserName; passwordLabel.Text = Strings.LoginPage_Password; } private LoginPageCustomContent(LoginPage loginpage)
    : this() { // pull out wanted controls PulloutThreeLoginControls(loginpage.Content); ((Grid)loginpage.Content).Children.Clear(); // for ctrls Parent == null //push them into our places and little preening (Margin, FontWeight, etc) if (userNameTextBox != null && userNameTextBox.Parent == null) { userNameTextBox.SetValue(Grid.ColumnProperty, 2); userNameTextBox.SetValue(Grid.RowProperty, 1); userNameTextBox.Margin = new Thickness(2); userNameTextBox.FontWeight = FontWeights.Bold; this.LayoutRoot.Children.Add(userNameTextBox); } if (passwordBox != null && passwordBox.Parent == null) { passwordBox.SetValue(Grid.ColumnProperty, 2); passwordBox.SetValue(Grid.RowProperty, 2); passwordBox.Margin = new Thickness(2); passwordBox.FontWeight = FontWeights.Bold; this.LayoutRoot.Children.Add(passwordBox); } if (loginButton != null && loginButton.Parent == null) { loginButton.SetValue(Grid.ColumnProperty, 2); loginButton.SetValue(Grid.RowProperty, 3); loginButton.Margin = new Thickness(2); loginButton.FontWeight = FontWeights.Bold; this.LayoutRoot.Children.Add(loginButton); } } private void PulloutThreeLoginControls(UIElement element) { if (userNameTextBox != null && passwordBox != null && loginButton!=null) return; for (int i = 0; i < VisualTreeHelper.GetChildrenCount(element); i++) { UIElement child = (UIElement)VisualTreeHelper.GetChild(element, i); PulloutThreeLoginControls(child); } if (element is TextBox) userNameTextBox = element as TextBox; else if (element is PasswordBox) passwordBox = element as PasswordBox; else if (element is Button) loginButton = element as Button; } } }
    and, finally, rootFrame_Navigated (see my first message)
            void rootFrame_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
            {
                if (e.Content is LoginPage) {
                    LoginPageCustomContent.CustomizeContent(e.Content as LoginPage);
                     // perhaps it's onetime operation?
                    rootFrame.Navigated -= rootFrame_Navigated;
                    rootFrame = null;
                }
            }
    
    
    that's all

    p.s.excuse my english, i'm endeavouring ))


    • Edited by LR__ Monday, October 3, 2011 5:24 PM
    Monday, October 3, 2011 2:30 PM
  • No, you can obviously on test it when the login page gets displayed. The only way to do that is deply the app.

    You can deploy it to a local SQL instance though.


    Yann

    (plus ça change, plus c'est la même chose!)

    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, remember to "Mark as Answer".

    This will help people find the answers that they're looking for more quickly.

    Monday, October 3, 2011 2:49 PM
    Moderator
  • Thanks Yann.

    Your next assignment Copy/Paste a screen :)

    Monday, October 3, 2011 3:12 PM
  • Yeah, thought so. Worth asking!

    Thanks Yann.

    By the way, did you get any sleep last night? You were up very late! Hee hee, I sound like your mother!


    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/
    Monday, October 3, 2011 3:25 PM
  • I actually succeed this one time but unfortunately it is not well tested and doesn't work inside Visual Studio. Very risky though, one time it screwed up the whole project. :) :)  

    These are all in my "to do" LightSwitch extension list. Seems like I can't work on any of it for next month or so. Hope, someone already working on any of it. No hassle, u c. :)

    • Copy/Paste Page
    • Navigation Page
    • Credit Card Type/Control
    • String Format Control


    -Bala
    Monday, October 3, 2011 10:41 PM
  • One (may be useful) feature - storing/retrieving last LoggedIn UserName - can be added to my last version of customization:

    to Application class

            public const string LastLoggedInUserName_StorageKey = "LastLoggedInUserName";
            partial void Application_LoggedIn()
            {
                // see http://social.msdn.microsoft.com/Forums/en-US/lightswitch/thread/ef0ea646-9b86-402f-a65c-53263bcfb685
                // Justin Anderson, LightSwitch Development Team: LightSwitch starts the debugged application on a different port each time.
                // Since the isolated storage is dependent on the port number, you won't be able to read out the same settings each time.
    #if !DEBUG  // But, this is not the case for deployed applications.
                if (IsolatedStorageFile.IsEnabled && this.User != null && this.User.IsAuthenticated)
                    IsolatedStorageSettings.ApplicationSettings[LastLoggedInUserName_StorageKey] = this.User.Name;
    #endif
            }
    

    and some code modification of the LoginPageCustomContent(LoginPage loginpage):

            private LoginPageCustomContent(LoginPage loginpage)
                : this()
            {
                ...
                    this.LayoutRoot.Children.Add(userNameTextBox);
                    if (IsolatedStorageFile.IsEnabled && IsolatedStorageSettings.ApplicationSettings.Contains(Application.LastLoggedInUserName_StorageKey)) {
                        this.GotFocus += (s, e) => {
                            userNameTextBox.Text = IsolatedStorageSettings.ApplicationSettings[Application.LastLoggedInUserName_StorageKey].ToString();
                            //passwordBox.Focus();
                        };
                    }
                ...
    
    
     hope, this will be useful for somebody :)
    • Edited by LR__ Monday, October 17, 2011 8:08 PM
    Saturday, October 8, 2011 12:04 AM
  • Hey LR_,

    hii,

    Could you please walkthrough it(Login )....

    Right from the Start to end.

    pleaseeeee !!!!

    Thanks..

    Saturday, October 15, 2011 6:36 AM
  • Also, i am not able to add reference of implemetation it shows error on

    using Microsoft.LightSwitch.Runtime.Shell.Implementation.Resources;
    using Microsoft.LightSwitch.Runtime.Shell.Internal.Implementation;

    that the type or namespace doent exist.

    Saturday, October 15, 2011 6:41 AM
  • Sorry, I've been meaning to finish the sample I started for this. I've just been REALLY busy with the book.

    I'll see if I can get it finished for you!


    Yann

    (plus ça change, plus c'est la même chose!)

    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, remember to "Mark as Answer".

    This will help people find the answers that they're looking for more quickly.

    Saturday, October 15, 2011 7:25 AM
    Moderator
  • Also, i am not able to add reference of implemetation it shows error on

    using Microsoft.LightSwitch.Runtime.Shell.Implementation.Resources;
    using Microsoft.LightSwitch.Runtime.Shell.Internal.Implementation;

    that the type or namespace doent exist.

    Hi Shanon11

    You have to add reference to Microsoft.LightSwitch.Client.Internal.dll, in my system it is located here

    C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\LightSwitch\1.0\Client\Microsoft.LightSwitch.Client.Internal.dll

     

    Sunday, October 16, 2011 10:31 AM
  • This code you have not posted in VB? Thanks!
    Friday, November 4, 2011 1:56 PM
  • For what it's worth, I've posted for the community a step-by-step guide for creating your own custom ASP.NET-based login page and integrating it with your LightSwitch app.

    http://blogs.msdn.com/b/mthalman/archive/2011/12/08/creating-a-custom-login-page-for-a-lightswitch-application.aspx

    Thursday, December 8, 2011 2:20 PM
  • Hey guys,

    kind of have lost track of this thread, nice stuff you have come up with!

    One additional piece of info for _LR:  this code "//Microsoft.LightSwitch.Performance.Internal.CodeMarker.Mark(ShellCodeMarkers.ShowLoginPage.End);" is simply LightSwitch's complicated way of saying: "Log a message in the SL Isolated Storage that showing the loginpage has ended... Now..."

    I don't know how to read all messages (maybe the tracing?) but I guess it was just something that was really usefull for the LS crew during development, trying to monitor performance / control flow / threading / debugging / ...


    Lightswitch blog: http://janvanderhaegen.wordpress.com || About me: http://about.me/jan.van.der.haegen || "The improbable we do, the impossible just takes a little longer." (Steven Parker)
    Wednesday, January 4, 2012 10:11 PM
  • I'm about to release a custom shell extension (Luminous Classic Shell), that will give the full functionality of the default shell, plus the ability to have a logo image in either the ribbon or the navigation menu (or both I guess), PLUS it will automatically "pretty up" the login page with the same logo image & a colored rectangle. It works for both desktop & web apps.

    I'm sure there'll be plenty of requests to "change" this or that, but for now it looks like this, with logo image, application title, login fields, login button, themed background, and the application version:

    A single line of code is all that's required to activate what you see above (plus the logo image needs to be specified in the project properties). Obviously some images will work better than others.

    The ribbon looks like this (the image can go on the left or the right). A square image looks best on the left, while a rectangular image looks best on the right. In the navigation bar, the image can go at the top, or at the bottom. A square image, or rectangular one where the height is greater than the width, works best for the navigation bar. Both images are are automatically scaled (the ribbon image based on the image height, & the navigation image based on the image width).


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    If you find a reply helpful, please click "Vote as Helpful", if a reply answers your question, please click "Mark as Answer"
     
    By doing this you'll help people find answers faster.
    Thursday, January 5, 2012 10:57 AM
    Moderator
  • Just as an FYI, if you've used the solution of detecting the navigation to the login page and then replacing/tweaking its UI in your custom shell, we cannot guarantee that any updates or future versions of LightSwitch will allow your implementation to work because you are relying on internal implementation details of the runtime.
    Justin Anderson, LightSwitch Development Team
    Thursday, January 5, 2012 11:20 AM
    Moderator
  • Hi Yann, with this be released as a sample or will it be in your upcomming book?
    See my blog C# Bits | Twitter @sjnaughton Always seeking an elegant solution.
    Thursday, January 5, 2012 11:50 AM
  • Well, do you have any "recommended" way of doing it? Not being rude, but you can see from this thread that this is a feature that is wanted by a lot of people. Can you show us a way of doing this that is unlikely to break in a future version of LS?

    FREE custom controls for Lightswitch! A collection of useful controls for Lightswitch developers. Download from the Visual Studio Gallery.

    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/

    Thursday, January 5, 2012 1:32 PM
  • I appreciate you pointing that out Justin. As you know, there's not really currently any other way of doing it. But it's a V1 shell, & I accept that.

    I'm assuming that there WILL be a change in V2 in this regard (& I'm not *relying* on it being compatible with anything taht I create now). I'd be *extremely* surprised if the team hadn't taken on board all of the feedback that people have been giving about how this aspect needs to be improved.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    If you find a reply helpful, please click "Vote as Helpful", if a reply answers your question, please click "Mark as Answer"
     
    By doing this you'll help people find answers faster.
    Thursday, January 5, 2012 2:00 PM
    Moderator
  • I guess this http://blogs.msdn.com/b/mthalman/archive/2011/12/08/creating-a-custom-login-page-for-a-lightswitch-application.aspx is their recomended way :)
    See my blog C# Bits | Twitter @sjnaughton Always seeking an elegant solution.
    Thursday, January 5, 2012 2:06 PM
  • No, it'll be released in the Visual Studio Gallery.
    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    If you find a reply helpful, please click "Vote as Helpful", if a reply answers your question, please click "Mark as Answer"
     
    By doing this you'll help people find answers faster.
    Thursday, January 5, 2012 2:10 PM
    Moderator
  • I guess this http://blogs.msdn.com/b/mthalman/archive/2011/12/08/creating-a-custom-login-page-for-a-lightswitch-application.aspx is their recomended way :)
    Yes, except that only works for browser-based apps. The way that _LS showed works for desktop too as I remember.

    FREE custom controls for Lightswitch! A collection of useful controls for Lightswitch developers. Download from the Visual Studio Gallery.

    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/

    Thursday, January 5, 2012 2:22 PM
  • Will you do an article on it Yann?
    See my blog C# Bits | Twitter @sjnaughton Always seeking an elegant solution.
    • Edited by sjnaughton Thursday, January 5, 2012 8:35 PM
    Thursday, January 5, 2012 8:35 PM
  • Hi !

    I tried to implement the code above, but it throws an error: Can not find the type or namespace 'LoginPage'. Why? Should I add a reference in the proyect?

    Regards

    Friday, May 11, 2012 4:32 PM
  • Hi !

    I tried to implement the code above, but it throws an error: Can not find the type or namespace 'LoginPage'. Why? Should I add a reference in the proyect?

    Regards

    If you look in the 3rd post in this discussion, Jan mentioned that you need a reference to LightSwitch.Client.Internal.dll to get at this screen. Make sure you have that.

    FREE custom controls for Lightswitch! A collection of useful controls for Lightswitch developers. Download from the Visual Studio Gallery.

    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/

    Sunday, May 13, 2012 1:52 PM
  • I'm about to release a custom shell extension (Luminous Classic Shell), that will give the full functionality of the default shell, plus the ability to have a logo image in either the ribbon or the navigation menu (or both I guess), PLUS it will automatically "pretty up" the login page with the same logo image & a colored rectangle. It works for both desktop & web apps.

    Hi Yann,

    Did you ever release this? I would love to see something like this made available.

    Also, now that V2 is in beta, does your shell work with that? I know this is only a beta, but I would be surprised if they made any big changes between now and RTM, so if your shell works in the beta, there's a good chance it will work in the RTM.

    Thanks


    FREE custom controls for Lightswitch! A collection of useful controls for Lightswitch developers. Download from the Visual Studio Gallery.

    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/

    Sunday, May 13, 2012 2:07 PM
  • Hello, LR_

    I am freshman and use VB only, and find the rootFrame.Navigated (rootFrame.Navigated += new System.Windows.Navigation.NavigatedEventHandler(rootFrame_Navigated);) cannot convert to VB to use and ask use RAISEEVENT instead! Could you please provide those code in VB will be high appreciation if possible?
    Saturday, October 5, 2013 3:46 PM
  • Could you tell me how to change to VB?
    Tuesday, October 8, 2013 11:58 AM
  • Custom Login by DockShell

    My name is Cliff Lo and I have just confirmed with the maker of Dockshell Johnny Larue that it may be possible to add a custom silverlight login even of the desktop version at Softlanding Canada Forums.

    I am not posting the link because of the weird requirement that MSDN need to verify my account in order to enable me adding links and images. I don't know how to solve it. My name is Cliff Lo and the respective post is in the General Discussion - Create Custom Login Screen

    However, even Johnny himself said that he did not provide a complete solution at this moment. Would the colleagues here please help evaluate his answer a bit to make it a more complete solution. Anyone would you please help me to add the link inside as well and tell me how to let MSDN verify me. Thanks.

    Regards,

    Cliff

    Thursday, January 30, 2014 10:27 AM
  • Cliff,

    Here is the link to that discussion thread I assisted you on.

    As I point out in that thread, I suggest you to follow the example provided in this thread.

    There are a few slight differences in my thread (mentioned below) and although I have not fully implemented the solution, the sample logic I have added does run at startup under debug and should provide a replacement for the Login page as per the example shown above. I do not think it is possible to force the Login Page at startup under debug without first deploying the application.

    As can be seen the code I provided you in my support thread it uses DockShell API to run similar logic at startup.

    What I proposed to you is to place the Login controls within the BackStage of the RibbonView control to provide a seamless login screen to the user.  This was only suggestion, for as I mentioned in the thread , you could create any Custom Login Page you'd like.

    I am very interested in seeing you happily create a custom login page and the only reason I didn't complete your request was because I was busy assisted an existing DockShell customer integrating DockShell 3.0 for Visual Studio 2013.

    I do plan to finalize this example and will incorporate this into the DockShell provider.

    Cheers,

    Johnny


    Johnny Larue, http://www.softlandingcanada.com


    • Edited by John Kears Thursday, January 30, 2014 1:49 PM
    Thursday, January 30, 2014 1:48 PM
  • Cliff,

    As promised here is an example of the custom login page within DockShell as mentioned in the forum posting link from above.

    I hope that helps you.

    Cheers


    Johnny Larue, http://www.softlandingcanada.com

    Friday, January 31, 2014 1:22 PM