|
Bognar posted:I bet that's actually a binding issue. Updating IsBusy (probably) raises a PropertyChanged event with the argument "IsBusy", however the button in your UI is bound to "CPUBoundCommand" and is determining its Enabled status from that. So, even though your RelayCommand's CanExecute is dependent on the IsBusy property, the UI doesn't know that so it's not going to re-run the function to know if it can execute. The UI is only going to update controls that are bound to IsBusy. I like your third solution (why didn't I just do that? I already did that for some checkboxes. Jesus. ) but I'm going to ask something anyway: you say that "even though your RelayCommand's CanExecute is dependent on the IsBusy property, the UI doesn't know that so it's not going to re-run the function to know if it can execute." If that's the case, why does the button disable when I set IsBusy to true before the awaited task? (ed) I could also use my INPCDependsAttribute that I posted about earlier in the thread as an attribute on CPUBoundCommand, which effectively automates your option 2: C# code:
Ciaphas fucked around with this message at 22:39 on Oct 27, 2015 |
# ? Oct 27, 2015 22:33 |
|
|
# ? Jun 7, 2024 02:15 |
|
WPF calls CanExecute after calling Execute. This worked well when things in .NET were synchronous, but you still had to deal with things manually if you were scheduling work onto a background thread (sound familiar?). What happens now is your async void method "completes" synchronously before the full execution of the async method. So, WPF executes your CPUBoundCommand which gets to the await then returns. Then WPF calls CanExecute, sees that it returns false and disables your button. Finally, your asynchronous command finishes executing and we run into the problem we already discussed.
|
# ? Oct 27, 2015 22:40 |
|
That didn't even occur to me, that the command would be considered "completed" for the purposes of WPF when it hits the await. That pretty much explains the whole thing. Thanks for being patient with me
|
# ? Oct 27, 2015 22:51 |
|
Ciaphas posted:Yet another reason I wish my work machine wasn't an internet-free security-lockdown hellhole. NuGet packages and other frameworks are a non-starter for me, which probably isn't helping matters as far as learning (at least at work) What industry are you working in, if I may ask?
|
# ? Oct 28, 2015 00:41 |
|
crashdome posted:edit: nm He's a little full of himself but he literally wrote the book on dependency injection in C# and I think he's right that isn't better not to bake in the dependency on the service locator throughout your application in many cases, for all the same reasons I don't really like singletons very much.
|
# ? Oct 28, 2015 12:22 |
|
I've always had an interest in what PostSharp could offer for programming. My problem with using it is licensing. Sure we could acquire a license for some larger project at work, but for minor use or my own use, I don't want to have to do that. Yeah, they offer a free version, but it's too limited in my opinion. The free version does not support async or iterator methods, use-based optimization, or any platforms but the desktop framework. Sure you can apply for a free open source license, but that's not without limit and you need to submit an application in the first place. Instead, I just made a fork of Roslyn, and for the last few days I've had a fun time clunking away at adding an aspect rewriter into the method compilation stage. It's by no means finished. Here's an example of an exception handling aspect: code:
code:
code:
Relevant Roslyn code is here for anyone interested. And here is the base library for it and the console app I use to test it. Inverness fucked around with this message at 17:50 on Oct 28, 2015 |
# ? Oct 28, 2015 13:49 |
|
Thats cool! I've been working on a separate Roslyn related project. I'll bookmark your repo for looking at later.
|
# ? Oct 28, 2015 17:13 |
I have a quick question regarding Solution file organization. Currently in what I would consider to be the main portion of our system there are 3 major end points. One desktop application, one customer website, and one website for outside contractors. Currently all three are in their own solution files, but share essentially the same back-end projects. Frequently we make a change in one solution, and then have to open up the other two solutions to make matching changes to the other solutions. This sometimes makes trivial changes feel much larger than they really are. Is it possible to combine these all into one solution and still be able to publish all three separately? Assuming it is, does it make sense to do so? I'm not sure if that's enough information, so if you need more, ask away.
|
|
# ? Oct 28, 2015 17:39 |
|
wilderthanmild posted:I have a quick question regarding Solution file organization. What you describe is normally something that would be contained in a single solution with several projects for common and platform/frontend specific code.
|
# ? Oct 28, 2015 17:52 |
Inverness posted:What exactly is your publishing procedure? Our publishing procedure is pretty basic I'd say. Currently, the desktop application is published as a click once application. Both of the websites are published using the publish tool in visual studio and published via file system. Most major releases involve publishing all three at the same time, typically done in the very early morning or evening before. There are a lot of minor releases which tend to be desktop application only. The majority of the time testing is done simply by running with the debugger attached, but for the web sites they both have a second publish profile for bigger testing involving more than just the developers. In the case of the desktop app, we have to manually deploy for testing.
|
|
# ? Oct 28, 2015 18:10 |
|
ClickOnce deployment and website publishing through VS are project specific and don't depend on the solution. You should be able to add all your projects to a single solution file and still deploy separately. In order to debug a specific project in a solution, you'll want to make use of the "Set as StartUp Project" option in the context menu shown by right clicking on a project. This makes it so when you start debugging (by clicking, pressing F5, whatever) then the project that is started is whatever your current StartUp Project is. It's not uncommon to have many executable projects in a solution. In just the solution I currently have open, 7 of the projects are executable. Bognar fucked around with this message at 18:32 on Oct 28, 2015 |
# ? Oct 28, 2015 18:29 |
Thanks for the help everyone. It seems the single solution for most of the project is the right approach. This will save a lot unnecessary opening and closing and shuffling of windows.
|
|
# ? Oct 28, 2015 19:20 |
|
Ciaphas posted:So I figured the IsBusy = false must be on a non-UI thread. That's not right. WPF will happily do INotifyPropertyChanged + databinding from a non-UI thread. As of .NET45, it also does it for INotifyCollectionChanged.
|
# ? Oct 28, 2015 20:43 |
|
Speaking of the UI thread, is there some easy way to kick some code to the UI thread in UWP if you do not have access to some UI object like a Page or whatnot? Say, I am in some totally random WhateverClass.DoWhatever() with no dispatcher or UI synchronization context in sight. So far, the pattern I use is to capture the UI thread synchronization context and use it for Task scheduling later but since the UI thread is sort of a singleton, I wonder if I am missing some easier option.
|
# ? Oct 28, 2015 21:41 |
|
EssOEss posted:Speaking of the UI thread, is there some easy way to kick some code to the UI thread in UWP if you do not have access to some UI object like a Page or whatnot? Say, I am in some totally random WhateverClass.DoWhatever() with no dispatcher or UI synchronization context in sight. So far, the pattern I use is to capture the UI thread synchronization context and use it for Task scheduling later but since the UI thread is sort of a singleton, I wonder if I am missing some easier option. I imagine UWP would have something similar.
|
# ? Oct 28, 2015 21:51 |
|
EssOEss posted:Speaking of the UI thread, is there some easy way to kick some code to the UI thread This feels like a bit of a smell to me... Basically, you can write your entire app on the UI thread. The only thing to hive off is small CPU-bound computation kernels. There's no measurable performance downside to doing most of your code on the UI thread. It will also make everything easier. When you do work on a different thread, the cleanest way to avoid shared-memory race conditions is (1) your data structures are mostly immutable and certainly aren't mutated by the thread, (2) the thread delivers its output in the Task<T> return type, for the caller to do with as it sees fit. I wouldn't make that thread modify the UI. If the different-thread work is long running and you want some progress to be send back, then do it via the IProgress<T> interface and the Progress<T> class, which automatically marshals back as needed.
|
# ? Oct 28, 2015 21:57 |
|
I have a question about UWP. Other than the whole run-on-all-platforms thing, how does its API relate to the Windows 8 "Store" application API? Does it use an entirely different set of classes? Is there some overlap? Where does WinRT fit into all of this? Also, if you have a UWP app, how do you get it to do things outside of its box? I imagine the built-in UWP apps with Windows 10 have to do such things otherwise they couldn't change system settings for you and stuff like that. How does that work?
|
# ? Oct 28, 2015 22:05 |
|
Inverness posted:I have a question about UWP. Other than the whole run-on-all-platforms thing, how does its API relate to the Windows 8 "Store" application API? Does it use an entirely different set of classes? Is there some overlap? Where does WinRT fit into all of this? Win8 and UWP both denote a set of Win32 APIs, a set of COM APIs and a set of WinRT APIs. UWP itself is a superset of the PCL intersection of both Win8.1 and WinPhone8.1. (Hence, any .NET "universal PCL" that you wrote can be referenced fine by a UWP app and will run fine on all Win10 devices including Mobile and Xbox and Desktop). The "Win10 Desktop" operating system supports all UWP APIs, plus so-called "Desktop Extension SDK" APIs. In answer to your question, UWP+DesktopExtensionSDK is a superset of Win8.1 store-app APIs. (Hence, any .NET win8.1 DLL that you wrote can be referenced fine by a UWP app and will run fine on Win10 Desktop devices). Note that a regular desktop app (console, WPF, Winforms, ...) is allowed to call lots of WinRT APIs. I wrote a NuGet package to add a reference to all UWP and DesktopExtensionSDK APIs: https://www.nuget.org/packages/UwpDesktop How does a UWP app get to do things outside its box? Change system settings? They're not allowed to do lots of things (e.g. you can't write something that just scans the entire filesystem unless the user specifically clicks a button in the File Selector dialog to chose that). It can't write to the registry. I don't know how the Settings app does all its stuff.
|
# ? Oct 28, 2015 23:52 |
|
Thanks for that. I've got a much clearer picture of things now.ljw1004 posted:How does a UWP app get to do things outside its box? Change system settings? They're not allowed to do lots of things (e.g. you can't write something that just scans the entire filesystem unless the user specifically clicks a button in the File Selector dialog to chose that). It can't write to the registry. I don't know how the Settings app does all its stuff.
|
# ? Oct 29, 2015 00:57 |
|
I'm wondering if you guys can help steer me in the right direction. I started at my company as a developer doing classic ASP stuff back in 2001. Moved to the .NET framework, worked with that up through version 3.5 or so (mostly developing web services for our other devs to pull data into their own apps). At that point, my role changed into more of a DBA, and I haven't really been keeping up with all of the new developments with .NET. We use SQL Server here, and I'm responsible for keeping an eye on a lot of databases. Back in March, I ended up writing a .NET Windows service that rolls through each SQL cluster and each database every night, collects some metrics on row counts, table sizes, application specific metrics, etc, then dumps them into a database for analysis. It works for me since I can pop in whenever and run queries to find the data I want. What doesn't work is the fact that every time I need to send this data on to other teams, I have to dick around with it, dump it into Excel, generate graphs manually, all that BS. Getting tired of doing that. Also, as the DBA, I have to deal with the devs using Entity Framework for everything, and I end up seeing a lot of issues on the SQL side with the way they're using it. Automagically generated queries that totally suck, lazy loading issues, locking/blocking issues, etc. Back in my day, I had to code all my objects by hand, write my own stored procs, write up all the logic to turn those stored proc results into objects (jeebus help whoever has to look at my service code from March). I have no experience with EF other than what I've seen it do to my SQL clusters. What I'm looking for is a good reference or tutorial on how to develop a website in ASP.NET using EF and the latest advances in the framework, and being able to pull data from my existing analysis database to display it to the users. Preferably with some pretty charts and whatnot to make it easier to comprehend. Not only will this save me time, but I'm hoping that in the process, I can get a better understanding about the proper way to use EF and making it play nicely with SQL. At that point, I can go to the devs and give them some pointers on how they can improve their code and get things running better. I'm not a total newbie, but I've been having issues wrapping my head around MVC and that type of stuff (probably because I'm old and it's hard for me to learn anything at this point while still trying to do the rest of my job). So, any recommendations on where to start? Any help would be greatly appreciated.
|
# ? Oct 29, 2015 16:38 |
|
Boogeyman posted:I'm wondering if you guys can help steer me in the right direction. I started at my company as a developer doing classic ASP stuff back in 2001. Moved to the .NET framework, worked with that up through version 3.5 or so (mostly developing web services for our other devs to pull data into their own apps). At that point, my role changed into more of a DBA, and I haven't really been keeping up with all of the new developments with .NET. For reporting, look at PowerBI.
|
# ? Oct 29, 2015 16:49 |
|
I'd recommend having them use MiniProfiler in their apps (http://miniprofiler.com/), which will show them issues with the queries EF generates, but to really fix this your devs are going to have to get a better understanding of SQL, and realize that just because the ORM generated a statement for you it doesn't mean it's good or correct. As far as tutorials, this one was published a couple days ago on the official asp.net site. edit- whoops, MVC 5 is definitely not beta, got mixed up Potassium Problems fucked around with this message at 16:56 on Oct 29, 2015 |
# ? Oct 29, 2015 16:53 |
|
Holy cow. I don't even know how to ask this question. I'm going to paste some code. I apologize in advance. Given this: C# code:
pre:<table> <tr> <td>Job1</td> @for (int i = 0; i < Model.Groups.Count; i++) { <td> @Html.CheckBoxFor(model => Model.Groups[i].Job1) </td> } </tr> <tr> <td>Job2</td> @for (int i = 0; i < Model.Groups.Count; i++) { <td> @Html.CheckBoxFor(model => Model.Groups[i].Job2) </td> } </tr> <tr> <td>Job3</td> @for (int i = 0; i < Model.Groups.Count; i++) { <td> @Html.CheckBoxFor(model => Model.Groups[i].Job3) </td> } </tr> </table> pre:<table> @foreach (var name in Group.BoolPropertyNames()) { <tr> <td>@name</td> @for (int i = 0; i < Model.Groups.Count; i++) { <td> @Html.CheckBoxFor(model => Model.Groups[i].WHATGOESHERE?) </td> } </tr> } </table> In reality I have a couple dozen of those Job bools, and pasting that 10-line <tr> for each of them is both tedious and error prone. Edit: I'm also interested in how one would properly ask the question I don't know how to ask without a hand-wavy example.
|
# ? Oct 29, 2015 17:46 |
|
I don't know if I quite like where this is going but you should look into ModelMetadata and iterating over the properties of your view model.
|
# ? Oct 29, 2015 17:55 |
|
epalm posted:Holy cow. I don't even know how to ask this question. I'm going to paste some code. I apologize in advance. I would build the new expressions by hand using something like: C# code:
pre:@foreach (var prop in Group.BoolProperties()) { <div> @Html.CheckBoxFor(MakeExpression<MyModel,bool>(model => model.Groups[0], prop)) </div> } EDIT: epalm posted:Edit: I'm also interested in how one would properly ask the question I don't know how to ask without a hand-wavy example. The question I'm answering here is "how do I dynamically build an expression at runtime that can be used with MVC's HTML Helpers?" Bognar fucked around with this message at 18:20 on Oct 29, 2015 |
# ? Oct 29, 2015 18:07 |
|
Work is making me pick between VS2015 Professional and Enterprise. As a developer is there a reason to pick the Enterprise license? I see some nice things like IntelliTrace and memory analysis, but I think I can live out them. Any other reasons to pick Enterprise that's not obvious in the product comparison matrix?
|
# ? Oct 29, 2015 18:55 |
|
gariig posted:Work is making me pick between VS2015 Professional and Enterprise. As a developer is there a reason to pick the Enterprise license? I see some nice things like IntelliTrace and memory analysis, but I think I can live out them. Any other reasons to pick Enterprise that's not obvious in the product comparison matrix?
|
# ? Oct 29, 2015 19:46 |
|
fleshweasel posted:I don't know if I quite like where this is going You and me both, buddy Bognar posted:I would build the new expressions by hand using something like Fascinating. Thanks! epswing fucked around with this message at 20:01 on Oct 29, 2015 |
# ? Oct 29, 2015 19:58 |
|
Since this is the catch-all Microsoft-ecosystem developer thread, I'll ask here: Anyone else going to be at the MVP summit this week?
|
# ? Nov 1, 2015 16:26 |
|
We have two C# solutions with a small but growing overlap of features. I want to pull the common functionality into a 3rd C# solution, referenced by the two products. Could I somehow do this using Nuget? We're using VS 2013 Pro, and C# 4.5
|
# ? Nov 2, 2015 18:05 |
|
Yeah. I'm not 100% sure on the best way to go about it, but we do something like that. There is a common code solution and the projects in it get built as nuget packages. We host those on an internal repository. Right now we only have one other solution that actually uses those packages, but in theory there could be more. You'll want to make sure the debugging symbols are exported as well, so that you can step through anything from the nuget package. I'm not sure if we're doing that strictly through nuget... I just know they're hosted on the same server as our internal repository. I could take a look tomorrow and figure that out though.
|
# ? Nov 2, 2015 18:40 |
|
Does anybody know if Mono can run on FreeBSD (specifically, FreeNAS)?
|
# ? Nov 2, 2015 19:20 |
|
zerofunk posted:I could take a look tomorrow and figure that out though. That would be awesome, thanks. I'm randomly googling, and it seems like the opportunity and technology is there, but I'm not quite sure how to go about doing it.
|
# ? Nov 2, 2015 20:11 |
|
NihilCredo posted:Does anybody know if Mono can run on FreeBSD (specifically, FreeNAS)? Technically you should be able to, but it's maintained by third parties. I asked the runtime team here if anyone has tried it on BSD and no one has in our office, so... yeah, it should work, maybe.
|
# ? Nov 2, 2015 20:15 |
|
epalm posted:We have two C# solutions with a small but growing overlap of features. I want to pull the common functionality into a 3rd C# solution, referenced by the two products. Could I somehow do this using Nuget? There's packages inexplicably failing to restore, NuGet barfing its files all over your projects, everybody being required to do the exact right thing w/r/t source control to not horribly gently caress things up, stuff "magically" working when you build with Visual Studio but not with MSBuild, etc. It's supposed to make dependency management a non-issue, but, at least for me, it has so far been the exact opposite. Personally I continue to use lib folders for seldom updated libraries and direct project references for stuff that is actively changing - just because code is shared doesn't mean you can't include the same projects in multiple solutions directly. Anything only available from NuGet is downloaded once and then stuffed into a lib folder under source control. These approaches might not be "sexy", but they are far more reliable and straightforward to troubleshoot should anything be amiss.
|
# ? Nov 2, 2015 20:48 |
|
SirViver posted:In my honest opinion - and take it with a grain of salt, as I have by choice only minimal exposure to NuGet - I've so far found every interaction with NuGet, except for the initial installation of a package, to be an absolute pain in the rear end. And I haven't even installed packages with notable dependencies. Nuget can be a pain in the arse, but in my opinion it's still superior to lib folders and shared csproj files. I would absolutely go with nuget packages for sharing internal libraries between solutions. Paket (sort-of nuget replacement) can help with the dependency hierarchy / conflicting package version issues but has it's own problems
|
# ? Nov 2, 2015 21:24 |
|
NuGet works great for small projects. Doesn't scale to large complicated projects at all. .NET needs a maven-like and NuGet falls far short. Its actually kind of worrisome that Microsoft is moving forward with .NET Core and having a lot of dependencies in NuGet now.
|
# ? Nov 2, 2015 21:39 |
|
Our standalone Lib folder is like 3GB, I hope someone figures out non-lovely nuget soon.
|
# ? Nov 3, 2015 01:53 |
|
My understanding is there are political issues around NuGet at Microsoft that make it difficult to understand who is really responsible for fixing it (let's not mince words, the VS2015 version is broken) and what NuGet is supposed to actually be responsible for in your project.
|
# ? Nov 3, 2015 03:03 |
|
|
# ? Jun 7, 2024 02:15 |
|
NihilCredo posted:Does anybody know if Mono can run on FreeBSD (specifically, FreeNAS)? Probably, I have it running on Open Indiana ( Solaris ).
|
# ? Nov 3, 2015 08:24 |