« first day (1619 days earlier)      last day (2530 days later) » 

5:33 AM
Welp, screw this bs. I've been trying to get sqlite running for 2hrs now
1) I had to rework my project structure because nuget has issues with linked app.config
2) once thats done I installed the required packages though nuget
but thats not enough, according to this article you also have to install the bundle
so I grabbed http://system.data.sqlite.org/downloads/1.0.104.0/sqlite-netFx46-setup-bundle-x‌​64-2015-1.0.104.0.exe and now, instead of not having the SQLite option in the data sources, the ADO.Net option isnt present at all...
how is this so complicated...
Oh
well
Turns out you need to have EF 6.0.0 specifically
I had upgraded to 6.1.3
</rant>
 
 
11 hours later…
4:13 PM
@Borgleader paket is less broken than nuget
 
@JohanLarsson Never heard of it, I'll check that out.
 
there is a vs extension for it that is not very nice
 
Is R# available only on a 30-day trial version?
 
I usually use commandline with it
@SteffiKeranRaniJ not sure how you mean, you can pay for it also
@Borgleader @Puppy try this and this
The first is pretty stable, don't trust the warnings & fixes in the second blindly. Write issues when you find dumbs.
Also ask if you have paket questions, hopefully I can answer them
Paket is nice in that it figures out max version of things when upgrading
 
 
3 hours later…
7:16 PM
@JohanLarsson Why? I've got no interest in using WPF at all
 
Not maintainer of that app?
second has nothing to do with wpf
 
Hi there
As someone a minute to discuss a small problem with a possible binding mistake?
Has*
 
Ask and wait is the best strategy
 
I dont wanna bother you guys. I dont know the chat rules, thought
But anyway:


Hi all!
I dont want to post this on StackOverflow, since it isn't such a huge problem.
I would like to change the color of an ellipse, based on an int value. (Bigger than zero red, less or equal to zero green)

So far so good. I made a IntToBooleanConverter, which is just return ((int)value > 0). The xaml looks as follows:

<Ellipse x:Name="ellipse1" Fill="Green" RenderTransformOrigin="0.5,0.5" >
<Ellipse.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
 
Why IntToBoolConverter?
 
7:25 PM
For the DataTrigger
The dataTrigger only accepts a "value". I cant use a predicate there
 
Why not bind the Fill with IntToBrushConverter
hold on, I'll whip up a sample
 
w8. I didn't think abou that
I will try it asap
ok, it works
Thanks... Why didn't I came up with this? I overthink sometimes, I guess
But anyway. Why does my original approach doesn't work? Is there something wrong with the DataContext in the Ellipse.Style? Isn't it the same as in the <Ellipse?>
 
try this:
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Markup;
using System.Windows.Media;

[MarkupExtensionReturnType(typeof(IValueConverter))]
public class SignToBrushConverterExtension : MarkupExtension, IValueConverter
{
    public Brush WhenPositive { get; set; }

    public Brush WhenNegative { get; set; }

    public override object ProvideValue(IServiceProvider serviceProvider)
    {
        return this;
    }

    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
Use it in xaml like this:
<Ellipse Fill="{Binding Number,
                        Converter={local:SignToBrushConverter WhenNegative=Red, WhenPositive=Green}}" />
@ThomasChristof You have Fill="Green" rendering the trigger useless
Should be <Setter Property="Fill" Value="Green" /> in the style
Also normally you just have a trigger for one of the cases but nothing wrong with what you have I guess
Just a bit noisy and harder to see what is going on
If you bind the fill converter you can remove the style altogether
 
@JohanLarsson Thanks for the example. I already did the same. But with the help of your example I can make it more "flexible" with the properties. Didn't know that you can set properties in a converter
 
And if you use the markupconverter you will even be able to see what is going on in the xaml :)
 
7:41 PM
awesome. Thank you very much
 
np, now you have to stay and lurk for a week :)
@ThomasChristof I did not run it but it should work
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
    if (value is int i)
    {
        return i < 0
            ? this.WhenNegative
            : this.WhenPositive;
    }

    return Brushes.HotPink;
}
is probably a better implementation of the convert method, uses C#7 features
 
