« first day (1442 days earlier)      last day (2707 days later) » 
00:00 - 15:0015:00 - 21:00

3:01 PM
@Julien whats your constraint in that explorer view? only go as deep as the file's path is?
 
yes. any file passed in should result in every directory that file is in having a VM that shows in the tree view
so if i pass in c:\x\y\z\myfile.exe
 
bye
 
c:\ and x and y and z all show up in proper tree form
 
bye @Markus
 
See ya Markus
When you do a RemoveRange, it'll blow up if your list is empty. Assumed that it's like a DELETE on the db; if nothing to delete, it doesn't complain. It makes sense, though
 
3:14 PM
it's annoying to have to check for emptiness
 
Yep. IF statements clutter up the code. Wish there was some built-in way, like the new someObject?.SomeProperty way to protect against nullness (new word!)
 
empty is not null
 
You're right
 
did you mean null ?
blowing up on null is more normal than blowing up on empty
 
Nah, got the two mixed up... like a first-year comp sci student
It's choking on empty list, not null
 
3:17 PM
:(
have you heard about the option type ?
 
So, not a biggie... just added an Any() and moved on
@franssu No, what is that?
 
you don't want to know
 
:)
 
if you're satisfied with someObject?.SomeProperty
 
Yeah, for the nulls, that works fine. For the empties, I'm using .Count > 0 and .Any() in different places. Not sure which is better
 
3:20 PM
same imo
I prefer .Any()
 
Yeah, using more of that these days. Just more concise and brief
Interesting. Just reading how there's no built-in equivalent of Linq in Java.
Love me some C# :)
 
when you'll learn F# it'll blow your mind
 
My next goal is TypeScript!
And I have F# on my radar too. Reed is a huge fan, I think
 
do yourself a favour and learn an other paradigm
going home, cu!
 
3:35 PM
did we get the picture from @franssu?
did we get the picture from @franssu?
 
@franssu It is so funny to me that you wrote "cu" instead of "see you"
Because cu in portuguese means assh*le
 
Needed that laugh, Andre
 
:D
 
lmao
 
If a method is expected to return a bool but in its catch block calls throw; and can't reach the return false;, is that good programming?
 
3:42 PM
@Julien I did that before... are you having an issue?
 
That usually means that you're in rush
 
the tree/explorer thing
@Alex if there is no way to recover, then sure.
 
Yeah, it's going to then email stack trace to me
and close the app
 
@Kevin no issues, just want to see how it could be improved
i feel like the code is terrible
 
if its fatal, then definitely
 
3:44 PM
And I don't want to swallow the exception. That's really bad
Yeah, this would be fatal
 
@Julien I thought the same thing... just seemed messy and a lot of work
 
3:59 PM
I'm using this CellTemplate to generate a mailto link in a ListView. It works fine on my machine -- launches a new email in Outlook. I'm admin on my box. For the non-admin user, it does nothing:
<GridViewColumn Width="195" Header="Email">
	<GridViewColumn.CellTemplate>
		<DataTemplate>
			<TextBox Background="Transparent"
					 BorderThickness="0"
					 Cursor="Hand"
					 Foreground="Blue"
					 IsReadOnly="True"
					 Padding="5"
					 Text="{Binding Email,
									Mode=OneWay}"
					 TextDecorations="Underline">
				<i:Interaction.Triggers>
					<i:EventTrigger EventName="MouseLeftButtonUp">
						<ei:LaunchUriOrFileAction Path="{Binding MailTo}" />
					</i:EventTrigger>
				</i:Interaction.Triggers>
Is it a permission thing?
MailTo looks like this: mailto:someone@domain.com
 
does non admin user have default email client set up?
 
4:17 PM
Alex: i dont think it's a non-admin issue
 
wow that is super short
 
Julien -> since you want a hierarchical thing, your viewmodel should be doing the same - so i've encapsulated the functionality inside the Vm. Also you don't want to do evaluations eagerly - this Vm implementation will enumerate only when you actually pull it
since the Vm is double linked - you can go as many times backwards and forward as you need
 
never seen .Dump
 
i'd also implement IEquatable on FolderVm
this is a Linqpad copy paste -- .Dump comes from there
copy paste it and run it to see what it does (by default linqpad will do eager eval 3 levels deep)
 
i dont know what you mean by it comes from linqpad
it's not a standard .net thing?
i am trying to run it through vs
 
4:26 PM
.dump is linqpad.
 
@Maverik but this isn't right? it's not hierarchical. pathSegments.Select(x => new FolderVm(x)); returns an array of 5 items, it should be one item with a subitem with a subitem with a subitem, and it shouldn't have any files in it
and this is also creating new folder vm each time, as opposed to finding an existing one. if i called this method with two different files in the same folder, it would create two identical folder vms
 
4:42 PM
@Julien FolderVm itself is hierarchical - pathsegment stuff is only there to ensure i only traverse the path back to file
you shouldn't need it if you're implementing a dialog of Select Folder kind
 
end goal is <TreeView ItemsSource="{Binding Folders}" />
 
