|
Hi Sebastian,
Thanks for your faster response. I tried using DirectorInfo-class. But it says duplicate assembly info files.It would be great if you could chip out with code too.
Also can this be done using cmd prompt.?
Thanks,
Arul
|
|
|
|
|
If you download my MoXAML PowerToys addin source code (follow the link in my sig), you will find plenty of code in there for reading and navigating VS projects - once you've got that in place, it's a simple case of just opening and reading the appropriate file - then looking for the relevant line of code.
|
|
|
|
|
Here's mine[^], there are others.
|
|
|
|
|
I am using a composition of some different code samples to try to work with a WPF (MVVM) application. I started with Josh Smith's multiple view workspace model as below (pertinent snippet)
#region workspaces
public ObservableCollection<WorkspaceViewModel> Workspaces
{
get
{
if (_workspaces == null)
{
_workspaces = new ObservableCollection<WorkspaceViewModel>();
_workspaces.CollectionChanged += OnWorkspacesChanged;
}
return _workspaces;
}
}
private void OnWorkspacesChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if (e.NewItems != null && e.NewItems.Count != 0)
foreach (WorkspaceViewModel workspace in e.NewItems)
workspace.RequestClose += OnWorkspaceRequestClose;
if (e.OldItems != null && e.OldItems.Count != 0)
foreach (WorkspaceViewModel workspace in e.OldItems)
workspace.RequestClose -= OnWorkspaceRequestClose;
}
private void OnWorkspaceRequestClose(Object sender, EventArgs e)
{
var workspace = sender as WorkspaceViewModel;
if (workspace != null)
{
workspace.Dispose();
Workspaces.Remove(workspace);
}
}
#endregion
#region private helpers
private void DisplayAllFoo()
{
var workspace =
Workspaces.FirstOrDefault(vm => vm is AllFooViewModel)
as AllFooViewModel;
if (workspace == null)
{
workspace = new AllFooViewModel();
Workspaces.Add(workspace);
}
SetActiveWorkspace(workspace);
}
private static void DisplayFoo()
{
}
public void SetActiveWorkspace(WorkspaceViewModel workspace)
{
Debug.Assert(Workspaces.Contains(workspace));
var collectionView = CollectionViewSource.GetDefaultView(Workspaces);
if (collectionView != null)
collectionView.MoveCurrentTo(workspace);
}
#endregion
So it is easy enough to work with that, XAML code produces a list of commands which point to the voids above. I wanted to use a treeview navigation structure so I could categorize my navigation commands into categories. I used Josh Smith's (PS Thanks Josh Smith!) WPF MVVM Treeview to make a viewmodel for my categories and navigation items and everything is good there. My issue is this, the navigation commands for each navigation item are on the NavigationCommand viewModel, while the workspace and setactive workspace commands are on the mainWindowViewModel. How do I make this work? How can I call the SetActiveWorkSpace command from my NavCommand viewModel?
Sorry for the mess, --EA
P.S. I do lack a lot of fundamental understanding of WPF, just trying to get a foothold in it.
|
|
|
|
|
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.
|
|
|
|