|
Quick update from WPF here. Windows 10 Anniversary Edition is out and along with that is .NET 4.6.2 which you can see the release blog for here. WPF gets per monitor DPI support and automatic invocation of the touch keyboard (both require Win10 Anniversary Edition). Also some changes have been made internally to lessen the effect of the garbage collector on applications dealing with lots of bitmaps. So if you know anything about the MemoryPressure class, know that it's now gone so uh, I hope you guarded your private reflection. For anyone interested in the touch keyboard support in WPF and not having your apps clobbered by the KB appearing, please take a look here at some sample code to register for notifications and some basic ways to react to occlusion by the KB.
|
# ? Aug 9, 2016 00:14 |
|
|
# ? Jun 9, 2024 04:59 |
|
Speaking of WPF, some time ago I think I asked here about the differences between WPF and Windows 10's brand of XAML. Does anyone still have that information?
|
# ? Aug 9, 2016 01:10 |
|
Inverness posted:Speaking of WPF, some time ago I think I asked here about the differences between WPF and Windows 10's brand of XAML. I don't believe the new XAML has Decorators or Markup Extensions. But I could be wrong about this. You also have x:Bind which, as I understand it, creates getters and setters at compile time for certain bindings so you don't pay the reflection penalties. Honestly, I am not well versed in Universal apps so I don't know much more offhand. I can see if anyone has a good reference to give me when I get into work.
|
# ? Aug 9, 2016 16:00 |
|
Is it possible to write a WPF UI for a pre-existing .net program built on winforms by just layering it on top of the existing code? I seriously don't want to rewrite 10 years of hacked together crap that no one here understands just to modernize their UI if they're going to fight me every step of the way about the fact that an entire rewrite is what they're actually asking for.
|
# ? Aug 9, 2016 17:33 |
|
That depends - if you take away the winforms part, does anything remain of the application? A lot of badly made apps just squeeze the code into random event handlers in Form1.cs through Form59.cs, which means you're poo poo out of luck. If, however, it is a properly layered application with the business logic separated from the view then you might hahahaha who am I kidding.
|
# ? Aug 9, 2016 18:16 |
|
EssOEss posted:If, however, it is a properly layered application with the business logic separated from the view then you might hahahaha who am I kidding. No, and whenever I bring up the idea of doing this it makes them give me looks like I'm about to create some unmaintainable sorcery that'll require them to sacrifice unborn children to satan.
|
# ? Aug 9, 2016 18:29 |
|
Portland Sucks posted:No, and whenever I bring up the idea of doing this it makes them give me looks like I'm about to create some unmaintainable sorcery that'll require them to sacrifice unborn children to satan. While already sacrificing unborn children..........
|
# ? Aug 9, 2016 19:07 |
|
Portland Sucks posted:Is it possible to write a WPF UI for a pre-existing .net program built on winforms by just layering it on top of the existing code? I seriously don't want to rewrite 10 years of hacked together crap that no one here understands just to modernize their UI if they're going to fight me every step of the way about the fact that an entire rewrite is what they're actually asking for. Ok so beyond the obvious, which has been covered perfectly in the previous few posts, here's what I'd think is the bare minimum you would *still* be looking at: You'd obviously need to redo all the interfaces. In theory you could just 'migrate' the WinForms code-behind event handlers(button clicks, etc) to WPF code-behind, but if you wanted to really get fancy you'd probably end up needing to move Command based stuff into the View Model. Speaking of, you'd probably need to migrate all the crufty random fields/properties WinForms is using *into* a ViewModel. Regardless, it's a pretty significant project.
|
# ? Aug 9, 2016 23:32 |
|
There is something for embedding WPF into winforms, though. Google it.
|
# ? Aug 9, 2016 23:46 |
|
fleshweasel posted:There is something for embedding WPF into winforms, though. Google it. I feel by strange coincidence I *JUST* bumped into a possible use of this today. Our QA team was hunting down some weird issue with one of their CodedUI tests and I happened to notice that in our WinForms application, there was a compiler warning about some of the auto-generated CUI code surrounding a third-party tools library overwriting a Wpf control handler.
|
# ? Aug 10, 2016 00:13 |
|
fleshweasel posted:There is something for embedding WPF into winforms, though. Google it. You do not want the rabbit hole that is airspace issues due to WinFormsHost. You do not want this.
|
# ? Aug 10, 2016 05:41 |
|
I use winformshost
|
# ? Aug 10, 2016 06:31 |
|
Mister Duck posted:You do not want the rabbit hole that is airspace issues due to WinFormsHost. You do not want this. That's the opposite of what was proposed ElementHost is the WPF-controls-inside-WinForms equivalent, but I'm not sure it's much less of a pain.
|
# ? Aug 10, 2016 11:51 |
|
Cuntpunch posted:That's the opposite of what was proposed ElementHost is the WPF-controls-inside-WinForms equivalent, but I'm not sure it's much less of a pain. Oh I read it as moving the WinForms content into WPF, sorry. Either way though, that stuff is not nice a lot of the time. Baloogan posted:I use winformshost It all works until it doesn't. Then it becomes really annoying, really fast. See this blog for a short history of .NET 4.5 where they attempted to make all the issues go away and failed to do so. You may never run into a single issue depending on your usage, but there are always corner cases lurking.
|
# ? Aug 10, 2016 14:51 |
|
You can totally just use WPF as "like WinForms, but a better control library," though. A "WPF rewrite" doesn't necessarily entail any structural changes, afaik.
|
# ? Aug 10, 2016 15:53 |
|
This is all highly speculative without knowing how the app's structured and how complex it is. If it's simple and all the logic is abstracted away into data access/service layers, it could be fairly simple.
|
# ? Aug 10, 2016 16:40 |
|
If anyone cares for the opinion of someone who's moderately skilled at programming I recently wanted to upgrade my Winform app to WPF. I kept the data layer as abstracted as Winforms would allow but ended up deciding it wasn't worth redesigning all my forms for the benefits I would get out of it. Sure you get much more flexibility with the interface but at the end of the day I had an app that was only used in house that no outside customers would ever see. I could have completely converted the project in less than a week but I feel like what I was gaining wasn't really worth it. If your boss is telling you that you need a more modern look to the app though it might be worth it. Do you sell the app you use? Is it just an inhouse thing? Sometimes uppermanagement doesn't realize how much work something like that could take so if you pitch it showing how many hours it could take and how much it would cost them it might not be worth it to them still.
|
# ? Aug 10, 2016 17:30 |
|
chippy posted:This is all highly speculative without knowing how the app's structured and how complex it is. If it's simple and all the logic is abstracted away into data access/service layers, it could be fairly simple. It's about 30,000 lines of code total. There is tons of unused code, tons of copy pasted crap, no concept of separating the UI and logical elements, and you can find SQL queries to multiple databases that happen at every layer of the project from everything to ( select * table ) to populate the base set of data it works off of down to individual UI elements that will query the database to grab a particular date to display when a window pops up rather than going back to the original data. Its clear that multiple people who never spoke to each other have passed this thing around like a sad whore and now I, the intern who hasn't graduated yet, have been tasked with upgrading the UI into WPF however I want with little to no guidance.
|
# ? Aug 10, 2016 18:12 |
|
smarion2 posted:If anyone cares for the opinion of someone who's moderately skilled at programming I recently wanted to upgrade my Winform app to WPF. I kept the data layer as abstracted as Winforms would allow but ended up deciding it wasn't worth redesigning all my forms for the benefits I would get out of it. It's all in house. Its used by our laborers on the floor (blue collar stuff) and management has decided that it'd be ~super rad~ if the program they used was touch screen based on tablets and "was more like the apps they used on their cellphones." There is a lot of idealism running rampant in this project that I'm more or less soloing and I'm just the intern who had his contract extended specifically for this one task so if I try to shut it down too much I'll more than likely find myself out of the position.
|
# ? Aug 10, 2016 18:14 |
|
I've got a doozie. WebAPI endpoint eats an id as a param and JSON in the post body like so:code:
So, I add the tracing poo poo and enable it like so in WebApiConfig: code:
Tracer posted:Here you go! code:
I showed it to the architect on the project and he just smiled and said "have fun, modelbinder sucks to debug." What can I do?
|
# ? Aug 10, 2016 18:42 |
|
^^^ That Tracer you used maybe have recalled the results! Sorry ignore this answer I have no idea how to help you. Portland Sucks posted:It's all in house. Its used by our laborers on the floor (blue collar stuff) and management has decided that it'd be ~super rad~ if the program they used was touch screen based on tablets and "was more like the apps they used on their cellphones." There is a lot of idealism running rampant in this project that I'm more or less soloing and I'm just the intern who had his contract extended specifically for this one task so if I try to shut it down too much I'll more than likely find myself out of the position. Well it sounds to me if they let the last project get that out of hand they probably aren't going to be all that picky about how you do the transition especially if they aren't giving you any guidelines and you are the sole developer. I would just take it one form at a time and clean up bits here and there where you see you can make improvements. Sometimes you will be given tasks from people who do not understand the work involved to do the project correctly. When this happens to me I do what I can to complete the project in the time allotted. I mean what else can you really do other than argue with the boss (I don't think I've ever won this battle) or do what they ask to the best of your abilities. It would really be a great thing to have on your resume for when you graduate so if you like where you're at I'd say its worth a shot. Just make sure they know what you're dealing with and how long it will take you. I feel keeping the boss up to date with honest progress will keep the pressure off best. Good luck! smarion2 fucked around with this message at 19:06 on Aug 10, 2016 |
# ? Aug 10, 2016 18:54 |
|
I'm super new to using C# and dotNET so I'm probably wrong on this, but in some of the tutorials I'm reading there is parameter binding:code:
|
# ? Aug 10, 2016 19:49 |
|
Portland Sucks posted:It's about 30,000 lines of code total. There is tons of unused code, tons of copy pasted crap, no concept of separating the UI and logical elements, and you can find SQL queries to multiple databases that happen at every layer of the project from everything to ( select * table ) to populate the base set of data it works off of down to individual UI elements that will query the database to grab a particular date to display when a window pops up rather than going back to the original data. Its clear that multiple people who never spoke to each other have passed this thing around like a sad whore and now I, the intern who hasn't graduated yet, have been tasked with upgrading the UI into WPF however I want with little to no guidance. You poor, poor bastard. I used to have to maintain a Winforms project like that, you're giving me flashbacks. Run away as far as you can from the WPF conversion thing. It'd probably be easier to just redo it from scratch in a sane fashion.
|
# ? Aug 10, 2016 19:58 |
|
The reason is dumb times two. The JSON payload in the post body for a WebAPI endpoint is apparently supposed to be an anonymous object, not called somethingMetrics (or whatever) Also, a curly bracket missing meant that the configuration in JavaScript for my framework's Ajax call got mixed in with the post body as well. God I hate JavaScript. Edit: After everyone got done shuffling their feet over this someone mentioned that there's some sort of "WSDL"-ish thing someone is trying to come up with for JSON data. Why exactly does this not exist yet? Is there an easy to use tool I could just grab via NuGet (or whatever) to generate a json model based on a .cs file? Also, how DOES one debug the deserializer? Space Whale fucked around with this message at 21:17 on Aug 10, 2016 |
# ? Aug 10, 2016 20:38 |
|
v posted:It's about 30,000 lines of code total. There is tons of unused code, tons of copy pasted crap, no concept of separating the UI and logical elements, and you can find SQL queries to multiple databases that happen at every layer of the project from everything to ( select * table ) to populate the base set of data it works off of down to individual UI elements that will query the database to grab a particular date to display when a window pops up rather than going back to the original data. Its clear that multiple people who never spoke to each other have passed this thing around like a sad whore and now I, the intern who hasn't graduated yet, have been tasked with upgrading the UI into WPF however I want with little to no guidance. Doing this any other way than a full rewrite is an awful idea. This is a great opportunity to drop a ton of technical debt and introduce maintainability if you can get the time needed. Not sure if you have any experience with WPF/MVVM, but this is how I would proceed. To start, identify the important functionality. Hopefully there are users who can speak to the functionality. If not you'll be stuck digging through the mess yourself to figure out exactly what the program does. Then find all the interaction with outside resources whether that be database, file-system, etc. Build models for all of this stuff. Lastly, check out Josh Smith as he is one of the best resources for WPF/MVVM (https://msdn.microsoft.com/en-us/magazine/dd419663.aspx) which his ideally how you should design the app if using WPF.
|
# ? Aug 10, 2016 23:19 |
|
Portland Sucks posted:It's all in house. Its used by our laborers on the floor (blue collar stuff) and management has decided that it'd be ~super rad~ if the program they used was touch screen based on tablets and "was more like the apps they used on their cellphones." There is a lot of idealism running rampant in this project that I'm more or less soloing and I'm just the intern who had his contract extended specifically for this one task so if I try to shut it down too much I'll more than likely find myself out of the position. We've heard three very different project proposals in this thread... [1] Make the UI nicer (probably "flat") and usable with touch and tablet [2] Put in a WPF front-end [3] Re-architect the app with clean architecture It sounds like management and users want [1] and will be happy with it, and they won't care about [2] or [3]. Are there ways to achieve [1] incrementally? I've not done much WinForms myself, only the underlying win32. But everything is possible with win32 so I have to believe it's also possible for WinForms. Maybe you could do it by buying something like https://www.componentone.com/Studio/Utilities/TouchToolkitWinForms If you opt for [3], I think you should try it incrementally and independently of WPF. Take a look at this open source project: https://github.com/ActiveDevelop/MvvmForms -- it's created by Microsoft MVP Klaus Loeffelman who's company specializes in migrations of huge legacy WinForms/VB6 apps. If you opt for [2], I'd try to do it incrementally. I'd start with the existing app, migrate a small chunk codebehind over to MvvmForms, migrate the small affected set of forms over to WPF, and go from there. In my opinion, WPF won't deliver you the nice UI that management+users want. All it does is give a great big ugly weird UI which you have to be a design expert to coax anything nice-looking out of it. (or switch over to "Metro" UWP/XAML which is like WPF but where the built in default styles at least look good).
|
# ? Aug 11, 2016 17:52 |
|
Thanks for all the feedback goons. I spent a few weeks figuring out the MVVM design pattern and feel somewhat comfortable proceeding with what I think is going to end up as a rebuild of the application using WPF/MVVM as the base. I think the part that I'm not coping with at the moment is that unlike school, my employer is obviously not out to design projects that are within my comfort zone of being able to complete on my own. I just keep looking for reasons to throw up my hands and say "I can't do this find someone else", but I know it'll be something great to throw on my resume at the end of the day and will probably give me more valuable experience in the field than I could find anywhere else at the moment. I just really hate the person who wrote all this lovely code. I hate them so much and I hate their code and I hate winforms. I'm just a gigantic ball of hate.
|
# ? Aug 11, 2016 18:53 |
|
Space Whale posted:The reason is dumb times two. Yeah, people usually just begin a JSON document with a {, so a bunch of code is going to expect an anonymous object. quote:Also, a curly bracket missing meant that the configuration in JavaScript for my framework's Ajax call got mixed in with the post body as well. If your config files are eval'ed JS, the problem is above the JS in your program structure. quote:Edit: After everyone got done shuffling their feet over this someone mentioned that there's some sort of "WSDL"-ish thing someone is trying to come up with for JSON data. http://json-schema.org/ exists, but it's kinda weird because it kind of goes against the ~spirit~ of JSON, if you want to buy into the existance of such a thing, because it was never supposed to be rigidly structured like XML.
|
# ? Aug 11, 2016 19:51 |
|
Portland Sucks posted:Thanks for all the feedback goons. I spent a few weeks figuring out the MVVM design pattern and feel somewhat comfortable proceeding with what I think is going to end up as a rebuild of the application using WPF/MVVM as the base. I think the part that I'm not coping with at the moment is that unlike school, my employer is obviously not out to design projects that are within my comfort zone of being able to complete on my own. I just keep looking for reasons to throw up my hands and say "I can't do this find someone else", but I know it'll be something great to throw on my resume at the end of the day and will probably give me more valuable experience in the field than I could find anywhere else at the moment. Your point about valuable experience is exactly right. If you complete a re-architecture from winforms to wpf/mvvm you will be a huge step ahead of the game. Do not underestimate the amount of work this will be though. Sounds like it would take someone familiar with all of this tech a few months.
|
# ? Aug 12, 2016 00:51 |
|
GoodCleanFun posted:Your point about valuable experience is exactly right. If you complete a re-architecture from winforms to wpf/mvvm you will be a huge step ahead of the game. Well my contract is until the end of April right now and his hopes are that I have something up and running by the end of the year, and that I can spent the rest of the time testing and debugging it with the people who will actually be using it. I have literally no idea how to estimate time requirements at this point so I just nodded and said I'll see what I can do.
|
# ? Aug 12, 2016 16:50 |
|
I can sympathize when people throw up their hands and say we should rewrite the whole thing, but I think I'm with Joel Spolsky when I say that in general full rewrites don't pay off, and you can't convince your employer or customer to sign on for it anyway, so you might as well figure out how to go for incremental improvements.
|
# ? Aug 12, 2016 18:41 |
|
Portland Sucks posted:Well my contract is until the end of April right now and his hopes are that I have something up and running by the end of the year, and that I can spent the rest of the time testing and debugging it with the people who will actually be using it. I have literally no idea how to estimate time requirements at this point so I just nodded and said I'll see what I can do. Just remember its important to be honest and upfront to management. Nothing too terrible can happen as long as they are aware of the progress you're making and get the results the promise to return. Don't pretend everything is fine if you are behind as things can spiral out of control pretty quickly. 4 months goes fast when you have to learn as you go. I was just in that situation with having to build an app from scratch but I'm very glad I took the journey as I learned SO MUCH from the experience. I learned what to do and better what NOT to do. Looking back at the project (especially some of the first things I implemented) are not perfect but got the job done. It's kinda cool in a way because if i rewrote it all into WPF now I know I could do so much better. I'm excited for you, don't hesitate to post if you need help or get stuck, I wish I found this thread before I finished my app!
|
# ? Aug 12, 2016 18:44 |
|
Portland Sucks posted:Well my contract is until the end of April right now and his hopes are that I have something up and running by the end of the year, and that I can spent the rest of the time testing and debugging it with the people who will actually be using it. I have literally no idea how to estimate time requirements at this point so I just nodded and said I'll see what I can do. If there's one thing I always wish I had done better throughout every project, it's keeping better track of the work done and to be done. I would recommend not worrying so much about estimating time and instead just try and make sure that everything you do and need to do is kept in a central list (e.g. JIRA, TFS or other issue tracker), and keep adding to and updating the list as you go. Rewriting an existing application from scratch would be an excellent learning experience, but it will get out of control and compound in difficulty without good task management.
|
# ? Aug 12, 2016 23:07 |
|
Portland Sucks posted:Well my contract is until the end of April right now and his hopes are that I have something up and running by the end of the year, and that I can spent the rest of the time testing and debugging it with the people who will actually be using it. I have literally no idea how to estimate time requirements at this point so I just nodded and said I'll see what I can do. https://medium.com/outsystems-engineering/the-hack-for-surviving-the-second-system-syndrome-a8c75c6a68f5#.7rgcul6ie There's an article with some tips on surviving the "second system syndrome". The key insight being "if you're going to start over from scratch, just rebuild the functionality you had before, instead of thinking you can rebuild the old system AND add all sort of new bells and whistles at the same time".
|
# ? Aug 12, 2016 23:25 |
|
Portland Sucks posted:I just really hate the person who wrote all this lovely code. I hate them so much and I hate their code and I hate winforms. I'm just a gigantic ball of hate. Which ever path you take, the next person to touch your code is probably going to think this about whatever you write. What's worse, is if you get made permanent, you'll be the one hating your own code :-) Not sure what your decision on incremental change vs full scale re-write, but I think going through an incremental brownfields-type renewal will put you in much better standing to future employers than writing something new from scratch.
|
# ? Aug 13, 2016 09:23 |
|
Portland Sucks posted:Thanks for all the feedback goons. I spent a few weeks figuring out the MVVM design pattern and feel somewhat comfortable proceeding with what I think is going to end up as a rebuild of the application using WPF/MVVM as the base. I think the part that I'm not coping with at the moment is that unlike school, my employer is obviously not out to design projects that are within my comfort zone of being able to complete on my own. I just keep looking for reasons to throw up my hands and say "I can't do this find someone else", but I know it'll be something great to throw on my resume at the end of the day and will probably give me more valuable experience in the field than I could find anywhere else at the moment. I'd really recommend reading up on MVP a bit. It's a pattern that makes Winforms development totally bearable if you stick to it. And refactoring this app into MVP is going to be way easier than reimplementing it from scratch.
|
# ? Aug 14, 2016 16:49 |
|
epalm posted:https://medium.com/outsystems-engineering/the-hack-for-surviving-the-second-system-syndrome-a8c75c6a68f5#.7rgcul6ie oh god this is my management in a nutshell right now. my way to cope with it was to put a blank piece of paper thumb nailed to the wall with "WISH LIST" written on top of it and I just told them to go ham whenever they had a crazy idea that seemed really cool but was obviously not part of the core functionality of the program. I was pretty clear that I had zero intentions of doing any of it.
|
# ? Aug 15, 2016 15:58 |
|
Getting started with .NET Core, and I'm not sure how to use System.Data.SqlClient. It looks like it should be available, but when I run "dotnet run" it tells me that there isn't a namespace Data in System. Do I have to include something else to get it to work?
|
# ? Aug 16, 2016 22:49 |
|
I work at a primarily Java/*nix shop, and I've been asked to CR a bunch of .NET/C# code that we've outsourced to a contractor. Does anyone know of an IDE that'll run on OSX and take care of basic stuff like meta-click on methods to find implementations? The code is all windows-logging specific stuff, so there's no chance of it working under mono, but I'd like to at least be able to read the code without booting into a different operating system.
|
# ? Aug 17, 2016 00:38 |
|
|
# ? Jun 9, 2024 04:59 |
|
Asymmetrikon posted:Getting started with .NET Core, and I'm not sure how to use System.Data.SqlClient. It looks like it should be available, but when I run "dotnet run" it tells me that there isn't a namespace Data in System. Do I have to include something else to get it to work? You have to add a reference to the NuGet package System.Data.SqlClient. (How did I know this? In the next version of Visual Studio it's going to suggest adding the NuGet package right there when you click the lightbulb. I do my .NETCore coding in Visual Studio for this kind of help. Also, bitter experience tells me that in .NETCore I often have to search around to find the NuGet package that contains a given API, and this was the first NuGet package I tried based on the name...)
|
# ? Aug 17, 2016 00:57 |