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

8:00 PM
then retest your code and see if it works
 
okay wait :)
Error 1 Cannot implicitly convert type 'object' to '__I_MVVM.test1'. An explicit conversion exists (are you missing a cast?) C:\Users\MIC Laptop 3\Documents\Expression\Blend 4\Projects\3-I-MVVM\3-I-MVVM\UserControls\test.xaml.cs 34 23 3-I-MVVM
 
ok, add an as test1
sorry, forgot about that casting, figured you would see it and realize you needed it
test1 a = page.Content as test1;
 
how do i check if a folder/file path exists and create it if not?
my LumberJack doesn't create a new log file at the moment just writes to it..
 
thanks
 
8:04 PM
Object reference not set to an instance of an object NullReferenceException handled
a.frame1.Navigate(new Uri(@"/UserControls/salesBtn.xaml", UriKind.Relative));
 
>>> If the caller does not have sufficient permissions to read the specified file, no exception is thrown and the method returns false regardless of the existence of path.
 
meaning to say a is still null
 
@lnluis ... uh, let me doublecheck something ...
 
i think its not suppose to be page.Content?
 
that depends, are you expecting there to be content there already or are you trying to put new content?
I thought you expected there to be content there already
 
8:06 PM
put a new content
 
oh ...
 
by default when u add a new tab there's already a content.
 
then yeah, you need to change that line to instead be
test1 a = new test1(); and then put the next line page.Content = a; and then a.Frame1Navigate(...);
also, why aren't you passing in a Uri into your test1 constructor? seems like that would be logical for what you're doing. then instantiate the frame1 with the passed Uri to begin with
I thought you were trying to grab the existing tab content
 
1 second.
if i made it to page.Content = a; then basically im loading the new image directly to the page content of test1 user control.
a.frame1.Navigate would be useless now if i said page.Content = a;
basically it just loads the content DIRECTLY from test1 control without putting it on the frame.
 
so which is it? you want to load new content or work with the existing content?
it would be easier to just replace it each time?
 
8:11 PM
it would but i want to use the frame control's built in browser like control
that when i navigate pages
 
uh wtf: 'C:\logs\ldap\ldap_auth_fail11\2\2010.txt'.
 
i have the arrow back and arrow forward
 
string fileNameTimeStamp = DateTime.Today.ToShortDateString().Replace('\\', '_');
string fullPath = LogFilePath + LogFileName + fileNameTimeStamp + ".txt";
why is that not working
 
my problem will be solved if i wont be using the navigation arrows of a web browser like
and i wouldnt have used frame controls since then.
 
i mean the .Replace()
 
8:12 PM
i would just use page.Content = XAML page/Usercontrol instantly.
 
then you have to get the tab content from the tab control
 
hihi is it confusing.
 
sorry, phone
 
i can manipulate the tab content with no problem.
even load pages with it
but my problem is, without frame control. what if the user navigates from home page - > inventory - > sales
and the user wants to go back to inventory?
if i dont use frame control theres no built in arrow keys control to move and backward of the pages
 
any idea why my .Replace is not working?
 
8:16 PM
@Shogun what are you trying to accomplish? replacing the backslashes in the date with underscores? try instead of '\\' instead do @"\"
and use the appropriate "_" quoted modifier on the other one
alterantely just use a different stringformat for the datetime and have it format as yyyymmdd hhmmss
 
straight to the point: problem is i can access the controls of test1.xaml but i cannot change its propery or take effect. i dont know how because what i did waas test1 a = new test1(); which really does instantiates a new one
 
@lnluis if you can manipulate the tab content then what is the problem?
 
i want to use the frame control
 
@lnluis I'm telling you that you have to get the content of the tabcontrol if you want to play with the frame. Because if you don't get the reference to the EXISTING frame then you're not going to be able to work with it.
 
