« first day (782 days earlier)      last day (3367 days later) » 
00:00 - 19:0019:00 - 00:00

19:04
hey @BradleyDotNET !
@BrandenBoucher is the DataGridTemplateColumn inside a DataGrid, or is it in a custom MyDataGrid, or something?
@NETscape It's inside a regular ol' DataGrid
I did find a workaround but I had to create a proxy
f'ing ridiculous
Good afternoon all!
I don't know what CRAZY time zone you're in @MarkW, but it's only 11:15am here.
:)
Central Standard is crazy?
lol
It is when you're from California
lol
Everything revolves around California right?
19:17
unless its an election, then its Florida that matters
no one ever cares about Wisconsin
:(
I do. I here they have great cheese!
and the Packers.
Yes, we do! and cheap beer
lots and lots of beer
is it fizzy yellow beer or good beer?
19:18
the only crappy beer here is stuff thats made out of state
or... BOTH!
lol
I'm gonna hafta visit that state soon
bring a DD
Bit of a drive though from here to there
19:19
so I was wondering if anyone could give me some insight on how to exploit the design view mechanics.
I have a 'master view' sorta thing, with a content area that is bound to a field in my VM
that should update when stuff happens to change the inner view
but im having issues with the damn designer not displaying anything
works great at runtime
so if I knew how the designer loads the components Ic oudl exploit it so that it loads those child views in some default state
and I could actually make use of the designer
HI @NETscape, hows it going?
good luck
@MarkW The designer has... issues
lol yeah it does
Its a lucky day when it does what you want
its not super important, but I just wish it was as easy as using the loaded event, or a nullary constructor
but nope
@MarkW, this is going to be a bit vague but there are design times values you can set
19:22
it hates me
Like there's a whole setup you can do just for test values in your Design panel
it seems to be mostly stuff thats bound to something in my VM... the odd part is if said object is say a string, and is declared at the top of the class with a initial value, it works... but if I set it in a constructor or something it usually doesnt display
usually not fun to set up, but you can use the d flag to mark things as debug only
oooh
19:24
The designer does limited running of your real code
but you have to build first
Ya, that's what I was talking about
and its really sketchy
so using the designer is like buying kidneys from a guy in an alley
gotchya
Also, @MarkW, I've dealt with your issue before and it's a chicken-or-the-egg situation
depending on when you set your View's DataContext = to your VM
I actually set mine up like this:
_viewModel = _container.Resolve<IViewModel>();
_view = _container.Resolve<IView>();

_view.ViewModel = _viewModel;
_viewModel.Initialize();
where my VM's constructor is called, then I set my View's datacontext (inside the ViewModel property I added), then I initialize my VM.
my stuff is much simpler than that
    public MainWindow()
    {
        DataContext = new MainWindowViewModel();
        InitializeComponent();
    }
lol
19:27
That's what I mean. You may want to create an instance of your VM, do some initialization then set your DataContext = to it
in the VM's constructor a new instance of a View is made and set as the value of the property the main window binds on
Im not to worried
I was hoping for a cheater route
its like, I can still edit that child view NP in designer
its just completely absent when I view the main window int he designer
well, I guess that's just the default of how we decided to do things.
Ya, it would be unless it's already created by then or you're using special d stuff
hehe special D
19:30
yep.. Realized that just as I pressed enter
lol
giggles
BTW, I wanna thank you guys who've helped me again. Stuffs coming together now, and apart from the template thing I have to do in the future, it all feels pretty fluid, and fairly well put together
@MarkW where abouts in WI?
what's WI?
@BradleyDotNET comms issues :(
back to figuring out how to do comms without blocking UI
19:39
im in Madison
@BrandenBoucher Wisconsin. you really are a CA folk
do they have Uber?
work out in Ixonia
yes
Ahh, about 45 minutes away!
LOL @NETscape I read your post wrong
19:40
alright
you down in milwaukee ?
I read it as "What about in WI" as if you were referring to Mark's problem in the context of a different framework
@BrandenBoucher Whats the DataContext of DataGrid?
This is kinda scaring me actually. I've been doing that while reading (switching up works) a lot lately
@NETscape The DC is the same as the Window
it's set to the VM
19:42
Unless you set it explicitly
Or any parent is set explicilty
And that changes once you are in the template
@BrandenBoucher and the VM has a HeaderVal property?
hey Reed
@MarkW did you go to UW?
I'm not sure I understand that last question
mine, towards Mark?
yours toward Branden
The Window's DC is set to a VM, if you bind to DataContext.HeaderVal, its looking for HeaderVal is the VM
I'm asking if the VM has a property, HeaderVal
19:51
back
@BradleyDotNET it's set specific but the binding cant even get to the parent
@NETscape, Yep. Added it specifically for the test
To be clear, I mean I added HeaderVal to the VM
in Window, do you have DataContext = new MyVM(); before InitializeComponent()?
Oh I see, you were clarifying with him
We're good now :)
What was your question about comms btw?
hmmm, let me make sure I word it correctly... one sec
Blast, lunch time. I'll read it when I get back :)
20:11
ugh, I might have figured it out after typing it up
still thinking...
20:23
Let's say I have a `CommunicationManager` which returns `CommMaster`s (ICommMaster).
When a user creates a communication profile via the UI, the information in the form (COM Port, Baud, etc., **DeviceAddress**) is passed to the `CommunicationManager` which creates a `CommMaster`.
A user can then click on a communication profile and click a "Download" button.
This should open up a `SerialPort` and perform a `DeviceScan(int address)`.
If a `Device` is indeed found, I'll need to create a new `Device`.
not sure why the formatting isn't working
Eventually, a single `CommMaster` could have something like 10 devices with different addresses. I'll need to eventually implement a way to do something like:
... all 10 devices were found
read 5 values from address 1
update 5 values in `Device` on UI
read 5 values from address 2
update 5 values in `Device` on UI
read 5 values from address n (up to 10)...
etc...
21:17
ok
I get the general idea
so I don't know where I should be creating threads and how communicate between them I guess
Okay
Reading your description, it sounds like DeviceScan would be on a thread
And probably the address query would have its own as well
Both could invoke functions on the model to update it
The "CommsMaster" would control spinning up the threads and such
wouldn't I want to do SerialPort.Write(...) on a different thread?
as well as reading
The Write wouldn't matter to much
Reading is for sure on its own thread
Though the Write shouldn't be on the UI thread
It could be on the thread that is controlling the whole process
right, so CommMaster should be running just about everything on a different thread, or no?
21:33
I would use threads where it makes sense
If an operation is long-running (like reading) it should be on a thread for sure
Or if it is ok to just run and complete on its own, a thread can make sense
But I doubt thats "just about everything"
@BradleyDotNET if you call write, and the port isn't available for whatever reason, and the timeout is 10 seconds... it could block the UI until it times out
the biggest thing is timeouts... and thats what the legacy software has a problem with
Then that could be on its own thread
Like I said, it certainly should not be on the UI thread
the biggest write size will be like 9 bytes, and the biggest read size will be like 32 or something
Reading is important on a thread because its going to be in a semi-infinite loop
okay. what you are saying definitely makes sense
21:38
If you trust your write, its probably fast enough that it could be on the "CommsController" thread
but with the timeouts, you may want it seperate
Just make sure the CommsController is synchronizing so it doesn't attempt a write at the wrong time
alright, so this is a case when you do the "Download." Now lets say I have a Device in my Selector (UI). I select a couple Devices, and click Monitor. They all use the same CommsMaster for communication. How do I pass values that were read on a separate thread, back to be used on the UI... or do I Dispatcher.Invoke inside the read thread?
actually I think that might be wrong...
If its simply bound, I believe that the framework will marshal the updates to the UI thread for you
I don't want to associate my Models with a CommMaster
because my Models are Slaves, not Masters
so it should be, select addresses associated with a CommMaster, then click monitor
previously it was, Device has a CommunicationProfile, and you'd click a Device and say "Download," which would call commProfile.Write, and commProfile.Read... but they weren't on a separate thread.
Either way, bound changes shouldn't need to be manually marshalled
But its not too bad if you have to
ehh I don't know what I'm saying anymore haha
well I do, but there is a couple different ways of doing it it seems
that's what I was looking at earlier
but I don't see them using multiple threads, so I wasn't sure what i was really missing
21:50
Gotta love third party code
I'm sure you could come up with a way to do this without threads
but it doesn't sound like fun
i want to use threads because Monitor could be long running
which will/should log to files and update UI frequently
thanks for all your help
Any IO outside your computer should be threaded if you ask me
Again, especially for reads
Since you are nearly always waiting for data to show up
No problem, glad I could be of assistance!
you would say the same about opening/closing files right...
do it on another thread... and show a please wait on UI
@BradleyDotNET It shouldn't be threaded - it should use async IO
;)
much more efficient than threading
@NETscape No reason to push it to another thread, just use asynchronous writes and show the UI while it's writing
@ReedCopsey so Task?
22:02
If the files are small its not so important
but yes
will that work in a Master/Slave half-duplex situation?
@NETscape yes, but not "creating" a task, but using things like WriteAsync: msdn.microsoft.com/en-us/library/hh193364%28v=vs.110%29.aspx
@ReedCopsey How would you do a network read loop with async IO?
You need to read, event out the data, and read again in a tight loop
@BradleyDotNET most of the time you shouldn't be working that low level - use the higher level constructs
Similarly for most serial ports
Like TcpClient...
22:03
but you can always use things like msdn.microsoft.com/en-us/library/…
Sure
But even that function would need to be invoked in a loop
not in .net 4
@BradleyDotNET Yeah, but that makes the whole process async
which is fine
To me, TcpClient and NetworkStream are the high level constructs. Are there higher ones?
I see, you are suggesting looping with an await in the middle?
Which basically just abstracts the thread/state machine away from you?
@BradleyDotNET yep - then the entire read becomes async
22:11
now I'm confused... ahhh
is this just for file io, or serialport too?
because the protocol i'm using has a state diagram clearly labeled in the spec
and i figured i'd follow it
nor do I get to use .net 4.5
yeah, if you're not using .NET 4.5, then threads tend to be simpler
still a bit of a pain, but at least easier to implement
I can see one advantage to using threads over async reads
which is they can keep track of more state (via objects or just the function stack)
For example, if I have 10 clients connecting to my TcpListener
I'm not sure you could make that work with async (without a whole bunch of weird hoops)
@BradleyDotNET it's actually easy, and more efficient - it works almost exactly the same way as you'd do it with threads
but it's tough to do pre .NET 4.5 in C#
How would you set that up?
You would await a read for each of course
Oh, I think I see
You call a function that has an await read loop
and it then works exactly the same
I'll have to try that next time I'm implementing a TCP server :)
yeah - instead of "starting a thread" you asynchronously handle it in a function
it works the same way, but you get better scalability since you're not threading everything (theoretically)
22:26
Wouldn't that start the same amount of (pseudo) threads though?
@BradleyDotNET there's no thread with async io
it's handled on the kernel/OS level
Ah, and that is more effiecent.
Interesting, I never knew it actually made a difference
Not sure I would want to ever try it pre .NET 4.5
but I don't develop in that space much anymore
@ReedCopsey is there a way to suppress the "not awaiting an async method" warning?
its very annoying when I know I want to not await it.
@Julien I like also wpf, don't know any other UI tech.
@BradleyDotNET You should make a FireAndForget extension method - and handle/log exceptions
ie something like:
async void FireAndForget(this Task task)
{
    try
    {
        await task;
    }
    catch (Exception e)
    {
        Log(e);
    }
}
22:33
then just do SomeMethod().FireAndForget();
Wouldn't that generate the same warning?
nope -b ecause it's void returning
not Task returning, so you can't await it
ah
that makes sense
but you get safety/logging at least
and it's explicit that you're not wanting to handle it, so it's not a "mistake"
sure
I always thought it was funny with the whole async thing that Microsoft generated a warning when you wanted to use it for "FireAndForget"
But the void thing is an easy enough way to get around it
And my read loop would return void anyways
22:42
async void is not very nice in general
I don't know, sounds like its what I've been looking for for a while
@ReedCopsey Just because I can't see it all in my head, if I did this:

