« first day (1467 days earlier)      last day (2682 days later) » 

6:29 AM
'morning.
 
7:08 AM
morning
 
7:37 AM
morning
 
Good morning
 
7:56 AM
morning
 
 
2 hours later…
10:02 AM
Let's say I have a VM with a boolean property "MyProperty", in my view, I have a ContentControl, to change the template of the ContentControl, I used 2 DataTriggers bound to "MyProperty"
in the first DataTemplate, I have a textbox, in the second I have a button
now, to bind the button or the textbox, I used this code :
DataContext="{Binding Path=DataContext, RelativeSource={RelativeSource AncestorType={x:Type ContentControl}}}"
it works, but, I don't like it, is there more elegant way to do this ?
 
You should use Content property of ContentControl
<ContentControl Content="{Binding MyProperty}" Style="{StaticResource ButtonOrTextStyle}" />
Inside template you should have the DataContext == MyProperty
 
molto bene
thanks alot @NovitchiS :D
that's elegant :D
 
If it works :D
 
tested, and it works
 
You're welcome then, i haven't written wpf in a wile.
 
10:12 AM
Are we losing you to web stuff?
 
I have submitted my chess app to Windows 10 Store yesterday, still in publishing state...
I think i like web and mobile better, there is so much new stuff going on.
Am I getting kicked off this room for saying that? :)
 
no :)
 
 
2 hours later…
12:01 PM
Hi all
 
12:25 PM
[MVVM; WPF]
Hello there,
I have a models with one-to-many relationships (a room has several "Places" and a place has several things), and I implemented the DataAccess-Layer, and got stuck in the ViewModel implementation: So A `RoomViewModel` would have a `PlaceRepository`and collection of Place*ViewModels*, but where's the responsibility for the transformation from my *model* `Place` to my *ViewModel* `PlaceViewModel`. Should the constructor of my `RoomViewModel` automatically do that?
 
@user3698624 That sounds about right. However, I'm relatively new to WPF. You'd want to also hear from the experts here :)
 
@Alex yeah, I read that in mvvm, the ViewModel should contain much logic
 
I think you're mixing up your layers here.
Assuming you're using "Repository" here as the term for the object in charge of accessing your data layer.
I would expect a Room to have a collection of Places, each of which has a a collection of Things.
And a parallel relationship between a RoomViewModel, PlaceViewModel and ThingViewModel.
 
yep, A RoomViewModel has a collection of placeviewmodels
but how does a roomviewmodel get the ViewModels of my model "Place"?
 
Ah, I see. Well, there are several approaches. The simplest is in the RoomViewModel's constructor, as you said. It's a common pattern.
 
12:34 PM
I wud do this with sth. like PlaceRepository.GetAll().ForEach(x => new PlaceViewModel(x, placeRepo))
ok, good, thx!
 
No, that seems a bit too coupled between DB and VMs.
 
because my viewmodel has an instance of my repository?
 
Yeah.
You're a single-tier app? No server-side?
 
WPF Desktop Application, "Smaller kind" but wanna do it right (internship)
 
Even then, I would have a logic service - say, the RoomService - which is in charge of handling rooms. So my MainViewModel would access the RoomService.GetAllRooms(), which will return a collection of Room, each of which has list of Places, etc. This is the logical data model.
Regardless of what you want to do with them. If you have a function that has to return aggregated statistics of things in each room, for instance, you'd only need to call that, no ViewModels necessary.
However, if you do want to create a view model for each room, you'd simply do that (_roomService.GetAllRooms().Select(room => new RoomViewModel(room)), for instance)
 
12:38 PM
My Repositories do exactly that like the RoomService, RoomRepository.GetAll() etc,
 
If you're just using this room in a screen where you're showing general room details, you might not even want to create viewmodels for each Place. You might only want to do that if you're opening a PlaceList dialog, for instance. Or, if you do need them immediately, you can create the list of PlaceViewModel in the RoomViewModel's ctor.
Now, this might cause issues in some scenarios. Why? Because if you have two different places in code that create PlaceViewModels from Places, then you have two different instances of a PlaceViewModel that might refer to the same Place.
 