string fileNameTimeStamp = DateTime.Today.ToShortDateString().Replace(@"\", "_");
also does not work
i will try your other idea
 
8:19 PM
@Shogun your slashes went the wrong way
 
what
 
this is what it came out as 'C:\logs\ldap\ldap_auth_fail11\2\2010.txt'.
oh
 
hello everybody
 
yes, because it converts the / to \ for windows paths
@DrTJ hola
 
8:20 PM
ohhhhh
 
@Shogun do you see what I did on the dnp?
 
damn that sneaky thing
 
yep
lol
 
yeah thanks
 
love side effects!
 
8:21 PM
i just changed it to .ToString("yyyymmdd) anyways :D i like that better
 
but drach
 
+"
 
@drachenstern ola, como estas?!
 
yes @lnluis
 
im not sure if i understand what u said correctly.
you want me to access the page content?
 
8:21 PM
@DrTJ until I have to start speaking spanish I'm doing good ;)
@lnluis no, I want you to access the element that is the current content of the tabitem
 
        this.frame1.Content = new MainPageRightMainFrame();
this ones one the test1.xaml
 
;D
 
by default if i add a new tab it will load a blank page with a frame control in it
test1 host = new test1();
e.TabItem.Name = "tab" + tabcount.ToString();
e.TabItem.Content = host;
 
from

test1 host = new test1();
e.TabItem.Name = "tab" + tabcount.ToString();
e.TabItem.Content = host;

I know that you need to extract that control back out
so you need to get host back out
 
but test1 containts the frame control
 
8:23 PM
since host == e.TabItem.Content here, then elsewhere that you can put your finger on that same TabItem them you can get the Content and get back the test1
@lnluis do you want to use separation of controls and logic and keep your implementation neat or do you want every part of your code to know about every other part of your code?
 
if i wont separate my usercontrol and logic, i cannot dynamically create a new tab that loads the content that i want.
 
I'm not asking you what the best way to do it is at this point, I'm telling you how your code should be functioning based on what you've described to me. Now either you want the code to do what you've said, or you don't.
 
FML: The process cannot access the file 'C:\logs\ldap\ldap_auth_fail20100002.txt' because it is being used by another process.
 
sorry im not that yet good in WPF :-s
 
some process needs to GTFO
 
8:25 PM
The TabItem.Content should be a test1
end of story
 
yeah
its content is test1.
 
@Shogun yay, I've been there, done that
 
but i just made this folder
 
@lnluis then why on earth do you want to change that?
 
maybe it's my own process
 
8:26 PM
@Shogun it is
 
ooo i was explaining that part of code.
 
@lnluis look, you have to work with the test1 control as a control, not as a frame and a wrapper
 
basically the problem is on this part 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 = page.Content as test1;

// this.Dispatcher.Invoke((System.Windows.Forms.MethodInvoker)delegate { a.frame1.Navigate(new Uri(@"/UserControls/salesBtn.xaml", UriKind.Relative)); });
a.frame1.Navigate(new Uri(@"/UserControls/salesBtn.xaml", UriKind.Relative));
 
to all the rest of the world, test1 IS the frame
to all the rest of the world, test1 is all they know about
nobody else knows about the middle part of test1 except test1
test1 is all the rest of the world cares about
 
lol
 
8:27 PM
so quit trying to muck about with what's inside test1 except as you've exposed methods for it
 
sorry, am i getting you mad...
 
this line a.frame1.Navigate( should never occur in your code
ever
 
as soon as you do that, you've blown up your entire program
I don't care how easy it is to type it
So you either a) get a reference to test1 and work with the test1 object by exposing methods, or b) you replace test1 everytime
 
how do i do A?
 
8:29 PM
since you want to keep the existing back/forward buttons in place, then you have to get a reference to it
which is what I posted before
26 mins ago, by drachenstern
test1 a = page.Content as test1;
 
if i made test1 a = page.Content as test1 then it will just navigate to a blank frame again.
 
why the F would my process not be able to access the file because itself is accessing the file
 
you have to get the content from the tab
 
I must be doing two different things to it??
 
now, I may have the wrong reference somewhere, so if I do, I'm sorry
@Shogun did you close the file?
@lnluis is that what's occurring or you're guessing?
 
8:30 PM
yeah there is code for that.. i just stole a chunk of code that does the logging part and added it to my lumberjack
see
could it have something to do with my File.Create() ?
 
hmm, wait. what do i add next after i add test1 a = page.Content as test1;
 
@shogun I don't think so
@lnluis then you do a.Frame1Navigate(newUri);
 
so MSDN can eat a fat one
 
@Shogun let me finish with @lnluis and I'll dnp my code
 
kk
 
8:33 PM
error, Object reference not set to an instance of an object.
 
@lnluis which means that the tab content is empty
are you sure you have the right tabitem
brb, afk
 
yup. basically it when i run, it loads the homepage and i clicked a button to navigate to another control ( no problem yet ) then i have this button on this second page where we are editing the codes right now
 
oh!!!
@drachenstern I bet it is my foreach()
 
so theres currently a content on my tab item
hmm
 
sigh, it was NOT the foreach
 
8:40 PM
@Shogun File.Create() returns an open FileStream which you never dispose.
 
oh snap
 
File.Create is redundant anyway - File.AppendText will create the file if it doesn't exist
 
Dathan can I ask a question ? :)
 
@lnluis Sure
 
How do I manipulate the control properties/methods of a UserControl from another UserControl's class.
 
8:43 PM
@Dathan thanks!!
working now
there should be a way to award karma in chat..
i guess that would be hard to create abuse-proofed
 
@lnluis Are we talking WinForms UserControl, or WPF user controls?
 
WPF
 
@Shogun You're welcome. Sometimes it just takes another set of eyes. (c:
 
cause it just always say object is null or not referenced
 
@lnluis Sorry - I'm just getting started with WPF; you could probably teach me, not the other way around. )c:
 
8:45 PM
hehe, okay sure if im also good with it already :p
 
back, sorry
@Dathan good catch
I knew that he wasn't disposing something, had to find it
 
sir drach, still cant figure it out :(
 
@Shogun create a question, let him answer, award him the points
@lnluis yeah, I know, and I'm back
 
welcome back
let me give you another example so you might know the answer
let's say i have a page called page1.xaml and has a label
then i created page2.xaml
on page2.xaml.cs i want to manipulate the label on page1.xaml
how will u do it?
label control
 
I would expose a method on page1.xaml (in .cs) that would be "changeMyLabel(string)" and I would call that from page2.xaml
 
8:49 PM
how will u call it on page2.xaml?
 
so there's the thing, either I can find it in my page2 -> parent -> controls, or I can expect that page2 -> parent will give me a way to access page1 from parent
but until I have a reference to page1, I can't
 
can u show me a sample code
like saying Page1 page = Page2 as Page1?
 
why would you do that?
why would you cast page2 as page1?
 
just an example
was asking how will i access page1's control and manipulate it
with code :p
tried adding a button in test1.xaml
TabItem page = MW.tabControl.SelectedItem as TabItem;
test1 a = page.Content as test1;
a.button1.Content = "LEOLEO";
still object reference is null :(
do i just instantiate it as test1 a;?
 
everytime you try to reference a control under a (a.button1, a.frame1) a kitten dies ... stop killing kittens!
how many tabs do you have?
one?
 
8:57 PM
dynamic
 
right now
zero?
17?
 
1
 
ok, then SelectedItem should be the ONLY tab you have
 
but theres a new tab like a browser
 
so if Content is null, then something is broken in the code BEFORE test1 a = ...
 
8:59 PM
i dont get it.
:-s
 

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