« first day (794 days earlier)      last day (3355 days later) » 

06:11
0
Q: Reload Data every time I navigate to Page

Abhishek DeI have this Windows Phone Page where I load data through the standard ViewModel scope. public Profile() { InitializeComponent(); App.PersonalizedViewModel.favorites.Clear(); DataContext = App.PersonalizedViewModel; this.Loaded += new Routed...

anyone?
here?
 
4 hours later…
10:17
good morning
 
4 hours later…
14:37
hi
14:50
Hi
@franssu uuuuu
15:14
hello everyone
15:29
hej
@NETscape eeeee
hi
16:06
MVVM question for those who are watching
is anyone watching O_O
go ahead !!
so I have a "Create New" window
in it, a types in a "Name" of the new profile
the DataContext of the window is going to be ProfileManagerVM though
the Name will be used in a sense that, new ProfileVM(profileName); inside the ProfileManagerVM and added to ProfileManagerVM's OC<ProfileVM> Profiles
the question is, do I just create a filler property in ProfileManagerVM just for the string
and before window is closed/OK is clicked, then create the profile and reset the property in ProfileManagerVM
yes, why not ?
16:23
good question haha
 
1 hour later…
17:27
Hi
Didn't realise you were on Bradley - I've been looking for you!
You're going to regret helping me the other day :-)
I doubt that :)
I'm on most weekdays
family was here over the weekend, so I didn't get to check much
Ah, ok - well I hope you had a lovely weekend! To be honest I've only be stuck since today but it's on the thing you helped with before, you might not remember but it was to do with setting up some binding with INotifyPropertyChanged
Well, I'm pretty familiar with doing that :)
17:36
Haha, ok. Well basically originally you helped me get it working so that the binding happened on app initialisation and it bound to a Datatemplate within a ListView and it worked great.
ok, I recall most of that
what I'm trying to do now is change a couple of textblocks somewhere else in the view based on which item the user clicks and I have no idea of getting my app to understand which of the loaded buttons they clicked.
Because the textblocks should display some of the data that is stored in the Collection that is being used to populate the button Content - It thought I could reuse the same collection and Data Context somehow (if that makes sense)?
I found some ideas online but they seemed very complicated, like looping through the visual tree until finding the right one.
Yeah, thats not the right way
If I understand what you are trying to do, you have two approaches
The first would be to make a "SelectedX" property in your view model
and bind the SelectedItem of the ListView to that
Then you bind your other controls against the "SelectedX" property
You could also just use an ElementName binding
Where the binding string for your text blocks becomes: "{Binding ElementName=MyListView, Path=SelectedItem.X}"
I'm still here, just thinking it through in my head - thanks!
No problem
17:51
I get the basic principle of it I think, I'm going to try and code and see where I get. I will almost certainly have more questions but I like trying to figure it out myself first (which occasionally happens).
Always a good approach
18:06
If you don't mind, another question I had about last time was with the code in this method.
public ObservableCollection<Term> displayLaunchTerms(string searchValue)
        {
            ObservableCollection<Term> result = null;

            Search loadSearch = new Search();
            result = loadSearch.QueryRequest(searchValue);
            TermsCollection = result;
            return TermsCollection;
        }
Which is related to the property of the class below:
public ObservableCollection<Term> TermsCollection
        {
            get { return TermName; }
            set {
                    TermName = value;
                    TermDescription = value;
                    NotifyPropertyChanged();
                }
        }
I was trying to make the method slightly cleaner and wanted to simply put 'TermsCollection = loadSearch....' however that doesn't work - the Collection never binds to my Controls, I need the TermsCollection = result; Why is this? It appears to me that they are the same format and value.
Seems like that should work...
Hmm ok, strange. Will leave it as is and come back to it.
18:23
sooo
When to use Attributes or Elements in XML?
why use XML?
<Profile Name="First">
    <BaudRate>9600</BaudRate>
</Profile>

or

<Profile Name="First" BaudRate="9600" />
because its configurable and needs to be persisted
I'm not an expert on XML, but I believe they are two ways of doing the same thing (like in XAML)
If so, I would just use whatever is more readable, probably the first one if there are lots of elements.
one profile will only have one baud rate setting
but I also want to add in options... not sure if it should be its own xml doc
@ReedCopsey whats my other option?
But if you have many settings (not just baud rate) a list of attributes can get rather long. Also, I believe the element syntax is required if the child is an object.
18:31
the profiles won't have objects
Well, at least you don't have to deal with that part then
i
i'll post example
@NETscape What's the data representing?
when a user creates a communication profile... I want to provide them with a list of profiles that have their settings already set if they pick a preconfigured profile
i also want to provide them with options for some fields like Baud Rate and Parity
those options might have to be in a different XML document though...
@ReedCopsey and some of the options are found at the bottom of the gist.
so someone creating a new profile will see: "Serial, TCP, WDS" ... they will select Serial. Then they could pick from "Profile 1, Profile 2, Profile 3, Custom" ... picking one of those will set the defaults for selectedbaudrate/parity/timeouts, etc.
and when someone picks Profile 1, the user will be able to choose a COM Port device, baud rate, parity, etc... I just make sure the correct default is set.
19:00
the format looks reasonable
I'll often just use json nowadays, though - it's just so much easier to read
If a class is going to end up having a lot of properties is there a good way to manage that? If I had something like below for each property it would get quite messy I believe.
public ObservableCollection<Term> TermsCollection
        {
            get { return TermName; }
            set {
                    TermName = value;
                    NotifyPropertyChanged();
                }
        }