thx! I need to display it all (Navigating a list of rooms, which shows the places, and when you select a place you see a detailview of it's component/things)
 
12:54 PM
waves
 
Elo
 
'ello
bit 'o cockney 'n 'at?
 
stares blankly
 
I think that we should take a poll... who wants Mav to record an audio clip so that we can find out what his english accent actually sounds like?
 
lol
no!
 
1:00 PM
Hahahaha
 
nobody in my life has been able to place my accent anywhere in the UK yet :)
 
laugh
 
[Flags]
public enum RoleFlags : long
{
    CreateCompanies = 1 << 0,

    CreateUsersForCompanies = 1 << 1,
    CreateUsersForOwnCompany = 1 << 2,

    ReadAllTradeItems = 1 << 3,
    ReadNonDeletedTradeItems = 1 << 4,
    ReadPublicNonDeletedTradeItems = 1 << 5,
    ReadCompanyTradeItems = 1 << 6,

    CreateTradeItem = 1 << 7,
    CreateTradeItemForOwnCompany = 1 << 8,

    CreateRoles = 1 << 9,
    AssignRoles = 1 << 10,

    UpdateAllTradeItems = 1 << 11,
    UpdateCompanyTradeItems = 1 << 12,
I'm starting to think I should come up with a better way to handle user roles/permissions. :P
 
I've seen some systems implement perms via membership in groups. Then the user just has a list of groups that they belong to.
It's sort of similar to roles.
Usually roles a single item. Select a role for this user, and they'll get these perms.
This would be more along the line of "Add the user to the Roles admin group, and they get Create and Assign privs."
 
That makes sense
 
1:17 PM
I've personally leaned towards enum based roles/permissions
(roles are just enum flag groups that can be defined in the same enum)
but i believe the biggest enum is 128 bit via BigInteger
 
FWIW, I'm partial to enum-based permissions as well.
 
@WilliamMariager SharePoint 2003 had a 32-bit-Flags-Enum-based role system. They ran out of address space at some point, and SharePoint 2007 switched it to 64-bit-Flags-Enum.
However, while they changed the COM based API to support it, they didn't get around to changing the SOAP API, which still worked, but only for the lower 32bit of permissions.
 
@Maverik I thought BigInt had an arbitrary size. Or was 128 just the highest you've used?
 
I don't think you can base an enum off of a BigInteger.
Only on actual numeric types.
 
@WilliamMariager turns out you can't use BigInteger
you can only inherit from value types for enum
 
1:22 PM
Yeah, I thought you meant an implementation that was similar to an enum. :)
 
oh in that case BitArray
 
Oh, how have I never seen BitArray before...
 
doesn't get used a lot
but bit array is a an array of bools essentially but its a lot more efficient at bitwise operations / storage (if memory serves)
i'd use a static class as enum with bitarray as backing storage for it
that way you can still have the nicer names like enum and if you know the enum value then you can jump to that by bitarray index
 
@Maverik Yeah, it's a bit array of arbitrary length that uses ints as the underlying storage and bit operations on them. That way you don't have to use, at the bare minimum, an 8-bit byte for each bit.
 
yup, thanks for the proper explanation :)
 
1:39 PM
@WilliamMariager exceeding 64 permissions in an enum can also mean you need to rethink your permission grouping strategy. in your example, you have permissions for users and permissions for trade.. possibly permissions for administering a company
they should be split into their own permission sets
also, don't use long as enum base - use ulong unless you have a reason to go into negative range
 
@Maverik Reason I'm using long is because it's mapped to an SQL server, which doesn't have ulong, so I wanted to avoid potential issues.
 
just use a converter
 
And yeah, there are some candidates for better sets. Like, mainly people will only have access to their own company. Having access to all companies might just be a flag on its own, which then enables all the other flags across companies.
 
