|
Well, OK, but you could just put a context with both things in a separate project and then it could be referenced by multiple things, too. There's nothing about Identity that ties it into one of those types of applications -- and if you don't care about users in one place or another you can just not look at that table. Also, having two tables with the same information can cause problems with trying to keep the information in sync and you may later regret it. That's my personal experience anyway. RICHUNCLEPENNYBAGS fucked around with this message at 02:26 on Mar 11, 2015 |
# ? Mar 11, 2015 02:22 |
|
|
# ? Jun 6, 2024 20:48 |
|
It amuses me that to any layperson googling, .NET programming is centralized 100% around blog development and the occasional Customers/Orders/Products involved in Foo & Bar sales.
|
# ? Mar 11, 2015 02:25 |
|
Seems about right.
|
# ? Mar 11, 2015 03:00 |
|
NihilCredo posted:If you must maintain XP compatibility and must therefore target .NET 4.0, is it a total no-brainer to grab the BCL Portability Pack to get access to async/await or are there any drawbacks to consider?
|
# ? Mar 11, 2015 05:05 |
|
Quick WPF question: If I have a view model that also holds my combobox items and I instantiate this in code: code:
Is it ok if I do: code:
Edit: Bummer it seems to instantiate again. Now to find out how to get the DataContext already instantiated..... Edit: This seems to work: code:
Mr Shiny Pants fucked around with this message at 13:52 on Mar 11, 2015 |
# ? Mar 11, 2015 13:39 |
|
Mr Shiny Pants posted:Quick WPF question: You set it in code, so you don't need to set it again. For example, this crappy app I just built. code:
code:
The Data Context is set on the window, so the textbox on the grid can be binded to it.
|
# ? Mar 11, 2015 13:56 |
|
Drastic Actions posted:You set it in code, so you don't need to set it again. For example, this crappy app I just built. If I'm understanding the question and remembering my WPF right, the question is about DataTemplates, which can get annoying to find DataContexts for. Unfortunately, I don't have anything in front of me I can refer to for anything concrete.
|
# ? Mar 11, 2015 13:58 |
|
GrumpyDoctor posted:If I'm understanding the question and remembering my WPF right, the question is about DataTemplates, which can get annoying to find DataContexts for. Unfortunately, I don't have anything in front of me I can refer to for anything concrete. Yeah, you're right. I did not read the question correctly. It's early
|
# ? Mar 11, 2015 13:59 |
|
Drastic Actions posted:Yeah, you're right. I did not read the question correctly. It's early I edited my post. I think I found something that works. Thanks anyway. Something else, this is probably dumb because it sounds pretty simple: I have a list, you select something in the list and press a button to open the selected item. How do I pass the selected item on the Buttonclick? Do I need to reference the listview? My controls get binded dynamically so they have no name. Do I need to do button.parent.listview.selectedItem? Or is there something else? Mr Shiny Pants fucked around with this message at 14:56 on Mar 11, 2015 |
# ? Mar 11, 2015 14:49 |
|
Mr Shiny Pants posted:I edited my post. I think I found something that works. Thanks anyway. The button should be bound to an ICommand to fire off a method in the viewmodel. You should not have an event handler.
|
# ? Mar 11, 2015 14:59 |
|
Ithaqua posted:The button should be bound to an ICommand to fire off a method in the viewmodel. You should not have an event handler. How would this work? The ListView in my GUI is bound to a Generic list that has no SelectedItem property? When I fire off the button pass in the Listview Selected Item? How would my viewmodel know about a property of a xaml control? Edit: Thinking about it some more: I need a property in my viewmodel that gets updated when I select something right? That way I can get the property if the button is clicked from the datacontext. Mr Shiny Pants fucked around with this message at 15:32 on Mar 11, 2015 |
# ? Mar 11, 2015 15:12 |
|
Mr Shiny Pants posted:Edit: Thinking about it some more: Yep, bind ListView.SelectedItem or whatever to something in your viewmodel.
|
# ? Mar 11, 2015 15:35 |
|
GrumpyDoctor posted:Yep, bind ListView.SelectedItem or whatever to something in your viewmodel. Yeah that makes sense. Thanks for helping me in the right direction.
|
# ? Mar 11, 2015 15:37 |
|
I must say that I am pleasantly surprised by WPF. I started this morning having never coded a line of WPF, but I am getting pretty good results already.
|
# ? Mar 11, 2015 18:00 |
|
Mr Shiny Pants posted:I must say that I am pleasantly surprised by WPF. WPF is known for making hard things easy and easy things hard. On the balance I think it's pretty great, but be prepared to eventually run into some absurd wart or bug down the line.
|
# ? Mar 11, 2015 18:42 |
|
GrumpyDoctor posted:WPF is known for making hard things easy and easy things hard. On the balance I think it's pretty great, but be prepared to eventually run into some absurd wart or bug down the line. One thing I don't get is why MS did not make this the default development environment for their tablets and phones. I am working on an application that can run on a tablet but for the really nice integration stuff ( like a camera ) I must program WinRT? WTF?
|
# ? Mar 11, 2015 18:56 |
|
Mr Shiny Pants posted:One thing I don't get is why MS did not make this the default development environment for their tablets and phones. I am working on an application that can run on a tablet but for the really nice integration stuff ( like a camera ) I must program WinRT? That's a grand Microsoft tradition. Stick around and they'll probably come up with a whole 'nother island for
|
# ? Mar 11, 2015 19:06 |
|
Mr Shiny Pants posted:One thing I don't get is why MS did not make this the default development environment for their tablets and phones. I am working on an application that can run on a tablet but for the really nice integration stuff ( like a camera ) I must program WinRT? I'm sure you can access camera from WPF. I know that I wrote code which accessed it in a WinForms app, via underlying win32/COM APIs, so it must be possible from WPF. As to why not WPF for tablets/phones? I'm not on the WPF or WinRT-XAML teams, so all this is just speculation, but... * WPF isn't consumable by C++ or JS. Had to be redone from scratch to support those platforms. * WPF is huge - lots of APIs and classes, fine for running on a desktop, but there's a lot more stuff happening in them than is worth spending battery on for a low power device. I believe the WinRT XAML stack can render stuff with many fewer CPU cycles. * I'm not clear on this, but I get the impression that WPF falls too easily into "pits of failure" that can't be accelerated by a graphics card or offloaded onto a separate rendering thread. The WinRT XAML stack avoids those pits by default. That said, there are lots of painful and irritating omissions in the WinRT XAML stack that I do miss from WPF.
|
# ? Mar 11, 2015 19:25 |
|
Oh I am sure I can get the camera to work, but I saw some RT demo's when it came out and it was like three lines of code. All good points, but I think if they would have spent the energy on WPF that they did on RT I am sure a lot could be improved in the framework itself. I mean they had Silverlight already, which is like WPF lite. This looks promising: http://blogs.msdn.com/b/eternalcodi...-a-wpf-app.aspx Mr Shiny Pants fucked around with this message at 19:46 on Mar 11, 2015 |
# ? Mar 11, 2015 19:35 |
|
Not sure if anyone noticed, but one of the core GC documents is up in the Documentation folder on github: https://github.com/dotnet/coreclr/blob/master/Documentation/garbage-collection.md
|
# ? Mar 11, 2015 19:52 |
|
ljw1004 posted:* I'm not clear on this, but I get the impression that WPF falls too easily into "pits of failure" that can't be accelerated by a graphics card or offloaded onto a separate rendering thread. The WinRT XAML stack avoids those pits by default. This is really interesting, can you shed more light on how WinRT XAML avoids this? At my company we've used WPF for a while now, but we keep running into performance problems (mostly layout, we need lots of grids that constantly update). We've gone back to WinForms in some cases. I have no experience with WinRT stuff, could we benefit from WinRT XAML performance in a regular (non-Store) desktop app?
|
# ? Mar 11, 2015 21:34 |
|
Ok, roadblock. Is ICommand complicated or what? I need a button that will add an item to a list, the item that has the list is itself in a list. How do I do something like: code:
I am tempted to just use on_button_click. Mr Shiny Pants fucked around with this message at 21:44 on Mar 11, 2015 |
# ? Mar 11, 2015 21:37 |
|
I'm using DateTime to get the day of the month as a number, but I haven't been able to find a good way to format the day with suffixes. For instance, if the date is 5, I want to format the string to output "5th", 1 becomes "1st", etc. Is this something custom I'll have to write?
|
# ? Mar 11, 2015 21:46 |
|
enthe0s posted:I'm using DateTime to get the day of the month as a number, but I haven't been able to find a good way to format the day with suffixes. For instance, if the date is 5, I want to format the string to output "5th", 1 becomes "1st", etc. It's not built in because it would be impossible to properly globalize. http://stackoverflow.com/questions/20156/is-there-an-easy-way-to-create-ordinals-in-c
|
# ? Mar 11, 2015 21:52 |
|
Gotcha, thanks!
|
# ? Mar 11, 2015 21:54 |
|
enthe0s posted:I'm using DateTime to get the day of the month as a number, but I haven't been able to find a good way to format the day with suffixes. For instance, if the date is 5, I want to format the string to output "5th", 1 becomes "1st", etc. Use Humanizr (pulled from The Hanselman)
|
# ? Mar 11, 2015 22:01 |
|
Mr Shiny Pants posted:Ok, roadblock. The general pattern often used is MVVM (model-view-viewmodel) and if you want to do it "properly" you should likely follow that pattern. Roughly speaking, stop thinking of "handling" UI events. Instead bind the UI elements to various behaviors exposed by your viewmodel. What this means specifically depends very much on your actual business logic and is not realistically simplifyable. For example, if you have an app to select a nice set of flowers from different options, you might have a FlowerSetBuilderVm viewmodel object for your FlowerSetBuilder form. The VM would expose an ObservableCollection<FlowerVm> named AvailableFlowers and another named SelectedFlowers. There would be a single Add button that enables flowers to be added from the available list to the selected list. This button is data bound to an AddCommand property of the selected FlowerVm (or none if no FlowerVm is selected). Pressing the button will execute the logic in the ICommand implementation exposed by the AddCommand property, which will execute code in the FlowerSetBuilderVm to move the relevant FlowerVm from one list to another. The UI will automatically detect when this happens and adjust itself accordingly, adding/removing view layer items based on the changes in the two collections. Very generalized but I guess you get the point.
|
# ? Mar 11, 2015 22:08 |
|
Mr Shiny Pants posted:Is ICommand complicated or what? I need a button that will add an item to a list, the item that has the list is itself in a list. To expand on what EssOEss said, you need to think about the data that represents your UI without thinking in terms of buttons and labels and text fields. The beauty of MVVM is the same as in any other declarative UI framework, you describe how the UI should be rendered based off of your data, and then you can just work with your data without having to manually update the UI. For example, what I gathered from your post was that you have a list of lists. For each inner list in your outer list, you want to be able to add an item to that inner list. Your data might look like this: C# code:
The huge, huge (huge) benefit is that you can stop caring about the menial things like subscribing to events like button click, text changed, etc. and just work with the data that describes your view, i.e. your View Model. I guarantee you the vast majority of things you might do in a UI can be described simply with ICommand, string, int/double/decimal/etc. and ObservableCollection. The CommandHandler in the above code is a very simple, copy-and-pastable implementation of ICommand: C# code:
Bognar fucked around with this message at 22:39 on Mar 11, 2015 |
# ? Mar 11, 2015 22:33 |
|
Mr Shiny Pants posted:Ok, roadblock. Here's a quick VS 2012 example solution I whipped up, using ICommand and MVVM: http://epswing.com/shared/ICommandAndMVVM.zip It's small enough that you should be able to read everything in a few minutes. Let me/us know if anything is unclear. Note that pretty much all the "logic" is in the ViewModel.
|
# ? Mar 11, 2015 22:38 |
|
Thanks guys, I will take a look tomorrow. I've been programming all day, I am spent. Will let you know. Just felt like I needed to build ISkyScraperFoundation when all I wanted was new Shed(); Mr Shiny Pants fucked around with this message at 23:43 on Mar 11, 2015 |
# ? Mar 11, 2015 23:32 |
|
Hah just had a funny. I have a job fired by an .aspx page that connects to an FTP and uploads a file I've created. I was testing it out in another application so hurriedly just commented out the ftp code (because I didn't want to upload test files to the live server) and then let it run in the background to test the file generation part. Switched to something else for 30 minutes, look up and see that the browser tab I was running it from still had the spinning 'waiting for localhost' icon going. This thing should normally take 5 minutes top. Turns out I was a bit too lazy when commenting, and the guy who did this before me a bit too lazy when naming variables:code:
|
# ? Mar 12, 2015 02:30 |
|
Scaramouche posted:Turns out when you name a variable the same thing as a class bad things can happen. Maybe it's my lack of knowledge of VB here, but which variable is named the same as a class? I see the FtpWebResponse class and the 'response' variable name in that code.
|
# ? Mar 12, 2015 02:53 |
|
Adhemar posted:This is really interesting, can you shed more light on how WinRT XAML avoids this? At my company we've used WPF for a while now, but we keep running into performance problems (mostly layout, we need lots of grids that constantly update). We've gone back to WinForms in some cases. I have no experience with WinRT stuff, could we benefit from WinRT XAML performance in a regular (non-Store) desktop app? VS2015 will ship with "UI Performance Analysis Tool" for WPF desktop apps http://blogs.msdn.com/b/wpf/archive/2015/01/16/new-ui-performance-analysis-tool-for-wpf-applications.aspx It's already present in the latest CTPs of VS2015. Sounds like it will be directly relevant to your work. Where does WinRT XAML avoid perf hits? I guess the first thing that comes to mind, and which bit me, is its thing about independent animations and EnableDependentAnimation being off by default. https://msdn.microsoft.com/en-us/library/windows/apps/xaml/jj819807.aspx
|
# ? Mar 12, 2015 03:34 |
|
ljw1004 posted:VS2015 will ship with "UI Performance Analysis Tool" for WPF desktop apps Cool, thanks. I'll have to play around with that at home, it'll be a while before we're running VS 2015 and Win 8.1+ at work.
|
# ? Mar 12, 2015 03:41 |
|
Che Delilas posted:Maybe it's my lack of knowledge of VB here, but which variable is named the same as a class? I see the FtpWebResponse class and the 'response' variable name in that code. VB isn't case-sensitive and I'm guessing GetRequest returns a Request.
|
# ? Mar 12, 2015 03:47 |
|
RICHUNCLEPENNYBAGS posted:VB isn't case-sensitive and I'm guessing GetRequest returns a Request. Yeah. Right click on that 'Response.Close()' and choose to Go To Definition and you get the class in the Object Explorer, not a variable declaration.
|
# ? Mar 12, 2015 03:59 |
|
God drat vb is messed up.
|
# ? Mar 12, 2015 04:14 |
|
Why would the Response class have a close method?
|
# ? Mar 12, 2015 04:59 |
|
It works! Yay!epalm posted:Here's a quick VS 2012 example solution I whipped up, using ICommand and MVVM: http://epswing.com/shared/ICommandAndMVVM.zip Thanks for this! This made it a whole lot clearer. The relaycommand stuff I also saw while searching around. Is it a best practice to just do it that way? Your InotifyProperty changed stuff is pretty funky. Seems like a generic implementation? Bognar posted:To expand on what EssOEss said, you need to think about the data that represents your UI without thinking in terms of buttons and labels and text fields. The beauty of MVVM is the same as in any other declarative UI framework, you describe how the UI should be rendered based off of your data, and then you can just work with your data without having to manually update the UI. Gotcha. drat: This got me good: http://blog.alner.net/archive/2010/05/07/wpf-style-and-template-resources_order-matters.aspx What started out as a pretty simple app...... You want a different type of template for a different Type? Use a datatemplate selector. Oh you want it to change based on a property, datatemplateselector does not listen to PropertyChanged events. So now I have datatemplate.triggers that watch a value. It works, but it is something else. It is cool though. Mr Shiny Pants fucked around with this message at 10:57 on Mar 12, 2015 |
# ? Mar 12, 2015 08:09 |
|
|
# ? Jun 6, 2024 20:48 |
|
Sedro posted:Why would the Response class have a close method? It doesn't, and I don't think that's what's going on here. ASP.NET has a property called Response on Web Forms pages and MVC controllers that accesses the HttpContext.Response object (which is an HttpResponse, I don't think just Response exists as a class).
|
# ? Mar 12, 2015 14:25 |