and you get that from this
 
i dont see how
 
i'll leave it as an exercise for the reader ;)
if you can't see how, you're not understanding the code - foldervm creates foldervm - the only quesiton is what level do you start at - thats completely upto you but you could start at any level vm and it'll keep expanding if there's something to expand on
for example FolderVm("C:\\") could be your Folders
and you'll start traversing from there - your HierarchicalDataTemplate will expand based off FolderVm.Children
 
Hey all. I'm working on an attached behavior for a Panel control that will allow a user to drag the controls contained within, in an Andriod or iPhone style, to rearrange them. This means manipulation of the control's current location within the panel. Am I better of writing a derived control?
 
4:49 PM
no idea!
but there's almost always a way that doesn't involve derived controls just for layout
I have an android - and if you're thinking like rearranging the hot tiles - you're really using 2 things: Drag & Drop + Index adjustment in collection
 
I'm working with the idea of changing the contained contorl's margins
 
i dont know why you'd want to do that
but i'd use a WrapPanel + Drag&Drop to do Index Adjustment
 
@Maverik, agreed. And that's the approach I am currently working towards. The problem is mostly with the intermediate step; the time when the user is dragging. I'd like to animate (well, maybe not actual animation, it could be instantaneous) the movement of the other controls.
That's pretty much what I am doing...
 
animation - i've never really done that so can't help there
but bright chance that you dont need to subclass things for it
 
5:22 PM
Maverik, if this isn't permissions, any guesses what it is? chat.stackoverflow.com/transcript/message/33198103#33198103
Not a biggie, though. Will provide a TextBox where the user can copy email
 
5:36 PM
Alex normally it'd be an issue with the users config
 
Hmm. You mean in Outlook?
 
unless Windows10 has decided to apply stricter mailto permissions - i'm not aware of such a case yet
no can the use manually engage the mailto: protocol from Run box?
 
I'll have to try that Monday when she returns
Thanks, Maverik
 
np
 
@Maverik just can't get it working mav. it's iterating through folders that have nothing to do with what im passing in. an initlal path of c:\temp\myfile.exe throws an access denied error on C:\documents and settings
its trying to find all the folders, regardless of whether or not they relate to a file thats passed in
 
5:46 PM
thats expected at siblings
its only looking at siblings.. if you dont care about siblings, comment it out
 
i did remove siblings
its this line throwing the error
public IEnumerable<FolderVm> Folders => Folder.EnumerateDirectories().Select(x => new FolderVm(x.FullName));
happens when i try to expand C:\ in my treeview
 
ah i see
may have to override that implementation and swallow xD
blame it on .net
 
sure, but htis method would give me all the folders under c
i only want the folders that link to the file passed in
 
dont enumerate anything
just use segments & directly change them to a FolderVm combined with absolute path using previous segment
sorry I dont think i'm properly following what you're doing
 
but it needs to do a lookup to see if that folder is already created
 
5:49 PM
why?
 
so that if two files get passed in that have the same parent directories, it uses the existing one
 
ok add the check then?
i obviously dont have all the specs of what you were trying to achieve - i just thought i'll try and give you an alternate approach
 
that is basically what my original code does. it gets a path, and then does recursive lookups until it finds an existing folder vm
 
hmm
 
so you pass in one file, all the folder vm's get created once and only once. if you pass in a file in the same directory, nothing would happen
 
what. im not making folders
im making vm's that represent folders that hold files that have been passed in
lol
 
ah
i think i'm too tired to help :(
 
my original code is so bad no one can understand it lol
 
sorry i'll stop bugging
 
i love the approach
 
5:53 PM
well i hope you can mimic it with your objectives
it shuold be doable but may need to sleep on it over weekend :D
PS: Julien have you done a Lazy evaluating Reactive Generator ?
I want to give a factory method to pull data - but not evaluate until I ask for it
 
i understand half that sentence
especially the Julien part
with DD you can config your filters/sorts/pages, but you get no data until you call connect
doubt that helps you though :P
 
Do you like this documentation?
 
6:10 PM
Nice job, Johan
 
you are always so positive, I don't trust you :D
 
One sentence under Motivation... maybe reword to this: This is the most common convention. It compensates for the WPF API, which lacks many conventions necessary for correctness and maintainability.
Further down, "rule set" is probably one word
Not to be picky, but one more :)
A dependency property's backing field name does not match the pattern Name. Added possessive 's to property
Looking at this example on how to update an OC item: stackoverflow.com/a/6781292/177416
 
@Alex thanks!
 
You're welcome
How do you update an item in an OC used for a ListView?
 
you have the item implement INPC
 
6:24 PM
Using this but the item isn't refreshed in the LV
var pt = PersonnelTechs.Result.FirstOrDefault(t => t.PersonnelTechId.Equals(obj.PersonnelTechId));
if (pt != null)
{
	PersonnelTechs.Result[PersonnelTechs.Result.IndexOf(pt)] = obj;
}
 
does setting that property trigger INPC?
 