The concept is enough. As "newcomer" it is hard to get the right approach sometimes. Because there are so many possible ways to implement stuff with wpf
haha. Nice use of 7.0
 
finally
 
A converter should probably not crash the app
 
return (value is int) ? i < 0 ? WhenNegative : WhenPositive : Brushes.HotPink
 
7:45 PM
@Puppy what?
 
if (value is int i)
I've been using if(auto value = f()) in C++ for years
 
oh, yeah it cleans things up
I don't like that i is scoped as if it was written on the row before
same with inline out variables
 
well, i.getType.equals(... was still possible
 
you could use nongeneric comparer I guess
to handle doubles tec.
treat the sample as pseudo code
 
8:33 PM
@Puppy you should start using wpf and ask noob questions :)
would be fun
 
I believe that I intend to never, ever use WPF for anything
 
cos desktop?
 
cos by all appearances it's utter crap
 
is there anything better?
 
probably not
that's why I'm writing that library
 
8:35 PM
is wide dead?
 
eh
yes
MinGW was just so much crap, and Linux was just as bad
maybe if the Clang integration for MSVC works now I will revive it
 
have you tried f#?
 
no
nor do I have any particular interest in trying it
 
was just curious, no reason
The roslyn analyzers for IDisposable are pretty interesting, maybe we will see you as a contributor in the future.
Plenty of things to flame in the code :)
I need to split them out into a separate nuget.
 
9:15 PM
Where when using MVVM should I define what my listitems look like? Right now I have each item as a viewmodel so it has a corresponding view. However, I'm pretty sure this is the wrong design. I should have a ObservableCollection<Model> NOT what I currently have (ObservableCollection<ViewModel>).
 
> should I define what my listitems look like
I don't understand that part
If it is possible to bind directly to the model I always do that.
But if you need to add commands etc. you probably want an ObservableCollection<ViewModel>
I often do:
public class ViewModel
{
    public Model Model { get; }
    ...
}
 
Hmm, alright
By what my listitems look like, I mean how they are displayed in the view
 
styles etc?
 
that is neither model nor viewmodel's business
Do you know about ItemTemplate?
 
9:23 PM
Yeah
that's what I'd have to use
 
ok, just checkin'
yeah, sounds right
 
I like your idea about just having the viewmodel contain a model, then having the observablecollection<viewmodel>
 
there is also an ellipsis, representing commands and other stuff
 
But it's also possible to just keep track of the 'currentmodel' in the viewmodel that has the observablecollection then have the commands in there
 
if it is just one property Model I'd expose the raw models to the view
@KristopherRuzic SelectedItem?
 
9:27 PM
Yeah exactly. csharperimage.jeremylikness.com/2010/04/… if you scroll down on here a bit you'll see what I'm talking about (ctrl+f "ContactViewModel : BaseINPC")
I'm just trying to get a nice design and use models and viewmodels properly
 
public override int GetHashCode()
{
    return FullName.GetHashCode();
}
ew, calculating hashcode from mutable members
don't trust that blog imo
public ObservableCollection<ContactModel> Contacts { get; set; }
mutable without notifying, not a good idea
 
just skimmed it but I don't trust that guy now
Aiming for using patterns is usually a bad idea, I don't mean to sound negative. Don't know how to word it.
Keeping things small and simple and refactor as needed is usually best.
Reading about patterns and code in general is not bad though.
be suspicious about everything ~enterprise~
often it means massive bloat with code that does not do anything
speculative flexibility and noise in general
 
9:43 PM
You're right.
I'm not sure why I want to refactor it
 
> if you code for simplicity, you get flexibility for free. if you code for flexibility, you get complexity for free.
nice quote
 
I guess I feel its messy and some of my names are confusing.
 
there may still be a need for a refactoring
is the code huge and can you share it?
I'm about to goto bed
 
10:42 PM
Sorry
it's not huge, just a few lists and views
 
11:21 PM
0
Q: Prism Region Switching and Synchronizing with Container Instance

Moe45673I am working in WPF with a MainWindow that has a (Prism) region "MainViewRegion". This switches based off the User's desired view and when it does, the MainWindow resizes to snap to the new dimensions of the embedded view. I have some code to keep the window fully visible on the desktop after th...

 

« first day (1619 days earlier)      last day (2530 days later) »