|
I don't know whether I get your requirement correctly but try this,
Create a static instance in the MainWindowViewModel and use MainWindowViewModel.Instance.MethodName() for accessing the method.
|
|
|
|
|
A common way to do this is to use something like a mediator (or the Messenger class in Laurent Bugnion's excellent MVVMLight framework). Basically you register a listener for each command in the MainWindowViewModel and then raise the appropriate command in the NavigationCommand VM - the listener will then react to it.
|
|
|
|
|
I think my fundamental problem is that I am not sure how to work with one viewmodel from another. Here is the breakdown.
Mainwindow has a data context of Main Window View Model. The command to add and set active workspace resides on this view model.
On the mainwindow there is a custom user control treeview that has a data context of navigationcategory view model. Within the treeview each bottom level node is a hyperlink. The binding for each command for each hyperlink is bound to the navigationcommand view model.
With that said, the command on the navigation control view model needs to do something to add a new workspace and change the active work space on the main window view model.
So the question is, what does the command look like on the navigation command view model to tell the main window view model to add a new workspace (based on whatever item is chosen on the treeview)
|
|
|
|
|
Solving this is easy if you have a workspace manager class (which would be a static instance) - then you simply call a method on this manager class to add a window to the workspace that belongs to the appropriate type.
|
|
|
|
|
i want to use usb port for video receiving. could not find on how to communicate via usb port. every where its mentioned for serial ports under the heading of usb port.
|
|
|
|
|
That's because the "S" in U"S"B stands for "Serial" - as in Universal Serial Bus.
Just treat it as a normal serial port and you'll be fine.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
Are you sure?!? The "S" is "S"ATA stands for Serial too, but I really doubt that you can access a SATA Hard-Drive using the API for the RS-232...
|
|
|
|
|
You sure about that? I'm not.
You've got the right idea, just the wrong letter.
The keyword is BUS, not serial. USB is an expansion BUS, not unlike the PCI slots on your motherboard.
|
|
|
|
|
USB and serial ports are completely different: when you access a serial port and read/write on it, you are handling the raw data that are transmitted/received. When dealing with an USB device, you need a device driver that do that job for you. What you need is to identify an API that lets you manage the device, abstracting from the kind of hardware connection used.
To handle video streams you can try the DirectShow (Windows)[^]
|
|
|
|
|
Hello,
i'm writing a WCF Application and need to know, which IPAddress/Port i use to communicate with the WCF-Service. I don't want to know on which Port i'm connected on the Server (RemoteEndpointMessageProperty), i want to know which IP/Port my network card uses to connect to the Server.
I hope you can help me.
Thank you
|
|
|
|
|
Assuming you are using a DuplexClientBase<> derived class, you can use client.Endpoint.Address where client is an instance of the derived class.
|
|
|
|
|
Hello,
thank you. But i use the DuplexChannelFactory and there i have a client.Endpoint.Address, but i get back the Address from the service. So what to do now?
Thank you
|
|
|
|
|
I haven't any solution yet...
I tried this with "OperationContext.Current.OutgoingMessageHeaders.From" on local side, but there's no success.
Is it so difficult to get the IP Address from where i send a message? Or if it's a incoming Callback-Message to get the Endpoint on which the Message came in?
|
|
|
|
|
Hello everyone,
ActiveDB.DBContractsClient _Proxy = new ActiveDB.DBContractsClient();
_Proxy.Open();
_Proxy.ExecuteQuery("Select 1", new object[] { });
_Proxy.Close();
_Proxy.Open();
_Proxy.Close();
I have the following code to demonstrate my problem. Till the point where is the second open it works fine, but when it tries to open to connection for the second time it says cannot open object because it is disposed.
Am I doing something worng or any ideas on how i may fix it?
Thank you for any help.
|
|
|
|
|
It looks like _Proxy.Close automatically disposes of the object. I'd take a look into that if I were you. One way round it is to create a new instance of ActiveDB.DBContractsClient before calling the second _Proxy.Open .
|
|
|
|
|
The Issue is that I want to use the same instance i am using this in a web application and what I am doing is that I am creating this instance when the session starts and use the same instance for every operation that the user does in the application. And for every operation I want to open and close the connection to make sure that no connections are ever left open.
|
|
|
|
|
You can't have it both ways unfortunately. Either it's disposed and you create a new instance every time, or you have to leave it open. It would be easier if you had control of the class itself, and could remove the Dispose out of there, but it looks like you don't have that option.
|
|
|
|
|
cdpace wrote: ...and use the same instance for every operation that the user does in the application
And why do you want to do that?
What benefit do you think that you get from that?
|
|
|
|
|
I was playing with WCF last spring, not with a web whatsis, and only opened the connection once, so I didn't encounter that.
I'll take a look at what I can find out later.
|
|
|
|
|
Hi,
I have used the drawtool2005 project,modified it,by storing locations and shape ids in the database.What i would like to know is whether i can add a background image to the layout file created.
SRK
|
|
|
|
|
Try asking at the article itself - that way the author gets an email - posting here relies on them "dropping by" and realizing it is for them.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
hi friends, seniors $ all,
I have a form on which i am using layout panel. on this layout panel i am adding user control during runtime. the control consists of a picturebox and label. the image which is displayed on picture box is copied from the source folder to temp folder. this image is resized and bitmap is created and passed to picture box.
now i want to clear the temporary moved files, which is not happening.. i get the file is in use. so i disposed the child form, before comming to parent form. even clearing the layout panel didint help..
friends please suggest me some help
regards
Samir
|
|
|
|
|
Which of the many available Methods are you using to load the bitmap?
I suspect that you are using Image.FromFile() as this is a well documented problem with this method.
If that is correct then switch to Image.FromStream() (look it up). Hopefully this will resolve your problems.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
hi sir,
i am using filestream only.. one more thing i am using thread to load the controls inside layout panel
regards
samir
|
|
|
|
|
In that case, without seeing any code, is there a possibility that the threads are terminating before properly closing the streams?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|