async void SomeMethod(NetworkStream stream)
{
while (true)
{
await stream.ReadAsync();
//Do stuff with the data
}
}

would it cause any problems due to the function not returning? Or would the `await` take care of that?
From the caller's perspective of course :)
And I wouldn't be doing a real while(true) but certainly a long loop
what data is in the stream?
I find myself deleting more async than writing it nowdays.
22:59
No data, I'm trying to read the socket :)
I'm pretty sure that function is close to what Reed suggested earlier
And I wanted to make sure I had the details right
it looks right
await stream.ReadAsync().ConfigureAwait(false); <- is an option
looks like a model method
And then I can't figure out if control is going to return to the caller like I want
But I think it should
What does the ConfigureAwait do? The documentation wasn't very helpful
without it execution must continue on the same thread that awaited
if you have false the rest of the method will be run on the thread that woke up
Thats kind of what I want
prolly not a good explanation
23:02
The caller of SomeMethod to continue on its merry way
while SomeMethod effectively acts as if it were in its own thread
I think the general recommendation is that you .ConfigureAwait(false) for all things
only exception is if you must do stuff on the dispatcher after
Reed will correct ^
I was stuck large parts of today. (again)
public IA SomeMethod(IParams iface)
{
    IA retVal = null;

    if(iface is ParamsA) { retVal = new A(iface as ParamsA); }
    else if(iface is ParamsB) { retVal = new B(iface as ParamsB); }

    if(retVal != null) { _ParamsList.Add(retVal); }

    return retVal;
}
is ^ the best way to do this? should it be done differently (aside from coding style)
looks like a ternary read it wrong
So it looks like I want ConfigureAwait, but if that just gets me a new thread, am I still getting a benefit over doing my own thread?
@NETscape It sure looks like a bad way to do it
@NETscape I prefer iface is ParamsA and nullcheck
23:07
Do A and B derive from a common type?
@BradleyDotNET It takes care of it fine
Ok, so do I need the ConfigureAwait?
None of this is on the UI thread of course (or maybe it is now...)
@NETscape And do ParamsA and ParamsB derive from a base class?
Oh, obviously they do :)
I would put a method on the interface CreateAssociatedObject that returned whatever the base of A and B are, then invoke it here. Let polymorphism do the switch
@BradleyDotNET CreateAssociatedObject on IA?
No, on IParams
You don't have an IA yet to do the creation
Kind of like a Factory pattern, but a little simpler
> {"Value cannot be null.\r\nParameter name: d"}
23:20
Who names a parameter "d"?
dunno exploded somehwre in presentationframework
I like short names in short methods
Maths gets hard to read with long variable names
length of name proportional to scope
Did you try xaml styler?
23:38
posted on December 10, 2014 by Rich Lander [MSFT]

We recently talked to Adam and Jared at The Changelog about open sourcing .NET Core. Check out the show.   #134: Open Sourcing .NET Core with the Microsoft .NET team Here's the introduction from The Changelog: This week, we have members from .NET core team at Microsoft on the show to discuss Microsoft’s motivation for open sourcing the base class libraries of .NET, open s

Haven't tried it yet
But definitely considering it
@BradleyDotNET good call
@BradleyDotNET go from consider to the click imo
it is fast, just disable/uninstal if you don't like it
@NETscape Problem with that is that it violates open/closed principles
so it's dangerous ;)
and it has side effects to boot
23:53
@ReedCopsey gahhh. how should I handle it then?!
what's it actually being used for?
and what is _ParamsList supposed to do?
I want a CommManager with a RequestProfile method. I either pass it SerialInfo (port, baud, etc), or IpInfo(ip, port ....). If the Profile doesn't exist in the CommManager, the manager creates a new one, adds it to the list of the CommProfiles and returns it to be used by consumer
or is that violating just about everything? because after I typed it, it sounds like it haha
@ReedCopsey _ParamsList is the CommProfiles list in my case
00:00 - 19:0019:00 - 00:00

« first day (782 days earlier)      last day (3367 days later) »