permissions system has always had these issues
    but for going to sql and coming back i just use:

         public static ulong ToUlong(this long x)
        {
            unchecked
            {
                return (ulong)x;
            }
        }
        public static long ToLong(this ulong x)
        {
            unchecked
            {
                return (long)x;
            }
        }
of course that assumes I'm guaranteeing nothing stupid will get through with these casts and in my case that holds true :)
 
Right, I forgot unchecked would remove issues.
Unrelated, but I got Application Insights set up. It's very satisfying seeing the statistics, like response times, requests per second, etc.
And it even has a live monitoring section.
 
1:52 PM
:)
 
Learning how to use Azure is challenging though. :P At this point it works, but some parts are still pretty magic to me, since Visual Studio took care of a lot of it for me.
 
Not sure if all the automated stuff is good or bad, especially when starting with a technology. I'd prefer more manual control to know what's going on behind the scenes.
 
Yeah, I feel the same. I really don't like when I don't know what's going on. But on the other hand, it helped me get started without too much hassle.
I have no idea how much it's costing me at the moment though since it just picked whatever it needed to make things work. Just waiting for the first invoice. I get the first $150/mo for free though, and as far as I can tell, I should still be within that.
 
Sometimes it's good to get up and running quickly. Years ago, would use Dreamweaver for layouts before understanding HTML. Later, learned HTML through the tool and other resources. Now I prefer the code view always in VS
 
Hehe, I had the same experience with XAML. I love the visual designer because it gets me started. But I rarely use it now.
 
2:05 PM
Yeah, and I couldn't get used to Blend at all. Tried it a few times but too used to code view in VS. XAML is so much like HTML anyway
 
I never actually used Blend. I saw it got installed in some previous versions.
 
 
2 hours later…
3:48 PM
WpfFarmer.ReleaseCrickets(5);
chirp chirp
chirp chirp chirp
chirp
Oh oh. Bug in WpfFarmer. Released one too many crickets.
 
:)
 
Hi franssu
 
WpfFarmer.ConvertTo(typeof(ReligiousNut)).ReleaseLocustPlague()
 
Hmm. Not too far off from that considering the world right now
We must learn to live together as brothers or perish together as fools. --Martin Luther King, Jr.
 
4:04 PM
M. L. King never expected to get laid with a brother i guess
 
is there anything specially wrong with the world today ?
 
Nah, nothing more than normal. It's just interesting here in the U.S.
We've found ways to hate each other in so many unique ways
 
why do you say that @franssu ?
 
Might be my quote about brotherhood.
 
@Alex you're about to elect a president based solely off hatred towards others -- that takes the cake imho :)
 
4:11 PM
Hi all :)
 
Hi
 
@Hamza_L because Alex said "considering the world right now"
 
Ah, sorry didn't read, I think it's time to go back home
 
see you
hi @AndréSilva
 
