Search Results

Search found 278 results on 12 pages for 'prism'.

Page 10/12 | < Previous Page | 6 7 8 9 10 11 12  | Next Page >

  • Is it considered bad practice to have ViewModel objects hold the Dispatcher?

    - by stiank81
    My WPF application is structured using the MVVM pattern. The ViewModels will communicate asynchronously with a server, and when the requested data is returned a callback in the ViewModel is triggered, and it will do something with this data. This will run on a thread which is not the UI Thread. Sometimes these callbacks involve work that needs to be done on the UI thread, so I need the Dispatcher. This might be things such as: Adding data to an ObservableCollection Trigger Prism commands that will set something to be displayed in the GUI Creating WPF objects of some kind. I try to avoid the latter, but the two first points here I find to be reasonable things for ViewModels to do. So; is it okay to have ViewModels hold the Dispatcher to be able to Invoke commands for the UI thread? Or is this considered bad practice? And why?

    Read the article

  • Python performance profiling (file close)

    - by user1853986
    First of all thanks for your attention. My question is how to reduce the execution time of my code. Here is the relevant code. The below code is called in iteration from the main. def call_prism(prism_input_file,random_length): prism_output_file = "path.txt" cmd = "prism %s -simpath %d %s" % (prism_input_file,random_length,prism_output_file) p = os.popen(cmd) p.close() return prism_output_file def main(prism_input_file, number_of_strings): ... for n in range(number_of_strings): prism_output_file = call_prism(prism_input_file,z[n]) ... return I used statistics from the "profile statistics browser" when I profiled my code. The "file close" system command took the maximum time (14.546 seconds). The call_prism routine is called 10 times. But the number_of_strings is usually in thousands, so, my program takes lot of time to complete. Let me know if you need more information. By the way I tried with subprocess, too. Thanks.

    Read the article

  • Silverlight Cream for April 20, 2010 -- #842

    - by Dave Campbell
    In this Issue: Zoltan Arvai, Svetla Stoycheva, Alexey Zakharov, Chris Rouw, David Anson(-2-), Bill Reiss, John Papa and Adam Kinney, Chris Klug, CorrinaB, and Mike Snow. Shoutouts: Pete Brown interviewed David Kelley at MIX10: Pete at MIX10: David Kelley on the Prototype WPF and Silverlight Retail Experience Pete Brown also interviewed Emil Stoychev at MIX10: Pete at MIX10: Emil Stoychev on the CompletIT Silverlight Site SilverlightShow has a MIX10 Review by SilverlightShow Live Reporter Cigdem Patlak SilverlightShow also has an Interview with SilverlightShow Article Author Andrej Tozon From SilverlightCream.com: Implementing Push Notifications in Windows Phone 7 Zoltan Arvai has a post up on SilverlightShow discussing Push Notification on WP7 ... what it is, and how to use it. Completit.com - the challenges behind building a corporate website in Silverlight Svetla Stoycheva shows off the new CompleteIT corporate website which is pretty darn cool... and disucusses some of the challenges and solutions Introducing to Halcyone - Silverlight Application Framework: Silverlight Rest Extensions Alexey Zakharov has a tutorial up on a Silverlight application framework he's working on called Halcyone which is available on CodePlex Using the Tag Property during Silverlight Binding Chris Rouw details his SL3 to SL4 conversion and some issues he had, and how he was able to resolve a binding problem using the tag property. Using ContextMenu to implement SplitButton and MenuButton for Silverlight (or WPF) David Anson has a cool discussion up of using the ContextMenu code he put up previously to build a Split button, and includes all the code as usual. Silverlight/WPF Data Visualization Development Release 4 and Windows Phone 7 Charting sample! David Anson updated his Data Visualization because of the new releases, and this time he's including WP7... charting in WP7... ! Space Rocks game step 10: More fun with rocks In episode 10, Bill Reiss shows how to deal with multiple asteroids and all the interaction. Silverlight Training Course (Silverlight 4) Get your serious Silverlight 4 Mojo on with a new SL4 Training kit on Channel 9 ... buncha folks, spearheaded (it looks like) by John Papa and Adam Kinney... Plug-ins and composite applications in Silverlight – pt 3 Chris Klug is back with part 3 of his series on extensions and plug-in loading. So far he's covered a roll-your-own concept and MEF, now he digs into Prism. Transitions, Animations, and Effects with Blend - Part One How cool to have CorrinaB speak at your User Group meeting! ... She did just that in Portland, and instead of simply dropping a deck and some code in her blog, she's giving the run-down on her presentation... always good stuff, Corrina! Tip of the Day #110 – Using Static Resources in Class Libraries Mike Snow's latest tip is about how to create and use a Resource Dictionary. Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone MIX10

    Read the article

  • Silverlight Cream for April 05, 2010 -- #831

    - by Dave Campbell
    In this Issue: Rénald Nollet, Davide Zordan(-2-, -3-), Scott Barnes, Kirupa, Christian Schormann, Tim Heuer, Yavor Georgiev, and Bea Stollnitz. Shoutouts: Yavor Georgiev posted the material for his MIX 2010 talk: what’s new in WCF in Silverlight 4 Erik Mork and crew posted their This Week in Silverlight 4.1.2010 Tim Huckaby and MSDN Bytes interviewed Erik Mork: Silverlight Consulting Life – MSDN Bytes Interview From SilverlightCream.com: Home Loan Application for Windows Phone Rénald Nollet has a WP7 app up, with source, for calculating Home Loan application information. He also discusses some control issues he had with the emulator. Experiments with Multi-touch: A Windows Phone Manipulation sample Davide Zordan has updated the multi-touch project on CodePlex, and added a WP7 sample using multi-touch. Silverlight 4, MEF and MVVM: EventAggregator, ImportingConstructor and Unit Tests Davide Zordan has a second post up on MEF, MVVM, and Prism, oh yeah, and also Unit Testing... the code is available, so take a look at what he's all done with this. Silverlight 4, MEF and MVVM: MEFModules, Dynamic XAP Loading and Navigation Applications Davide Zordan then builds on the previous post and partitions the app into several XAPs put together at runtime with MEF. Silverlight Installation/Preloader Experience - BarnesStyle Scott Barnes talks about the install experience he wanted to get put into place... definitely a good read and lots of information. Changing States using GoToStateAction Kirupa has a quick run-through of Visual States, and then demonstrates using GoToStateAction and a note for a Blend 4 addition. Blend 4: About Path Layout, Part IV Christian Schormann has the next tutorial up in his series on Path Layout, and he's explaining Motion Path and Text on a Path. Managing service references and endpoint configurations for Silverlight applications Helping solve a common and much reported problem of managing service references, Tim Heuer details his method of resolving it and additional tips and tricks to boot. Some known WCF issues in Silverlight 4 Yavor Georgiev, a Program Manager for WCF blogged about the issues that they were not able to fix due to scheduling of the release How can I update LabeledPieChart to use the latest toolkit? Bea Stollnitz revisits some of her charting posts to take advantage of the unsealing of toolkit classes in labeling the Chart and PieSeries Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone MIX10

    Read the article

  • Need suggestion for Mutiple Windows application design

    - by King Chan
    This was previously posted in StackOverflow, I just moved to here... I am using VS2008, MVVM, WPF, Prism to make a mutiple window CRM Application. I am using MidWinow in my MainWindow, I want Any ViewModel would able to make request to MainWindow to create/add/close MidChildWindow, ChildWindow(from WPF Toolkit), Window (the Window type). ViewModel can get the DialogResult from the ChildWindow its excutes. MainWindow have control on all opened window types. Here is my current approach: I made Dictionary of each of the windows type and stores them into MainWindow class. For 1, i.e in a CustomerInformationView, its CustomerInformationViewModel can execute EditCommand and use EventAggregator to tell MainWindow to open a new ChildWindow. CustomerInformationViewModel: CustomerEditView ceView = new CustomerEditView (); CustomerEditViewModel ceViewModel = CustomerEditViewModel (); ceView.DataContext = ceViewModel; ChildWindow cWindow = new ChildWindow(); cWindow.Content = ceView; MainWindow.EvntAggregator.GetEvent<NewWindowEvent>().Publish(new WindowEventArgs(ceViewModel.ViewModeGUID, cWindow )); cWindow.Show(); Notice that all my ViewModel will generates a Guid for help identifies the ChildWindow from MainWindow's dictionary. Since I will only be using 1 View 1 ViewModel for every Window. For 2. In CustomerInformationViewModel I can get DialogResult by OnClosing event from ChildWindow, in CustomerEditViewModel can use Guid to tell MainWindow to close the ChildWindow. Here is little question and problems: Is it good idea to use Guid here? Or should I use HashKey from ChildWindow? My MainWindows contains windows reference collections. So whenever window close, it will get notifies to remove from the collection by OnClosing event. But all the Windows itself doesn't know about its associated Guid, so when I remove it, I have to search for every KeyValuePair to compares... I still kind of feel wrong associate ViewModel's Guid for ChildWindow, it would make more sense if ChildWindow has it own ID then ViewModel associate with it... But most important, is there any better approach on this design? How can I improve this better?

    Read the article

  • Silverlight Cream for March 24, 2010 -- #819

    - by Dave Campbell
    In this Issue: Nokola, Tim Heuer, Christian Schormann, Brad Abrams, David Kelley, Phil Middlemiss, Michael Klucher, Brandon Watson, Kunal Chowdhury, Jacek Ciereszko, and Unni. Shoutouts: Michael Klucher has a short post up For Love of the Game (Development)…, where he's looking for some input from the developer community. Shawn Hargreaves has a link post up of all the Windows Phone MIX10 presentations Chris Cavanagh has a Soft-Body Physics for Windows Phone 7 post up that goes along with one he did 1-1/2 years ago! Jeff Weber posted An Open Letter To Microsoft Regarding The Silverlight Game Development Community Pete Brown posted his MIX10 Recap ... lots of information, and discussion of what he was up to ... I liked the Trivia app Pete... glad to hear that was yours :) I've changed my mind and added a WP7 tag to SilverlightCream. I'll straighten out all the Mobile plus Silverlight links to point at the WP7 tab hopefully tonight. From SilverlightCream.com: EasyPainter Source Pack 3: Adorners, Mouse Cursors and Frames Nokola has been busy with EasyPainter adding in Custom, Extensible Mouse Cursors and Customizable Adorners with extensible adorner frames, and best of all... all with source code! Simulate Geo Location in Silverlight Windows Phone 7 emulator Among the things we don't have in our WP7 emulators is Geo Location... Tim Heuer comes to the rescue with a simulator for it... too cool, Tim! Blend 4: About Path Layout, Part II Christian Schormann is back with Part 2 of his tutorial sequence on the new Path Layout. Really good info and definitely cool presentations of the control. Silverlight 4 + RIA Services - Ready for Business: Exposing OData Services Brad Abrams continues his series with a post on exposing OData services. This looks like a great tutorial on the topic... will probably resolve some questions I've been having :) No Silverlight and Preloader Experience(ish) - in 10 seconds... David Kelley exposes the code he uses on his site, designed to be friendly to Silverlight and non-Silverlight users alike. Merged Dictionaries of Style Resources and Blend Phil Middlemiss has a nice article up on Merged Dictionaries and using multiple resource dictionaries that the app chooses, but also be compatible with Prism and Blend while not eating your system resources out of house and home. XNA Game Studio and Windows Phone Emulator Compatibility Michael Klucher has a definitive post up about getting your XNA and system up-to-speed for WP7... a must-read if you've been running any of the other XNA drops. Windows Phone 7 301 Redirect Bug Brandon Watson reports a 301 Redirect bug on WP7 ... see the code and how he got it, then follow along as he explains all the debug paths he took and what the resolution (?) really is :) Silverlight 4: How to use the new Printing API? Kunal Chowdhury has a tutorial up on printing with Silverlight 4 RC... from the project layout to printing and then printing a smaller section... all good Printing problem in Silverlight 4.0 RC - loading images in code behind Jacek Ciereszko also is writing about printing, and in his case he had problems with loading an image dynamically and printing it... plus he provides a solution to the 'blank page' problem. ToolboxExampleAttribute - a new extension point in Blend 4 (and a few other extensibility related changes) Unni has an article up about Expression Blend 4's new ToolboxExampleAttribute which allow you to have multiple examples of the same type resulting in different XAML produced. Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone    MIX10

    Read the article

  • Silverlight Cream for June 08, 2010 -- #877

    - by Dave Campbell
    In this Issue: Miroslav Miroslavov, Chris Klug, Beau, Christian Schormann(-2-), Dan Wahlin, Pete Brown, Michael S. Scherotter, Philipp Sumi, Andy Wigley, and Phil Middlemiss. Shoutouts: Mark Tucker set about learning Caliburn, and in the process is writing a Caliburn Book: Chapters 1-3 Jesse Liberty has a great link-laden post up about why we should all be learning/using Blend: Why Developers Should, Must, Do Care About The New Expression Blend be sure to read what he says about WP7 development, however! Charlie Kindel announced an Install problem with the Developer Tools CTP Refresh and the WP7 tools... check this out if you're having problems. John Papa has a good post up on the happenings yesterday: Expression Studio 4 Launch of Blend, SketchFlow, Encoder and More! Erik Mork & Company's latest "This Week in Silverlight" is titled First Drop: Prism v4 – First Drop is Available From SilverlightCream.com: Animated navigation between Pages Miroslav Miroslavov has Part 8 of his "Silverlight in Action" series up, detailing cool things from the CompleteIT site... this one is on Animated navigation between pages. Subtitling videos Chris Klug got a gig adding subtitles to videos for Microsoft (sweet) ... and no, not *that* kind of subtitles... read how he approached the final solution. Silverlight Watermark TextBox I'm not sure we can have too many Watermark TextBoxes, and neither does Beau , who sent me a link to this one... give it a dance and decide. Blend 4: Collaborative SketchFlow Feedback with SharePoint With the new Blend release, Christian Schormann has a post up describing the lashup to Sharepoint for sharing Sketchflow and getting feedback. New Utility, Links, and Tutorials for Path-Based Layout Christian Schormann also has a collection of resources for Path-Based Layouts, including a utility "that lets you apply a whole bunch of position-specific effects without having to write any code"... lots of links to resources here. Tales from the Trenches – Building a Real-World Silverlight Line of Business Application Dan Wahlin draws on his recent experience and lays out some of the fun and pitfalls of building LOB apps in Silverlight... WCF, MVVM, slides, and code included WPF (and Silverlight): Choose your Fonts and Text Rendering Options Wisely Pete Brown has a great post up on using fonts wisely across multiple platforms... lots of info and good discussion in the comments as well. Ball Watch USA Remember the awesome watch Michael S. Scherotter did in Silverlight 1 and then converted to Updated Ball Trainmaster Cannonball Watch to Silverlight 2? Well... there's now a contest underfoot and 8 videos to help you get started... all good stuff, and good luck! ... Michael has a post up about the contest: Enter to Win a Ball Watch by Creating One in Silverlight Announcing Sketchables – Rapid Mockup Creation with SketchFlow By way of Jesse Libertyhttp://jesseliberty.com/2010/06/08/why-developers-should-must-do-care-about-the-new-expression-blend/, this is a cool production by Philipp Sumi about a simple mockup framework he's created. Perst - a database for Windows Phone 7 Silverlight I think one of my first comments to Michael Washington back at the MVP Summit 2010 was that we'd need a database engine, and too cool, but we've got one, Andy Wigley discusses Perst in this post... to save you some time, here's the Perst site A Chrome and Glass Theme - Part 7 Phil Middlemiss has part 7 of his great theme-building series up... this time he's giving the accordian control a once-over. Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone MIX10

    Read the article

  • Silverlight Cream for March 30, 2010 -- #825

    - by Dave Campbell
    In this Issue: Jeremy Likness, Tim Greenfield, Tim Heuer, ondrejsv, XAML Ninja, Nikhil Kothari, Sergey Barskiy, Shawn Oster, smartyP, Christian Schormann(-2-), and John Papa And Glenn Block. Shoutouts: Victor Gaudioso produced a RefCard for DZone: Getting Started with Silverlight and Expression Blend Way to go Victor... it looks great! Gavin Wignall announced Metia launch FourSquare and Bing maps mash up – called Near.me Cheryl Simmons talks about VS2010 and the design surface: Changing Templates with the Silverlight Designer (and seeing the changes immediately) Michael S. Scherotter posted that New York Times Silverlight Kit Updated for Windows Phone 7 Series Jaime Rodriguez posted about 2 free chapters in his new book (with Yochay Kiriaty): A Journey Into Silverlight On Windows Phone -Via Learning WIndows PHone Programming Did you know there was "MSDN Radio"?? Tim Heuer posted follow-up answers to this morning's show: MSDN Radio follow-up answers: Prism for Silverlight, DomainServices and relationships Michael Klucher posted a great set of links for WP7 game development this morning: Great Game Development Tutorials for Windows Phone Zhiming Xue has 3 pages of synopsis and links for everything Windows Phone at MIX. This is the 1st, but at the top of the pages are links to the other two: Windows Phone 7 Content From MIX10 – Part I From SilverlightCream.com: Using WriteableBitmap to Simplify Animations with Clones Jeremy Likness takes a break from his LOB posts to demonstrate a page flip animation using WriteableBitmap to simplify the animation using clones. SAX-like Xml parsing Want some experience or fun with Rx? Tim Greenfield has a post up on building an observable XmlReader. nstalling Silverlight applications without the browser involved Last night I blogged Mike Taulty's take on the "Silent Install" for an OOB app, tonight, I'm posting Tim Heuer's insight on the topic. How to: Create computed/custom properties for sample data in Blend/Sketchflow ondrejsv posted an example of digging into the files that control the sample data for Blend to get what you really want. PathListBox Adventures – radial layout Check out the radial layout XAML Ninja did using the PathListBox ... and all code available. RIA Services and Validation Nikhil Kothari has a great (duh!) post up that follows his Silverlight TV on the same subject: RIA Services and validation... lots of good external links also. Windows Phone 7 Application with OData Sergey Barskiy did an OData to WP7 app by using the feed from MIX10. You can see a list of sessions, and click on one to see details. Getting Blur And DropShadow to work in the Windows Phone Emulator Shawn Oster responds to some forum questions about Blur and DropShadow effects not showing up in the WP7 emulator, and gives the code trick we have to do for now. Metro Icons for Windows Phone 7 We all got the other icon set for WP7 from MSDN, but smartyP pulled the Metro Icons from the PPT deck of the MIX10 presentations... good job! Fonts in SketchFlow Christian Schormann talks about fonts in Sketchflow, where they live on your machine, and how you can use them. Blend 4: About Path Layout, Part III Christian Schormann also has Part III of his epic tutorial up on Path Layout and Blend. This one is on dynamic resizing layouts, and he has links back to the other two if you missed them... or you can find them with a search at SilverlightCream... :) Simple ViewModel Locator for MVVM: The Patients Have Left the Asylum John Papa And Glenn Block teamed up to solve the View First model only without the maintenance involved with the ViewModel locator by using MEF. It only took these guys and hour... sigh... :) Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone MIX10

    Read the article

  • Adventures in MVVM &ndash; ViewModel Location and Creation

    - by Brian Genisio's House Of Bilz
    More Adventures in MVVM In this post, I am going to explore how I prefer to attach ViewModels to my Views.  I have published the code to my ViewModelSupport project on CodePlex in case you'd like to see how it works along with some examples.  Some History My approach to View-First ViewModel creation has evolved over time.  I have constructed ViewModels in code-behind.  I have instantiated ViewModels in the resources sectoin of the view. I have used Prism to resolve ViewModels via Dependency Injection. I have created attached properties that use Dependency Injection containers underneath.  Of all these approaches, I continue to find issues either in composability, blendability or maintainability.  Laurent Bugnion came up with a pretty good approach in MVVM Light Toolkit with his ViewModelLocator, but as John Papa points out, it has maintenance issues.  John paired up with Glen Block to make the ViewModelLocator more generic by using MEF to compose ViewModels.  It is a great approach, but I don’t like baking in specific resolution technologies into the ViewModelSupport project. I bring these people up, not to name drop, but to give them credit for the place I finally landed in my journey to resolve ViewModels.  I have come up with my own version of the ViewModelLocator that is both generic and container agnostic.  The solution is blendable, configurable and simple to use.  Use any resolution mechanism you want: MEF, Unity, Ninject, Activator.Create, Lookup Tables, new, whatever. How to use the locator 1. Create a class to contain your resolution configuration: public class YourViewModelResolver: IViewModelResolver { private YourFavoriteContainer container = new YourFavoriteContainer(); public YourViewModelResolver() { // Configure your container } public object Resolve(string viewModelName) { return container.Resolve(viewModelName); } } Examples of doing this are on CodePlex for MEF, Unity and Activator.CreateInstance. 2. Create your ViewModelLocator with your custom resolver in App.xaml: <VMS:ViewModelLocator x:Key="ViewModelLocator"> <VMS:ViewModelLocator.Resolver> <local:YourViewModelResolver /> </VMS:ViewModelLocator.Resolver> </VMS:ViewModelLocator> 3. Hook up your data context whenever you want a ViewModel (WPF): <Border DataContext="{Binding YourViewModelName, Source={StaticResource ViewModelLocator}}"> This example uses dynamic properties on the ViewModelLocator and passes the name to your resolver to figure out how to compose it. 4. What about Silverlight? Good question.  You can't bind to dynamic properties in Silverlight 4 (crossing my fingers for Silverlight 5), but you CAN use string indexing: <Border DataContext="{Binding [YourViewModelName], Source={StaticResource ViewModelLocator}}"> But, as John Papa points out in his article, there is a silly bug in Silverlight 4 (as of this writing) that will call into the indexer 6 times when it binds.  While this is little more than a nuisance when getting most properties, it can be much more of an issue when you are resolving ViewModels six times.  If this gets in your way, the solution (as pointed out by John), is to use an IndexConverter (instantiated in App.xaml and also included in the project): <Border DataContext="{Binding Source={StaticResource ViewModelLocator}, Converter={StaticResource IndexConverter}, ConverterParameter=YourViewModelName}"> It is a bit uglier than the WPF version (this method will also work in WPF if you prefer), but it is still not all that bad.  Conclusion This approach works really well (I suppose I am a bit biased).  It allows for composability from any mechanisim you choose.  It is blendable (consider serving up different objects in Design Mode if you wish... or different constructors… whatever makes sense to you).  It works in Cider.  It is configurable.  It is flexible.  It is the best way I have found to manage View-First ViewModel hookups.  Thanks to the guys mentioned in this article for getting me to something I love using.  Enjoy.

    Read the article

  • Silverlight Cream for January 13, 2011 -- #1026

    - by Dave Campbell
    In this Issue: András Velvárt, Tony Champion, Joost van Schaik, Jesse Liberty, Shawn Wildermuth, John Papa, Michael Crump, Sacha Barber, Alex Knight, Peter Kuhn, Senthil Kumar, Mike Hole, and WindowsPhoneGeek. Above the Fold: Silverlight: "Create Custom Speech Bubbles in Silverlight." Michael Crump WP7: "Architecting WP7 - Part 9 of 10: Threading" Shawn Wildermuth Expression Blend: "PathListBox: Text on the path" Alex Knight From SilverlightCream.com: Behaviors for accessing the Windows Phone 7 MarketPlace and getting feedback András Velvárt shares almost insider information about how to get some user interaction with your WP7 app in the form of feedback ... he has 4 behaviors taken straight from his very cool SufCube app that he's sharing. Reloading a Collection in the PivotViewer Tony Champion keeps working with the PivotViewer ... this time discussing the fact that you can't Reload or Refresh the current collection from the server ... at least not initially, but he did find one :) Tombstoning MVVMLight ViewModels with SilverlightSerializer on Windows Phone 7 Joost van Schaik takes a shot at helping us all with Tombstoning a WP7 app... he's using Mike Talbot's SilverlightSerializer and created extension methods for it for tombstoning that he's willing to share with us. Windows Phone From Scratch #17: MVVM Light Toolkit Soup To Nuts Part 2 Jesse Liberty is up to Part 17 in his WP7 series, and this is the 2nd post on MVVMLight and WP7, and is digging into behaviors. Architecting WP7 - Part 9 of 10: Threading Shawn Wildermuth is up to part 9 of 10 in his series on Architecting WP7 apps. This episode finds Shawn discussing Threading ... know how to use and choose between BackgroundWorker and ThreadPool? ... Shawn will explain. Silverlight TV 57: Performance Tuning Your Apps In the latest Silverlight TV, John Papa chats with Mike Cook about tuning your Silverlight app to get the performance up there where your users will be happy. Create Custom Speech Bubbles in Silverlight. Michael Crump's already gotten a lot of airplay out of this, but it's so cool.. comic-style callout shapes without using the dlls that you normally would... in other words, paths, and very cool hand-drawn looks on some too... very cool, Michael! Showcasing Cinch MVVM framework / PRISM 4 interoperability Sacha Barber has a post up on CodeProject that demonstratest using Cinch and Prism4 together... handily using MEF since Cinch relies on MEFedMVVM... this is a heck of a post... lots of code, lots of explanations. PathListBox: Text on the path Alex Knight keeps making this PathListBox series better ... this time he is putting text on the path... moving text... too cool, Alex! Windows Phone 7: Pinch Gesture Sample Peter Kuhn digs into the WP7 toolkit and examines GestureListener, pinch events, and clipping... examples and code supplied. How to change the StartPage of the Windows Phone 7 Application in Visual Studio 2010 ? Senthil Kumar discusses how to change the StartPage of your WP7 app, or get the program running if you happen to move or rename MainPage.xaml WP7 Text Boxes – OnEnter (my 1st Behaviour) Mike Hole has a post up about the issue with the keyboard appearing in front of the textbox, and maybe using the enter key to drop it... and he's developed a behavior for that process. WP7 ContextMenu in depth | Part1: key concepts and API WindowsPhoneGeek has some good articles that I haven't posted, but I'll catch up. This one is a nice tutorial on the WP7 Context menu... good explanation, diagrams, and code. Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone MIX10

    Read the article

  • Silverlight Cream for January 08, 2011 -- #1023

    - by Dave Campbell
    In this Heavy and yet incomplete Issue: Mike Wolf, Walter Ferrari, Colin Eberhardt, Mathew Charles, Don Burnett, Senthil Kumar, cherylws, Rob Miles, Derik Whittaker, Thomas Martinsen(-2-), Jason Ginchereau, Vishal Nayan, and WindowsPhoneGeek. Above the Fold: Silverlight: "Automatically Showing ToolTips on a Trimmed TextBlock (Silverlight)" Colin Eberhardt WP7: "Windows Phone Blue Book Pdf" Rob Miles Sharepoint/Silverlight: "Discover Sharepoint with Silverlight - Part 1" Walter Ferrari Shoutouts: Dave Isbitski has announced a WP7 Firestarter, check for your local MS office: Announcing the “Light up your Silverlight Applications for Windows 7 Firestarter” From SilverlightCream.com: Leveraging Silverlight in the USA TODAY Windows 7-Based Slate App Mike Wolf has a post up about Cynergy's release of the new USA TODAY software for Windows 7 Slate devices, and gives a great rundown of all the resources, and how specific Silverlight features were used... tons of outstanding external links here! Discover Sharepoint with Silverlight - Part 1 Walter Ferrari has tutorial up at SilverlightShow... looks like the first in a series on Silverlight and Sharepoint... lots of low-level info about the internals and using them. Automatically Showing ToolTips on a Trimmed TextBlock (Silverlight) Colin Eberhardt has a really cool AutoTooltip attached behavior that gives a tooltip of the actual text if text is trimmed ... and has an active demo on the post... very cool. RIA Services Output Caching Mathew Charles digs into a RIA feature that hasn't gotten any blog love: output caching, describing all the ins and outs of improving the performance of your app using caching. Emailing your Files to Box.net Cloud Storage with WP7 Don Burnett details out everything you need to do to get Box.Net and your WP7 setup to talk to each other. Shortcuts keys for Developing on Windows Phone 7 Emulator Senthil Kumar has some good WP7 posts up ... this one is a cheatsheet list of Function-key assignements for the WP7 emulator... another sidebar listint Windows Phone 7 Design Guidelines – Cheat Sheet cherylws has a great Guideline list/Cheat Sheet up for reference while building a WP7 app... this is a great reference... I'm adding it to the Right-hand sidebar of WynApse.com Windows Phone Blue Book Pdf Rob Miles has added another book and color to his collection of both -- Windows Phone Programming in C#, also known as the Windows Phone Blue Book... get a copy from the links he gives, and check out his other free books as well. Navigating to an external URL using the HyperlinkButton Derik Whittaker has a post up discussing the woes (and error messages) of trying to navigate to an external URL with the Hyperlink button in WP7, plus his MVVM-friendly solution that you can download. Set Source on Image from code in Silverlight Thomas Martinsen has a couple posts up... first is this quick one on the code required to set an image source. Show UI element based on authentication Thomas Martinsen's latest is one on a BoolToVisibilityConverter allowing a boolean indicator of Authentication to be used to control the visibility of a button (in the sample) WP7 ReorderListBox improvements: rearrange animations and more Jason Ginchereau has updated his ReorderListBox from last week to add some animations (fading/sliding) during the rearrangement. Navigation in Silverlight Without Using Navigation Framework Vishal Nayan has a post that attracted my attention... Navigation by manipulating RootVisual content... I've been knee-deep in similar code in Prism this week (and why my blogging is off) ... Creating a WP7 Custom Control in 7 Steps WindowsPhoneGeek creates a simple custom control for WP7 before your very eyes in his latest post, focusing on the minimum requirements necessary for writing a Custom Control. Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone MIX10

    Read the article

  • Implementing the double-click event on Silverlight 4 Datagrid

    - by Mohammed Mudassir Azeemi
    Any good soul have an example of implementing the "Command Pattern" introduced by Prism on "Double-click event" of Silverlight 4.0 DataGrid. I did try the following: <data:DataGrid x:Name="dgUserRoles" AutoGenerateColumns="False" Margin="0" Grid.Row="0" ItemsSource="{Binding Path=SelectedUser.UserRoles}" IsReadOnly="False" > <data:DataGrid.Columns> <data:DataGridTemplateColumn Header=" "> <data:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button Width="20" Height="20" Click="Button_Click" Command="{Binding EditRoleClickedCommand}" CommandParameter="{Binding SelectedRole}" > </Button> </DataTemplate> </data:DataGridTemplateColumn.CellTemplate> </data:DataGridTemplateColumn> <data:DataGridTextColumn Header="Role Name" Binding="{Binding RoleName}" /> <data:DataGridTextColumn Header="Role Code" Binding="{Binding UserroleCode}" IsReadOnly="True"/> <data:DataGridCheckBoxColumn Header="UDFM Managed" Binding="{Binding RoleIsManaged}" IsReadOnly="True" /> <data:DataGridCheckBoxColumn Header="UDFM Role Assigned" Binding="{Binding UserroleIsUdfmRoleAssignment}" IsReadOnly="True" /> <data:DataGridTextColumn Header="Source User" Binding="{Binding SourceUser}" IsReadOnly="True" /> </data:DataGrid.Columns> </data:DataGrid> As you see I did try to hook up the Command there and it is not firing the event in my View Model. Looking for a good alternative.

    Read the article

  • Defining reliable SIlverlight 4 architecture

    - by doteneter
    Hello everybody, It's my first question on SO. I know that there were many topics on Silverlight and architecture but didn't find answers that satisfies me. I'm ASP.NET MVC developer and are used to work on architectures built with the best practices (loose coupling with DI, etc.) Now I'm faced to the new Silverlight 4 project and would like to be sure I'm doing the best choices as I'm not experienced. Main features required by the applications are as follows : use existing SQL Server Database but with possibility to move to the cloud. using EF4 for the data acess with SQL Server. exitensibility : adding new modules without changing the main host. loose coupling. I was looking at different webcasts (Taulty, etc.), blogs about Silverlight and came up with the following architecture. EF 4 for data access (as specified with the requirements) WCF RIA Services for mid-tiers controling access to data for queries and enabling end-to-end support for data validation, authentication and roles. MEF Support for enabling modules. Unity 2.0 for DI. The problem is that I don't know how to define a reliable architecture where all these elements play well together. Should I use a framework instead like Prism or Caliburn? But for now I'm not sure what scenarios they support. What's the best usages for Unity in Silverlight ? I used to use IoC in ASP.NET MVC for loos coupling and other things like interception for audit logging. It seems that for Silverlight Unity doesn't support Interception. I would like to use it to enable loose coupling and to enable to move to the cloud if needed. Thanks in advance for your help.

    Read the article

  • Threading best practice when using SFTP in C#

    - by Christian
    Ok, this is more one of these "conceptual questions", but I hope I got some pointers in the right direction. First the desired scenario: I want to query an SFTP server for directory and file lists I want to upload or download files simulaneously Both things are pretty easy using a SFTP class provided by Tamir.SharpSsh, but if I only use one thread, it is kind of slow. Especially the recursion into subdirs gets very "UI blocking", because we are talking about 10.000 of directories. My basic approach is simple, create some kind of "pool" where I keep 10 open SFTP connections. Then query the first worker for a list of dirs. If this list was obtained, send the next free workers (e.g. 1-10, first one is also free again) to get the subdirectory details. As soon as there is a worker free, send him for the subsubdirs. And so on... I know the ThreadPool, simple Threads and did some Tests. What confuses me a little bit is the following: I basically need... A list of threads I create, say 10 Connect all threads to the server If a connection drops, create a new thread / sftp client If there is work to do, take the first free thread and handle the work I am currently not sure about the implementation details, especially the "work to do" and the "maintain list of threads" parts. Is it a good idea to: Enclose the work in an object, containing a job description (path) and a callback Send the threads into an infinite loop with 100ms wait to wait for work If SFTP is dead, either revive it, or kill the whole thread and create a new one How to encapsulate this, do I write my own "10ThreadsManager" or are there some out Ok, so far... Btw, I could also use PRISM events and commands, but I think the problem is unrelated. Perhaps the EventModel to signal a done processing of a "work package"... Thanks for any ideas, critic.. Chris

    Read the article

  • ViewModel updates after Model server roundtrip

    - by Pavel Savara
    I have stateless services and anemic domain objects on server side. Model between server and client is POCO DTO. The client should become MVVM. The model could be graph of about 100 instances of 20 different classes. The client editor contains diverse tab-pages all of them live-connected to model/viewmodel. My problem is how to propagate changes after server round-trip nice way. It's quite easy to propagate changes from ViewModel to DTO. For way back it would be possible to throw away old DTO and replace it whole with new one, but it will cause lot of redrawing for lists/DataTemplates. I could gather the server side changes and transmit them to client side. But the names of fields changed would be domain/DTO specific, not ViewModel specific. And the mapping seems nontrivial to me. If I should do it imperative way after round-trip, it would break SOC/modularity of viewModels. I'm thinking about some kind of mapping rule engine, something like automappper or emit mapper. But it solves just very plain use-cases. I don't see how it would map/propagate/convert adding items to list or removal. How to identify instances in collections so it could merge values to existing instances. As well it should propagate validation/error info. Maybe I should implement INotifyPropertyChanged on DTO and try to replay server side events on it ? And then bind ViewModel to it ? Would binding solve the problems with collection merges nice way ? Is EventAgregator from PRISM useful for that ? Is there any event record-replay component ? Is there better client side pattern for architecture with server side logic ?

    Read the article

  • Should i use a trigger or Behaviors for this?

    - by Michael
    I have an abstract object called Applicant and two different types of objects that inherit from Applicant called Business and Individual. So I have three classes that look like this: public abstract class Applicant { ... } public class Individual : Applicant { ... } public class Business : Applicant { ... } Now in the DataGrid I want to show all the details of Applicant object. When you choose a row I want to show details of either the business or individual as a internal grid. Something like this <DataGrid> <DataGrid.Columns> <!--Show different columns --> </DataGrid.Columns> <DataGrid.RowDetailsTemplate> <!--Show if Individual --> <DataGrid> <DataGrid.Columns> <DataGridTextColumn Header="First Name" ... /> <DataGridTextColumn Header="Last Name" ... /> </DataGrid.Columns> </DataGrid> <!--Show if business --> <DataGrid> <DataGrid.Columns> <DataGridTextColumn Header="Business Name" ... /> <DataGridTextColumn Header="Tax id" ... /> </DataGrid.Columns> </DataGrid> </DataGrid.RowDetailsTemplate> </DataGrid> Now I'm not sure if I need to use a Triggers or Behaviors to accomplish this? Thanks for everyones help! FYI I'm using Silverlight 4.0 with Prism.

    Read the article

  • MVVM pattern: ViewModel updates after Model server roundtrip

    - by Pavel Savara
    I have stateless services and anemic domain objects on server side. Model between server and client is POCO DTO. The client should become MVVM. The model could be graph of about 100 instances of 20 different classes. The client editor contains diverse tab-pages all of them live-connected to model/viewmodel. My problem is how to propagate changes after server round-trip nice way. It's quite easy to propagate changes from ViewModel to DTO. For way back it would be possible to throw away old DTO and replace it whole with new one, but it will cause lot of redrawing for lists/DataTemplates. I could gather the server side changes and transmit them to client side. But the names of fields changed would be domain/DTO specific, not ViewModel specific. And the mapping seems nontrivial to me. If I should do it imperative way after round-trip, it would break SOC/modularity of viewModels. I'm thinking about some kind of mapping rule engine, something like automappper or emit mapper. But it solves just very plain use-cases. I don't see how it would map/propagate/convert adding items to list or removal. How to identify instances in collections so it could merge values to existing instances. As well it should propagate validation/error info. Maybe I should implement INotifyPropertyChanged on DTO and try to replay server side events on it ? And then bind ViewModel to it ? Would binding solve the problems with collection merges nice way ? Is EventAgregator from PRISM useful for that ? Is there any event record-replay component ? Is there better client side pattern for architecture with server side logic ?

    Read the article

  • asp code for upload data

    - by vicky
    hello everyone i have this code for uploading an excel file and save the data into database.I m not able to write the code for database entry. someone please help <% if (Request("FileName") <> "") Then Dim objUpload, lngLoop Response.Write(server.MapPath(".")) If Request.TotalBytes > 0 Then Set objUpload = New vbsUpload For lngLoop = 0 to objUpload.Files.Count - 1 'If accessing this page annonymously, 'the internet guest account must have 'write permission to the path below. objUpload.Files.Item(lngLoop).Save "D:\PrismUpdated\prism_latest\Prism\uploadxl\" Response.Write "File Uploaded" Next Dim FSYSObj, folderObj, process_folder process_folder = server.MapPath(".") & "\uploadxl" set FSYSObj = server.CreateObject("Scripting.FileSystemObject") set folderObj = FSYSObj.GetFolder(process_folder) set filCollection = folderObj.Files Dim SQLStr SQLStr = "INSERT ALL INTO TABLENAME " for each file in filCollection file_name = file.name path = folderObj & "\" & file_name Set objExcel_chk = CreateObject("Excel.Application") Set ws1 = objExcel_chk.Workbooks.Open(path).Sheets(1) row_cnt = 1 'for row_cnt = 6 to 7 ' if ws1.Cells(row_cnt,col_cnt).Value <> "" then ' col = col_cnt ' end if 'next While (ws1.Cells(row_cnt, 1).Value <> "") for col_cnt = 1 to 10 SQLStr = SQLStr & "VALUES('" & ws1.Cells(row_cnt, 1).Value & "')" next row_cnt = row_cnt + 1 WEnd 'objExcel_chk.Quit objExcel_chk.Workbooks.Close() set ws1 = nothing objExcel_chk.Quit Response.Write(SQLStr) 'set filobj = FSYSObj.GetFile (sub_fol_path & "\" & file_name) 'filobj.Delete next End if End If plz tell me how to save the following excel data to the oracle databse.any help would be appreciated

    Read the article

  • WPF/MVVM - keep ViewModels in application component or separate?

    - by Anders Juul
    Hi all, I have a WPF application where I'm using the MVVM pattern. I get the VM activated for actions that require user input and thus need to activate views from the VM. I've started out separating the VMs into a separate component/assembly, partly because I see them as the unit testable part, partly because views should rely on VM, not the other way round. But when I then need to bring up a window, the window is not known by the VM. All introductions I find place the VM in the WPF/App component, thus eliminating the problem. This article recommends keeping them in separate layers : http://waf.codeplex.com/wikipage?title=Architecture%20-%20Get%20The%20Big%20Picture&referringTitle=Home As I see it, I have the following choices Move VMs to the WPF/App assembly to allow VMs to access the windows directly. Place interfaces of views in VM-assembly, implement views in WPF/App assembly and register the connection through IOC or alternative ways. File a 'request' from the VM into some mechanism/bus that routes the request (but which mechanism!? E.g something in Prism?!) What's the recommendation? Thanks for any comments, Anders, Denmark

    Read the article

  • Preview of code-only WPF controls in VS2010 - how?

    - by Christian
    Hi, I hope I am able to illustrate the problem using a lot of images. First of all, I was no real fan of XAML (Silverlight issues, crashes in Preview, and so on...) Now, with VS2010 the situation has become better. There are still a lot of things I like better in code, but I also want a preview in my VS. So, take a look at the following control: It is really simple, a todo details list. The first screenshot shows the code of the control, pretty straighforward: There is no XAML, so obviously no preview. Of course, I could encapsulate it in another control, like shown in the next screenshot: But, in that case I have an additional file I do not want or need. So I had the idea to move the init stuff inside the contructor of a XAML control. For simplicity, I used simple elements. But they do not show up in the preview... Finally, I know I could use the controls in other parts of my app when creating UIs. But I am using layout manager, PRISM and a lot of other stuff, so I just want an easy preview of some specific control I created (without having to have a XAML wrapper file for each control) Thanks for help, and sorry for the post structure, but I though with images it is better to understand... Chris

    Read the article

  • WPF Calling a custom command on a custom control (from a viewmodel?)

    - by user190615
    I want to take a snap of the visual tree of a custom wpf control when the user clicks a button in a toolbar. The control is bound to a viewmodel. I have a BitmapSource dp in the custom control holding the snapped image which is bound to a property on my VM. The BitmapSource dp on the control is updated via a custom command on the control. I've tied the toolbar button's command to call the controls command which updates the BitmapSource. Now the problem is the end result I want is when the user clicks the button, the control updates its image and then the vm offers to save this image. I cant wrap my mind around an mvvm way of doing this. One inelegant solution is that control fires an event after the image is updated which is routed to the viewmodel as a command(command behavior) but then if i want to do something else with the image on some other button click, all the commands bound to the events will fire. All thoughts appreciated. EDIT The command on the control is a RoutedCommand and the commands in my vm are Prism delegate commands.

    Read the article

  • Session Report - Java on the Raspberry Pi

    - by Janice J. Heiss
    On mid-day Wednesday, the always colorful Oracle Evangelist Simon Ritter demonstrated Java on the Raspberry Pi at his session, “Do You Like Coffee with Your Dessert?”. The Raspberry Pi consists of a credit card-sized single-board computer developed in the UK with the intention of stimulating the teaching of basic computer science in schools. “I don't think there is a single feature that makes the Raspberry Pi significant,” observed Ritter, “but a combination of things really makes it stand out. First, it's $35 for what is effectively a completely usable computer. You do have to add a power supply, SD card for storage and maybe a screen, keyboard and mouse, but this is still way cheaper than a typical PC. The choice of an ARM (Advanced RISC Machine and Acorn RISC Machine) processor is noteworthy, because it avoids problems like cooling (no heat sink or fan) and can use a USB power brick. When you add in the enormous community support, it offers a great platform for teaching everyone about computing.”Some 200 enthusiastic attendees were present at the session which had the feel of Simon Ritter sharing a fun toy with friends. The main point of the session was to show what Oracle was doing to support Java on the Raspberry Pi in a way that is entertaining and fun. Ritter pointed out that, in addition to being great for teaching, it’s an excellent introduction to the ARM architecture, and runs well with Java and will get better once it has official hard float support. The possibilities are vast.Ritter explained that the Raspberry Pi Project started in 2006 with the goal of devising a computer to inspire children; it drew inspiration from the BBC Micro literacy project of 1981 that produced a series of microcomputers created by the Acorn Computer company. It was officially launched on February 29, 2012, with a first production of 10,000 boards. There were 100,000 pre-orders in one day; currently about 4,000 boards are produced a day. Ritter described the specification as follows:* CPU: ARM 11 core running at 700MHz Broadcom SoC package Can now be overclocked to 1GHz (without breaking the warranty!) * Memory: 256Mb* I/O: HDMI and composite video 2 x USB ports (Model B only) Ethernet (Model B only) Header pins for GPIO, UART, SPI and I2C He took attendees through a brief history of ARM Architecture:* Acorn BBC Micro (6502 based) Not powerful enough for Acorn’s plans for a business computer * Berkeley RISC Project UNIX kernel only used 30% of instruction set of Motorola 68000 More registers, less instructions (Register windows) One chip architecture to come from this was… SPARC * Acorn RISC Machine (ARM) 32-bit data, 26-bit address space, 27 registers First machine was Acorn Archimedes * Spin off from Acorn, Advanced RISC MachinesNext he presented its features:* 32-bit RISC Architecture–  ARM accounts for 75% of embedded 32-bit CPUs today– 6.1 Billion chips sold last year (zero manufactured by ARM)* Abstract architecture and microprocessor core designs– Raspberry Pi is ARM11 using ARMv6 instruction set* Low power consumption– Good for mobile devices– Raspberry Pi can be powered from 700mA 5V only PSU– Raspberry Pi does not require heatsink or fanHe described the current ARM Technology:* ARMv6– ARM 11, ARM Cortex-M* ARMv7– ARM Cortex-A, ARM Cortex-M, ARM Cortex-R* ARMv8 (Announced)– Will support 64-bit data and addressingHe next gave the Java Specifics for ARM: Floating point operations* Despite being an ARMv6 processor it does include an FPU– FPU only became standard as of ARMv7* FPU (Hard Float, or HF) is much faster than a software library* Linux distros and Oracle JVM for ARM assume no HF on ARMv6– Need special build of both– Raspbian distro build now available– Oracle JVM is in the works, release date TBDNot So RISCPerformance Improvements* DSP Enhancements* Jazelle* Thumb / Thumb2 / ThumbEE* Floating Point (VFP)* NEON* Security Enhancements (TrustZone)He spent a few minutes going over the challenges of using Java on the Raspberry Pi and covered:* Sound* Vision * Serial (TTL UART)* USB* GPIOTo implement sound with Java he pointed out:* Sound drivers are now included in new distros* Java Sound API– Remember to add audio to user’s groups– Some bits work, others not so much* Playing (the right format) WAV file works* Using MIDI hangs trying to open a synthesizer* FreeTTS text-to-speech– Should work once sound works properlyHe turned to JavaFX on the Raspberry Pi:* Currently internal builds only– Will be released as technology preview soon* Work involves optimal implementation of Prism graphics engine– X11?* Once the JavaFX implementation is completed there will be little of concern to developers-- It’s just Java (WORA). He explained the basis of the Serial Port:* UART provides TTL level signals (3.3V)* RS-232 uses 12V signals* Use MAX3232 chip to convert* Use this for access to serial consoleHe summarized his key points. The Raspberry Pi is a very cool (and cheap) computer that is great for teaching, a great introduction to ARM that works very well with Java and will work better in the future. The opportunities are limitless. For further info, check out, Raspberry Pi User Guide by Eben Upton and Gareth Halfacree. From there, Ritter tried out several fun demos, some of which worked better than others, but all of which were greeted with considerable enthusiasm and support and good humor (even when he ran into some glitches).  All in all, this was a fun and lively session.

    Read the article

  • Silverlight 4 WCF RIA Services and MVVM is not as simple

    - by Thomas Jaskula
    [Disclaimer: I'm ASP.NET MVC Developer] Hi, I'm looking for some best practices with implementing MVVM pattern with WCF RIA in Silverlight 4. I'm not looking to use MEF of IoC for locating my ViewModels. What I would like to know is how to apply MVVM pattern with Silverlight 4 and WCF RIA. I don't want to use other stuff like Prism or MVVM Light toolkit. I found many examples on Internet showing how it is wonderful to drag and drop a datasource on the view and the job is done (it reminds me about my first VB6 developments). I tried to implement MVVM with WCF RIA and it's not strightforward at all. If I understand, the MVVM should contain all the logic in order to unit test it in isolation but when it comes to combine it with WCF RIA it's another story. I have the following questions. Can I use a generated metadata as model ? It would be easier to use it that if I write all from the scratch. As I saw the only way I could get data is through DomainContext or through direct binding in the view (local ressource). I don't want the direct binding in the view, not testable at all. On the other hand I can't use DomainContext, it doesn't expose any single entity !!! All I have is the EntitySet that I can bind to datagrid. How do I bind a single Entity to the DataForm from the ViewModel ? How do I udpate the model to the database ? How do I navigate from one Entity to a collection of it's itemps. For example if I have a Company Entity I would like to show a DataFrom to update a entite informations and a datagrid to show companies adresses. When saving a form would like to save information to Company and for example an information avout which adress was selected as active. Please help me understand how to do it well. Or maybe I should drop the WCF RIA and to do it with WCF from scratch ? What do you think ?

    Read the article

  • CheckBox Command Behaviors for Silverlight MVVM Pattern

    - by Blake Blackwell
    I am trying to detect when an item is checked, and which item is checked in a ListBox using Silverlight 4 and the Prism framework. I found this example on creating behaviors, and tried to follow it but nothing is happening in the debugger. I have three questions: Why isn't my command executing? How do I determine which item was checked (i.e. pass a command parameter)? How do I debug this? (i.e. where can I put break points to begin stepping into this) Here is my code: View: <ListBox x:Name="MyListBox" ItemsSource="{Binding PanelItems, Mode=TwoWay}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <CheckBox IsChecked="{Binding Enabled}" my:Checked.Command="{Binding Check}" /> <TextBlock x:Name="DisplayName" Text="{Binding DisplayName}"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> ViewModel: public MainPageViewModel() { _panelItems.Add( new PanelItem { Enabled = true, DisplayName = "Test1" } ); Check = new DelegateCommand<object>( itemChecked ); } public void itemChecked( object o ) { //do some stuff } public DelegateCommand<object> Check { get; set; } Behavior Class public class CheckedBehavior : CommandBehaviorBase<CheckBox> { public CheckedBehavior( CheckBox element ) : base( element ) { element.Checked +=new RoutedEventHandler(element_Checked); } void element_Checked( object sender, RoutedEventArgs e ) { base.ExecuteCommand(); } } Command Class public static class Checked { public static ICommand GetCommand( DependencyObject obj ) { return (ICommand) obj.GetValue( CommandProperty ); } public static void SetCommand( DependencyObject obj, ICommand value ) { obj.SetValue( CommandProperty, value ); } public static readonly DependencyProperty CommandProperty = DependencyProperty.RegisterAttached( "Command", typeof( CheckBox ), typeof( Checked ), new PropertyMetadata( OnSetCommandCallback ) ); public static readonly DependencyProperty CheckedCommandBehaviorProperty = DependencyProperty.RegisterAttached( "CheckedCommandBehavior", typeof( CheckedBehavior ), typeof( Checked ), null ); private static void OnSetCommandCallback( DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e ) { CheckBox element = dependencyObject as CheckBox; if( element != null ) { CheckedBehavior behavior = GetOrCreateBehavior( element ); behavior.Command = e.NewValue as ICommand; } } private static CheckedBehavior GetOrCreateBehavior( CheckBox element ) { CheckedBehavior behavior = element.GetValue( CheckedCommandBehaviorProperty ) as CheckedBehavior; if( behavior == null ) { behavior = new CheckedBehavior( element ); element.SetValue( CheckedCommandBehaviorProperty, behavior ); } return behavior; } public static CheckedBehavior GetCheckCommandBehavior( DependencyObject obj ) { return (CheckedBehavior) obj.GetValue( CheckedCommandBehaviorProperty ); } public static void SetCheckCommandBehavior( DependencyObject obj, CheckedBehavior value ) { obj.SetValue( CheckedCommandBehaviorProperty, value ); } } I used this article to get me started, but I'll readily admit this is over my head.

    Read the article

  • Mixing application modules between Silverlight and ASP.NET

    - by jkohlhepp
    Background: I work in a suite of ASP.NET applications that have several different "modules". The applications all share a main menu, so they all link to one-another. The modules are the high-level areas of the application. So, for example, it might be Payments, Orders, Customers, Products, etc. And Payments and Orders are in one app and Products and Customers are in another. Some of these menu links are "deep links", for example it might be a link to a particular page within the Customers module, such as Create New Customer. The issue: We are about to start a project that will add several more modules to this suite, probably as a new .NET application. I'm thinking about doing these new modules in Silverlight (for various reasons that are not material to the question). If I were to do that, I need to make the menu look the same as the menu in ASP.NET, as the users still need to feel like they are inside one "application". My questions: How should I organize the Silverlight project(s) so that I can "deep link" from ASP.NET pages into particular modules in the Silverlight app? What is even the best idea for creating these different Silverlight "modules"? If I had something that would've been a page in ASP.NET (for example - Create Customer), should each one of those be a separate Silverlight app? Or should it be a separate User Control? Or something else? Should I reuse our shared ASP.NET menu, and deep link to different Silverlight "modules" even within the new application? Or should I reimplement the menu in Silverlight for navigation within the app? Are there menu controls for Silverlight that look similar to ASP.NET menus (with flyout submenus in this case)? Could I maybe even share a SiteMap XML file between them? Edit: After looking around a bit more, it seems like PRISM might be the answer for some of my issues. It would allow me to modularize the different chunks of Silverlight that I have. And it would allow me to define a "master page" in Silverlight where I could host the menu. Do I have this right?

    Read the article

< Previous Page | 6 7 8 9 10 11 12  | Next Page >