« first day (17 days earlier)      last day (4921 days later) » 

7:00 PM
@GeorgeStocker @Shogun Yep, that's just as important, if you're going to have a persistent controller. In the case of, say, an ASP.NET page where the controller would be blown away every time, then there's no need to -= it
 
how can i tell
if my controller is or is not blown away between requests
actually sounds like a decent question to post
 
Yeah, I would post that and onebox it
sorry I keep disappearing, boss keeps coming in
@mootinator what's the problem today mate?
@Shogun if it's being handled through the ASP.NET engine and there's nothing to static the page in memory or keep it otherwise persistent, then it will be disposed once the page finishes rendering. However, if there is anything to keep the object in memory, then it will still be referenced (why does that sound so the circle is circular because it is a circle)
So if you want to test it on your own, do this: in the onhandler, add Debug.Print("I ran!"); and then see how many times that shows up ;)
simple bruteforce approach
 
Any help? :(
 
what's the opposite of instantiated?
destantiated?
 
uninstantiated I think
 
7:08 PM
ah i like mine better lol
 
why not go for disposed?
@lnluis do you mean from an hour ago? You have to participate to have a conversation ... I personally don't have an answer for you, no ... wish I could help, but I don't do WPF sadly enough
 
Hey - does any linq-to-sql rockstars in here? SubmitChanges() is kicking my ass.
 
wouldn't that mean instantiated should be impose
 
WPF is the wasps nipples
 
Yes, I already conversed but they don't reply back.
 
7:10 PM
@entens inspose maybe?
 
Smartcave: What aobut submitchanges?
 
@lnluis no not really ... they are asking for clarification, in every venue
 
I wish it was easier with linq-to-sql to have it use NOLOCK's in the generated queries
 
0
Q: How do I stop Ajax calls to SubmitChanges on DataContext from causing errors?

smartcavemanI have a .NET MVC application in which an HttpHandler logs requests in a database via Linq to Sql. 50% of the time, when I click a link to make an ajax request, the SubmitChanges() of the DataContext throws an error "The operation cannot be performed during a call to SubmitChanges". This is c...

 
7:13 PM
Thanks
 
@smartcaveman I think you need to change up and instead of using the same sql handler for every request, use a new sqlhandler on every ajax request. This may be me talking and not knowing how the datacontext works, but the thing is that your error is saying "I can only do one operation at a time" and you are finding ways to ask it to do multiple at one time (repeated clicks)
 
drach: can u give me a a solution how to implement that public method ? cause its a control not gonna access a method but a control from another class
 
unless there's a need for it to run with the same datacontext sqlcontext everytime
@lnluis try public void LetMeChangeMyValues (string newValue) {this.Value = newValue;}
literally expose a public method to change the internal value
 
1 sec so where do i put it ?
to the one that has the control?
 
the one that you want to be updated
 
7:17 PM
heheh I'm making a little custom logging class called 'LumberJack'
 
Is it OK?
 
So, my DataContext is instantiated as a singleton by my IoC container, which initializes from an HttpModule on the Init event. After the RouteData gets created by the RouteHandler, I initialize my session (which is where the error is occurring) and attach it to the RequestContext, prior to injecting it into the ControllerFactory
 
@drachenstern The problem today is that the problem fixed yesterday, though it eliminates a lot of logged errors, doesn't seem like it could be related to the problem I was trying to fix. I haven't heard anything from them though, so that's a good sign.
 
so meaning to say, i have my test1.xaml that contains a frame control
 
@drachenstern - that last thing i said
 
7:18 PM
lol @Shogun
 
on my test2.xaml when it loads it has a button where it shud update the frame control of test1.xaml
 
hey what's that thing called in C# where you can just do short hand {get; set;}
once I do that, what would my constructor look like
 
@mootinator well, so perhaps it is ...
@Shogun a public property? a default property?
 
the reason im asking the true name is so i can just google it
 
@Shogun Auto-implemented property
 
7:18 PM
ah yes
 
autoproperty
 
thanks @LasseVKarlsen
@lnluis you should expose the method on test1.xaml and you should call the method on the object for test1.xaml in the test2.xaml onclick
 
"VB: This language is not supported or no code example is available." /snicker
 
okay will try ur method
public void LetMeChangeMyValues (string newValue) {this.Value = newValue;}
 
@drachenstern , I did at one point try creating the data context for each sql - call, but then I kept losing the connection.
 
7:20 PM
@Shogun it looks like a constructor?
@smartcaveman sadly expected
 
yeah
 
Is there a fix for that?
 
i just meant i dont have to call get() or something
i can just do =
er, set()
 
@Shogun yeah, or you could just refer to it by name ...
@smartcaveman what I mean is, if you keep declaring new datacontexts, then yeah it'll lose the connection, that's what I thought was going to happen, but wasn't sure.
 
awesome, thanks guys
 
7:22 PM
@smartcaveman this is why I don't deal with the database frameworks ... and sadly this is why I don't deal with most frameworks, because in order to use them correctly I would have to reimplement them so I knew what they did ... I just do the work blindly and naively
in other words, I recreate their efforts from scratch to 90% probably
 
@drachenstern how will i do that? What I'm about to update is frame1.Navigate(); which needs to be a uri source.
 
Yea, I'm pretty close to doing that, but hoping that I don't have to rewrite it all.
 
@lnluis after you test1 a = new test1(); then you would have a.UpdateMyValue(string); or something
 
can I set a default when I do the auto property thing or does that not make sense
 
@drachenstern yes but its not suppose to be a string its suppose to pass "(new Uri(@"/UserControls/salesBtn.xaml", UriKind.Relative))"
 
7:24 PM
public bool IncludeTimeStamp { get; set; } = true; does not compute
 
@lnluis then instead of using a string in my example, change the datatype
@Shogun correct. You're doing it wrong like that
 
i dont know the datatype for Uri Source? :p
 
@lnluis do you mean Uri?
Try using Uri
 
oh wait i'll just override the constructor
dur
 
7:25 PM
?
 
in your class
 
yezz, its easy if i just say frame1.Navigate(new Uri(@"/UserControls/salesBtn.xaml", UriKind.Relative));
 
do this
public class MyClass { public bool IncludeTimeStamp {get;set;} public MyClass(){ IncludeTimeStamp = true; } }
 
uhh its hard rofl
 
yeah thats what i meant and then if I wanted to have another constructor i would be like public MyClass(bool timeStamp) { ... }
 
7:27 PM
@lnluis in test1.xaml.cs declare a method public Frame1Navigate(Uri mySource) { frame1.Navigate(mySource /*, UriKind.Relative */); }
@Shogun yeah, more or less
 
schweet, thanks
 
@lnluis then in test2.xaml.cs when you declare test1 a = new test1(); then on the next line try a.Frame1Navigate(new Uri...);
 
it compiles but it dont navigate
thats my problem since birth, like test1 a = new test1(); a.frame1.Navigate(.....);
thats what is happening
its not letting me update the other control
 
hang on
just out of curiousity, when do you refresh the screen or update to show that changes have been made?
 
i tried putting breakpoint and it does execute the frame.navigate
 
7:32 PM
because if you're only instantiating it in code, but you're not forcing it to show on the screen, then how do you know that it navigated?
I think it is working just not how you expect
 
its loaded on the scren
 
put in some debug.print commands
trace the flow of the logic
because if you're doing what I said, it'll be navigating regardless
 
its not in the logic i think its how i have permission to access the control
 
Aha! I found the real problem.
 
altho it should have from the example you posted earlier
@mootinator congrats!
@lnluis you own the control, in both regards. What permission?
 
7:33 PM
no
test2 dont know what frame1 is in test1
 
public/private?
 
its not connected
 
yeah, that's why I said to expose a method
that's how you keep things separated
 
i have this on test1.xaml
 
The data entry screen was being cut off in 1024x768, so users just weren't thinking to press the save button which was off their screen.
 
7:34 PM
and i have this on test2.xaml
 
@lnluis don't post code directly
use gist
@mootinator zomg seriously?
 
gist
public void Frame1Navigate(Uri mySource)
{ this.frame1.Navigate(mySource /*, UriKind.Relative */); }
    public void Frame1Navigate(Uri mySource)
    { this.frame1.Navigate(mySource /*, UriKind.Relative */); }
 
@drachenstern Yeah, unfortunately.
 
private void button1_Click(object sender, RoutedEventArgs e)
        {
            MainWindow MW = Application.Current.MainWindow as MainWindow;
            MW.label1.Content = MW.tabControl.SelectedIndex;
            TabItem page = MW.tabControl.SelectedItem as TabItem;
            test1 a = new test1();
           // this.Dispatcher.Invoke((System.Windows.Forms.MethodInvoker)delegate { a.frame1.Navigate(new Uri(@"/UserControls/salesBtn.xaml", UriKind.Relative)); });
            a.Frame1Navigate(new Uri(@"/UserControls/salesBtn.xaml", UriKind.Relative));
i have this on test2.xaml
it's suppose to navigate.
 
7:36 PM
Where do you attach test1 (aka "a") to the screen to show it to the user? I'm not a WPF guy, so I may be missing something, but in the ASP.NET world we would still have to stick it to the screen
so you would have to insert test1 into the owner document of button1
 
its attached on the mainwindow
MainWindow first loads the test1.xaml that contains framecontrol then test2.xaml contains a usercontrol
 
in test1.xaml.cs where you have `public void Frame1Navigate(Uri mySource)
{ this.frame1.Navigate(mySource /*, UriKind.Relative */); }` update it to `public void Frame1Navigate(Uri mySource)
{ this.frame1.Navigate(mySource); Debug.Print("I navigated"); }` and update the using to include the System.Diagnostics namespace
@lnluis so you're creating TWO test1 instances?
 
only one
 
not true
you just told me you're creating two
 
nonono
 
7:38 PM
once in MainWindow declaratively before execution
 
here's the scenario
 
and once in onclick
 
on my mainwindow i have a tabcontrol. (like a masterpage)
 
now what i do is dynamically if the user adds a new tab
it will load a frame for each ta
 
7:39 PM
ok
 
for each tab.
next by default there is another page that is loaded on the frame
 
and is that what the button1_click is supposed to be doing above?
 
when the user navigates
say i have a homepage i clicked inventory
it shud load the inventory user control
 
I follow all that @lnluis but my point is you're creating a new control, you're not accessing the one that is currently in existance
if one already exists, you're not touching it, you're making a new one
 
yep thats what most point out
yes ur getting my problem now
 
7:40 PM
so why are you doing that?
 
i dont know, lol i was asking how do i access the existing one
since i knew that its a new instance like what i said on my post :p
 
the same way you accessed the mainwindow
 
how is that?
 
private void button1_Click(object sender, RoutedEventArgs e) {
        MainWindow MW = Application.Current.MainWindow as MainWindow;
        test1 a = MW.test1;
        a.DoSomething();
}
look, use gist and post your code
then give us the gist URL
and we'll fork it back to you
show mainwindow, test1.xaml and test2.xaml
 
i dont see the MW.test1;
test1 wont show since test1 is also a user control
 
7:43 PM
look, use gist and post your code
then give us the gist URL
and we'll fork it back to you
 
what part of the code will i post
 
show mainwindow, test1.xaml and test2.xaml
I really wish I had <kbd> here ...
<kbd>a</kbd>
 
only the xaml.cs right
or including .xaml?
 
including xaml
 
why dont i just send to u the solution explorer lol
 
7:46 PM
because that wouldn't help you
 
why
 
and because you're focusing on making two components work together, and you only need a few methods from each
I only need to see the concerted pieces that you're having issues with, not the whole project
 
yes yes
reading
 
tyvm
 
7:51 PM
where is the version of MainWindow that looks like this? gist.github.com/raw/684032cbcea285ab82f5/…
 
oops
reload it.
 
thanks
in public partial class MainWindow : Window ~~ void tabControl_TabItemAdded you do this: e.TabItem.Content = host; and that's where a frame gets added, but then how do you reference this frame content later? That's what you have to figure out. So in public partial class test : UserControl ~~ private void button1_Click you have to have a way to get to that TabItem.Content from before
 
i have no problem dealing with that
 
You can either maintain that in a collection or you can parse for it, imo
still reading, brb
 
currently i can navigate and load pages within the frame
my only problem is that i cant navigate when i want to navigate using another class
 
7:59 PM
change this line test1 a = MW.test; to test1 a = page.Content;
 

« first day (17 days earlier)      last day (4921 days later) »