I wish I could get some energy drinks delivered to my house :(
 
4:16 PM
@Maverik Couldn't agree more
 
@AndréSilva why ?
 
Because I'm a bit sleepy, couldn't sleep well due to a headache
 
don't you drink tea / coffee ?
 
No tea in my house and the only coffee I have here are those capsules and are really weak
because my parents don't like strong coffee
 
I can't function w/out caffeine... tea
 
4:19 PM
energy drinks are bad for you, m'kay ?
 
Meh, being healthy is no fun
 
Has anybody run into an OutOfMemoryException on nuget client 3.4.4 ?
it appears that dotnet.myget.org nodes have different caches internally and depending on which node you drop on (it changes on each query), you can get different results at different times
so nuget keeps pulling down package information because it thinks its a new dependency and goes into infinite loop until there's no memory left
 
That is dumb ._.
 
they've dropped a fix in Nuget 3.5.0-rc1-final
I've picked up the nightly nuget 4.0.0.xx which also works just fine
 
so... I was watching Nestle's CEO saying that their water market share was "a drop in the ocean, 0.0009%, so even smaller than a drop"
I had to do the maths
0,0009% of the ocean = 10 millions of billions of litres
that's a big drop
 
4:34 PM
Well it is Nestle.. for what they want, what they have is really small
 
never enough
but I like the fact the CEO was off by 10^16
 
Sometimes I hear Frankie Boyle jokes on the end of the world being so close and I think to myself "that would take a lot of time for that to happen..."
But then I go to r/worldnews and read the following headline
Russia reveals images of super-nuke "Satan II"
Russia has revealed its biggest ever nuclear missile which is powerful enough to destroy a country as big as France with a single strike.
 
it's under development
supposed to be shiped by 2020
it seems...
 
Well, technology comes for improvement. If they can create that, what would it be able to create in 20+ years..
 
4:50 PM
a missile powerful enough to destroy a country as big as Russia maybe :D
going to play soccer, hope I don't die, see you
 
Haha good game
 
 
1 hour later…
6:19 PM
In case we have a pedant around, should it be space there?
 
I have a ContentPresenter and I pass a RadioButton with one/two TextBlocks. ( ContentPresenter > RadioButton > TextBlock ) I need to change the Foreground of the TextBlock within a Trigger. But TextElement.Foreground does not change the TextBlock directly
Anyone has any idea for what should I look ?
 
should work, paste the xaml
 
<Style TargetType="RadioButton">
    <Style.Setters>
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate>
                    <ContentControl FlowDirection="LeftToRight" Content="{Binding}"/>
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="MinWidth" Value="115"/>
        <Setter Property="MinHeight" Value="30"/>
        <Setter Property="MaxHeight" Value="50"/>
        <Setter Property="Background" Value="White" />
<RadioButton Grid.Column="1" GroupName="myGroup"
             IsChecked="{Binding MyBinding}">
    <RadioButton.Content>
        <TextBlock Text="My Text" HorizontalAlignment="Center" VerticalAlignment="Center" />
    </RadioButton.Content>
</RadioButton>
 
<Setter Property="ContentTemplate">
    <Setter.Value>
        <DataTemplate>
            <ContentControl FlowDirection="LeftToRight" Content="{Binding}"/>
        </DataTemplate>
    </Setter.Value>
</Setter>
^looks weird
 
Damn, I forgot to erase that :X
 
6:33 PM
does anyone have an ideas for my question? stackoverflow.com/questions/40246590/…
 
dunno but have a +1
 
lol alright
 
maybe you should be splitting your text on new lines
and appending the correct UI elements based on the newlines
shouldnt a new line represent a new paragraph
you are just shoving everything into the same run of the same paragraph
 
@Julien I did find a method where someone tries to do this: http://stackoverflow.com/a/7693605/3653277

but.... is this really what I have to do?
 
looks reasonable
whats your beef?
 
6:45 PM
@Julien I have giant documents of text that are already formatted into paragraphs. It seems crazy that you have to parse through that.. just to get it to be compatible? how is there not already some sort of built in function or ability to handle that?
 
splitting a piece of text on new line characters is like 3 lines of code
 
right, but it just seems weird that I have to manually parse like that. I don't only have new line characters to worry about, but paragraph indents as well
Like all the people who make use of openXML have to manually create their own parsing functions everytime they use it?
 
dunno not familiar with openXML
 
me either. lol, I dont like it so far
 
 
3 hours later…
9:54 PM
XAML is not happy with me today..
<Trigger Property="RadioButton.IsChecked" Value="True">
    <Setter TargetName="TitleServerSection" Property="TextElement.Foreground" Value="Gray"/>
</Trigger>
<TextBlock Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" FontSize="18" Text="Title" Margin="5" x:Name="TitleServerSection"/>
Why wouldn't TitleServerSection be recognizable in the trigger ?
 
is the trigger in the style or the controltemplate?
shoud be in the template if you access parts by name
 
<RadioButton.Triggers>
    <Trigger Property="RadioButton.IsChecked" Value="True">
        <Setter TargetName="TitleServerSection" Property="TextElement.Foreground" Value="Gray"/>
    </Trigger>
</RadioButton.Triggers>
Hm
 
at least iirc you can't access parts from the style trigger
 

« first day (1467 days earlier)      last day (2682 days later) »