Let me check
 
@Alex that is going to be expensive if the collection is large
 
Stupid question: Does an OC need the OnPropertyChanged?
 
OC's dont have properties
the items within them do
 
6:26 PM
OC notifies about two properties, Count & Item[]
 
@JohanLarsson Less than 20 PTs :)
public NotifyTask<ObservableCollection<PersonnelTechViewModel>> PersonnelTechs { get; private set; }
That's the OC, made up of VMs
 
never seen NotifyTask
what does that do
if your items aren't updating, the problem is the item itself, not the collection holding it
 
It runs async ops for you and triggers events to let you know when it's successfully completed
 
cool
 
Some docs on it
 
6:31 PM
too fancy for me lol
 
@Alex I feel you're trying to do:
if(PersonnelTechs.Result.Any(t => t.PersonnelTechId.Equals(obj.PersonnelTechId))
    PersonnelTechs.Result[PersonnelTechs.Result.IndexOf(pt)] = obj;
pt will need replacing but I wanted to suggest .Any() :)
feels like this can be cleaned up more
but i dont have enough context to do it
 
Hmm
 
also what is that NotifyTask<ObservableCollection<PersonnelTechViewModel>> <-- feels wrong
 
Yeah, I thought my code was doing that
 
it probably is but in a round about kinda way
 
6:37 PM
for loop it imo
 
my guess is you basically want to do a dictionary look and you want to be sure your key exists
 
Yep, replace existing item with updated one
 
you could just do PersonalTechs.Select(x => x.Result).ToDictionary(x => x.PersonalTechId, x => x)
then do a dictionary.ContainsKey(obj.PersonalTechId) and replace?
your intent is far clearer like that
if your id isn't going to be unique, you can instead use ToLookup
 
This'll require some refactoring. It ain't working right
 
actually i'm still confused about your code sample
its cryptic!
(i know what you wanna do - but having hard time following your code with the intent)
 
6:42 PM
So the items in the LV have an [Edit] button, which launches a dialog. In the dialog, the user can edit a PTVM and save, which writes to the db, sends a message back to the parent VM and closes the dialog.
The parent VM holds the OC. So I'd like to update that one item that was saved
And my code is definitely cryptic :)
I get lost in it sometime
 
LV should update the item by itself if you update property with INPC raised
 
6:59 PM
Interesting. Actually, most everything is updating in the LV, except the column that has its own OC
I think I know what's going on...
 
7:14 PM
Yeah, it's an inner OC that's causing the issue.
 
7:51 PM
Each row of the LV has a PersonnelTechViewModel, which in turn contains this:
public ObservableCollection<CostCenterOrgUnitViewModel> CostCenterOrgUnitVms { get; set; } = new ObservableCollection<CostCenterOrgUnitViewModel>();
That's the OC that's not being refreshed in the row of the LV
 
you aren't being very clear
are you adding items to an OC and the new items aren't showing up
or are you modifying an element inside an OC and expecting updates that don't happen
 
OC.OC.Item.x = 1 or OC.OC.Item = 1
 
It's complicated and I'm not being clear!
 
one or the other :D
 
if you are changing a property on an item, and that change is not propagating to the UI, chances are it is an INPC error
the fact that an item is in a collection doesn't mean much
 
7:54 PM
yup
 
if you pulled that object out of your OC and bound to it directly, i bet you would have the same problem
 
There's a parent OC that populates the LV. Each parent has a child OC. That's not being refreshed until I close the app and reopen
OC.OC.Item.x = 1
Hmm
 
the fact that Item is in an OC shouldn't matter at all
cough fody cough
 
:)
Love it!
My brain is deep fried right now
What doesn't make sense is the other items in the row update just fine. The child OC doesn't. Must be something about how I'm binding to it
 
the other items in the row probably trigger INPC
 
8:03 PM
Yep
 
8:14 PM
also Alex, dont' have set; on an OC accessor
it should always be readonly unless you have to have it (in which case put a comment to say why it shuold be the case and add INPC to it)
my guess is you're replacing the OC killing the binding
(since your OC has no INPC on it yet has a setter)
 
public ObservableCollection<CostCenterOrgUnitViewModel> CostCenterOrgUnitVms { get; }
So that^?
 
yup
public ObservableCollection<CostCenterOrgUnitViewModel> CostCenterOrgUnitVms { get; } = new ObservableCollection<CostCenterOrgUnitViewModel>();
anytime you need to break that syntax, you should either rethink your design or add an INPC into it
keeping it with a get only accessor will ensure you don't accidentally replace OC and see the effect you're seeing right now
also, too late to stay in office on friday (or any other day for that matter!) -- I'm gonna head home
have a nice weekend guys and catch you monday probably :)
 
See you, Maverik. Have a great weekend!
 
cheers :)
*poof
 
Added INPC to the OC and that solved it! Whew.
 
8:36 PM
E.llo
 
lol howdy johan
 
00:00 - 15:0015:00 - 21:00

« first day (1442 days earlier)      last day (2707 days later) »