It just gets long
I #region them so I can collapse the whole section
@ReedCopsey is there built in NET JSON libs?
Newtonsoft.Json
Not quite built in
but works really well
yeah - I just nuget that ;)
19:02
I personally prefer XML, buts its just that, a preference
lets say I stick with XML
does the available options have to be in a different file?
Not sure what you mean by "available options"
no
ummm
at the bottom of the gist
Ah, those
I could have CommCatalog.Profiles, CommCatalog.BaudRates, CommCatalog.Timeouts etc
19:10
This is probably something very simple, but when I build my app every element is selectable. So if I click it anything it gets highlighted purple and a check mark added to it. What have I mistakenly turned on?
@NETscape I would put those all together in another file, as suggested
@James In WPF you set SelectionMode="None"
IIRC its similar in windows 8
In the properties of a control? I Imagine in this case since it is affecting everything it will be on my page or grid
Got it, it is called SelectionMode, you're correct.
Its on whatever collection control you have, which you appear to have found
19:38
@BradleyDotNET yo :)
Hi @Sag1v
@BradleyDotNET hi m8 how are you?
doing well, yourself?
fine
except that I got a monster headache
wcf + threads... :)
my 2 weak topics of c#
Threading gives everyone a headache
19:41
hehe aye
WCF is a pain to set up, but once you get it going its pretty easy
so I've heard
well I got it set up for a small app but having problems understand how to exchange my class from 2 clients
i can read it from my service but don't know how to exchange info between clients
reading so many articles got me a headache
lol why people will upvote answer but wont accept them as an answer?
You don't know who upvoted
So its hard to say
well some of them say thanks it worked... or something like that so i assumed
There is always that :)
anyways, what is confusing you about your WCF app? Sounds like it all works
19:48
lol a guy said thanks and asked another question while his code is based on my answer
well never mind as long as it's helping him
it happens
well the wcf part is working... but I'm trying to figure out how do i transfer data from one client to another using the wcf methods
You call methods
just as if they were another assembly/class
yeah but do i create the threads inside the service or do i create them on the client side?
i was thinking client side
make more sense to me
Yes and yes
also possibly no and no
or no and yes
or yes and no
19:51
Why do you need threads? and what are you threading?
hence my headache haha
The threading has nothing to do with WCF
and everything to do with the rest of the programs
the big question is why do you think you need threading at all?
remember the app i was tring to create that send messages to multi clients?
trying*
19:52
that doesn't imply threading
messages are already asynchronous - there's not necessarily a need to thread anything (at least on the client side)
wait
@Sag1v Yes, but I agree with Reed, that doesn't imply threading client or sever side in the WCF host
say you got a server that accepts messages and transfer them to other clients
i got 2 types of clients
senders and receivers
so basically the direction will be sender -> server -> clients(multi)
19:55
okay
so i thought of doing it with a list and each client that connect to the server will be added there
and then the server will send them the data with a loop
are receiving clients actually hosts, or are you using WCF callbacks?
wcf is realy new to me so I've only read about callbacks
and so some tutorials but never used them
And is this replacing your previous UDP/TCP (don't remember which) implementation?
saw*
tcp and yes
i hope so
19:57
okay
you have the right idea
so, nothing you're suggesting really needs threading
you can just use a WCF callback for handling the receivers
and senders just post to your service
it's doing well but i only tested it with 6 / 7 clients but what will happen when i got 1000 or 10000 clients? it's sending the data in serial way
19:58
since WCF is already asynchronous, passing a message around doesn't need threads
what he said :)
aye that's why i thought of doing it with WCF
but
im such a n00b with that
if you really needed thousands of clients - you could always paralellize the callback calls, but even then, you're probably not going to have a problme
I wouldn't worry about that until that occurred
realy?
TBH, synchronizing between lots of threads is probably more overhead than trying to send the messages
19:59
Even 1000 calls happen really fast
yep
Pretty easy code to follow here: wcftutorial.net/WCF-Events.aspx
it sounds like it's basically doing what you want ;)
so my service should have a sendMessage method exposed and also a callback right?
the green "method call" is the publisher
you can use 2 services, if you prefer
or put them into one
if you want people to be able to send+ receive messages
IsOneWay = true
what is that?
you probably want InstanceContextMode.Single though
20:01
saw it on so many tutorials
for the service
hmm
basically, that says that the message only goes "out" - it's not returning a value in the callback
which makes it much more efficient to post the message
because it doesn't have to wait until it's done (ie: it can be non-blocking, and scale up to your thousands of messages ;) )
Definitely good practice to put that on all void methods
hmm like a udp message?
20:02
Not really...
if you have a return type
It just has no reason to block the calling thread, as nothing uses the return value
so it does get the 3 handshake of course and "knows" that the client got the data..
you have to run the method, then wait for the result
if it's void, it doesn't really need to wait - since you know nothing's coming back
so it can just "shout out" the message then go onto the next one
It still is TCP
20:03
yeah
But the calling code doesn't care about handshakes and all that
yeah that's another level
So it can just "fire and forget" into WCF, which is what "OneWay" says
ok
InstanceContextMode.Single
and this one?
Sets your service up as a persistent singleton (basically)
20:04
that basically says use a single instance of the server class
Instead of creating a new instance for each call
PerCall means that every call to the server createsa new server instance
which probably isn't what you want, since it'd keep messages from posting across separate clients (they'd be different instances), unless you manage it outside of the class
There's also per session, but again, no real reason to use that here
got it
switch that code to Single, and it's basically what you want ;)
other than customizing the message
and/or choosing a better transport
(ie: you could potentially use TCP for the transport instead of DuplexHttp, which would be better, provided the connections are allowed in your environment)
20:07
yeah just noticed in the tutorial its not tcp..
transport is specified separately from the code - so you can change it easily later
yeah
the tutorial is http based - advantage is that it works behind a lot of firewalls
disadvantage would be that it's less efficient than a tcp transport
but it doesn't mean i need to run the service from an iis or something right?
(still TCP, but there's overhead involved in wrapping up in http)
not necessarily
you can self host, too
that tutorial is self hosted, I believe
20:09
ok so i need 2 "servers"? 1 to host the service and 1 to handle the clients?
Not necessarily
though thats a better test
Your can always talk to localhost
just go through that tutorial
it'll make a lot more sense once you have the callbacks running locally
I'm gonna use it on a terminal server (2012R2) eventually
so i think to run 2 separate apps there (1 for the service 1 for the client handling)
but will follow that tutorial first so i can learn how to swim :D
I doubt thats the design you want
But definitely do the tutorial first :)
why is that
20:14
Because you can easily handle all that in one application
I don't think doing two will buy you anything from what I've heard
hmm i don't see any error handling (when a client disconnect for example)
Thats right, WCF doesn't really tell you that
You can do heartbeats to determine connectivity though
And always try catch your calls in case the connection is dead so you can catch the exception
well if i subscribe a client i can unsubscribe him can'nt i?
hmmm
this tutorial is not much far from where i am now
but i still don't see where do i send a message or a class
to other clients to my choice
20:27
Did you implement a callback contract?
not yet
Well, you need one to talk back to the clients
i'll finish the tutorial and see if i understand any of it lol
public interface IMyEvents
{
[OperationContract(IsOneWay = true)]
void Event1();
}
did he forgot to put:
[ServiceContract]
on top?
looks like it
20:44
I think he has it on the implementation, which also works
IIRC
so far stuck on this..
The type arguments for method 'System.ServiceModel.OperationContext.GetCallbackChannel<T>()' cannot be inferred from the usage.
the compiler doesn't like this:
IMyEvents subscriber = OperationContext.Current.GetCallbackChannel();
You have to paramaterize the method call
OperationContext.Current.GetCallbackChannel<IMyEvents>()
21:12
yeah i added that
it's running ok now but crash after a sec with
The InstanceContext provided to the ChannelFactory contains a UserObject that does not implement the CallbackContractType.
strange seems like i implemented all the methods for the interfaces
Does your proxy implement the callback contract?
Note that I don't believe auto-generation will do this
what do u mean?
IIRC auto-generated proxies don't implement everything needed for callbacks to work
im getting back data though
but it crashes after a sec
Probably on the Subscribe call?
21:18
yeah
the subscriber crashes with that msg
So the proxy class (on the client side) isn't implementing the callback contract
well i followed the tutorial
IMyEvents evnt = new MySubscriber();
InstanceContext evntCntx = new InstanceContext(evnt);

EventServiceClient proxy = new EventServiceClient(evntCntx);
this is on the main method of the subscriber
proxy.SubscribeEvent();
Right, but does EventServiceClient implement IMyEvents?
nope
its not using IMyEvents though
class EventServiceClient:DuplexClientBase<IMyContract>,IMyContract
{
public EventServiceClient(InstanceContext eventCntx)
: base(eventCntx)
{

}

public void DoSomethingAndFireEvent()
{
base.Channel.DoSomethingAndFireEvent();
}

public void SubscribeEvent()
{
base.Channel.SubscribeEvent();
}

}
Right, but thats whats going to be called back to
So it has to implement the callback contract
Or you have to provide the correct instance context some other way
I usually just have the proxy implement the callback
21:29
Anyone here good with Flyouts?
Used one once
So not exactly an expert
well i guess this tutorial wasn't tested innit
I have a listview that's being autogenerated. Each item needs to have a flyout with the option to rename the content of that item.
@Sag1v Haven't used that tutorial, so its hard to say :)
yeah lol
all that work and now I'm more confused lol

« first day (794 days earlier)      last day (3355 days later) »