| Unit Testing with WPF + MVP |
|
 |
Index ‹ Visual Studio 2008 ‹ Windows Presentation Foundation (WPF)
|
- Previous
- 1
- Visual Studio Source Control and SourceSafe VS2005 and Source Safe BindingI am converting many cpp projects from VC6 to VC8 and am having problems with Source Safe binding in VS2005.
I have a working structure like this: d:\common\ com\ project1\ project2\ project3\ include\ project4\ include\
In VC6, I could have project1 open, and add a header file that is found in common\include and still have source control over that file while working in VC6. Now that I have moved to VC8, I try to add a header file from common\include\ to project1, and it gives me an error message stating: Some of the files you are adding to your project are located outside of the project's binding root. These files cannot be source controlled unless they are moved.
If the project's hierarchy on disk mimics the hierarchy in the source control database, you might be able to control these files by changing the project's bindings. For more information on how to do this, click Help.
I cannot seem to bind source safe to common\, and i cannot add a file to the source control. Is there a way to ensure that you will have source control over a file that is not located within the project's directory
- 2
- Windows Presentation Foundation (WPF) Listview content Wrap
Is there a way to have the control list items like in a list box but when the bottom of the screen is reached have a new column formed so that all of the content is on the screen I.E. If the screen can hold 40 rows of data and I have 100 rows to display I would end up with three columns of data.
Thanks in advance
- 3
- Visual Studio WPF Designer Cider support for local assembly references?
Am I doing something wrong Or do i possibly have an bad interaction between Cider and ReSharper (my guess).
every time i make a reference to the local namespace in the same assembly... e.g.
< Page x:Class="MyNameSpace.TestPage" xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:local="clr-namespace:MyNameSpace" Title="TestPage"> <Page.Resources> <local:MyConverter x:Key="myConverter"/>
I end up getting all sorts of errors, even though it all compiles fine. In just the snippet i've pasted here, I get three errors:
Assembly '' was not found. The 'clr-namespace' URI refers to an assembly that is not referenced by the project.
The Element Page.Resources... has invalid child element MyConverter..."
and The type 'local:MyConverter' was not found. Verify you are not missing an assembly reference."
Ditto on the code behind... InitializeComponent() is not found, nor are any references to named xaml elements. but again, everything compiles and runs just fine. Is this just a preview issue Or are Orcas and Resharper fighting
- 4
- ADO.NET (Pre-release) Using Entity Model in a DLL
I am building a library (dll) which calls my entity model for data requirements. The problem is where to put the configration file. There are two options:
1. Either put the config information in the dll.config file
2. Or Put it in the calling application (App.config)
In both casses it is giving a exception.
When I put the config information in the dll.config file it is giving the following exception:
System.ArgumentException was unhandled Message="The named connection HelloWorldDBConnectionString is either not found in the configuration, it's not intended to be used with the Mapping Provider, or it's invalid.\r\nParameter name: connectionString" Source="System.Data.Entity" ParamName="connectionString" StackTrace: at System.Data.Mapping.MapConnection.ChangeConnectionString(String newConnectionString, String callersConnectionStringParameterName) at System.Data.Mapping.MapConnection..ctor(String connectionString) at System.Data.Objects.ObjectContext.CreateMapConnection(String connectionString, String defaultContainerName) at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName) at HelloWorldDBModel.HelloWorldDB..ctor(String connectionString) in f:\EndToEndHelloWorld\ModelObject1\obj\Debug\ModelObject1.Model.cs:line 101 at HelloWorldService.HelloWorldServer.GetMessage() in f:\EndToEndHelloWorld\HelloWorldService\Program.cs:line 17 at LocalServiceTest.Program.Main(String[] args) in F:\EndToEndHelloWorld\LocalServiceTest\Program.cs:line 13 at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()
When I put the config info in the App.config of the calling exe file it gives the following exception:
System.ArgumentException was unhandled Message="The default entity container name 'HelloWorldDBModel.HelloWorldDB' is invalid. The required mapping and metadata information could not be found.\r\nParameter name: defaultContainerName" Source="System.Data.Entity" ParamName="defaultContainerName" StackTrace: at System.Data.Objects.ObjectContext.CreateMapConnection(String connectionString, String defaultContainerName) at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName) at HelloWorldDBModel.HelloWorldDB..ctor(String connectionString) in f:\EndToEndHelloWorld\ModelObject1\obj\Debug\ModelObject1.Model.cs:line 101 at HelloWorldService.HelloWorldServer.GetMessage() in f:\EndToEndHelloWorld\HelloWorldService\Program.cs:line 17 at LocalServiceTest.Program.Main(String[] args) in F:\EndToEndHelloWorld\LocalServiceTest\Program.cs:line 13 at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()
How do I config the entities in a dll
- 5
- LINQ Project General Cannot insert a subclass if it is really stored in a table associated with its parent
Hi,
I have been enjoying the incredible advances visible in the LINQ May 2006 CTP. I have followed the instructions in the DLink Designer Doc, creating a table Person with a type (discriminator) column for polymorphism. This table is to store not only persons but also employees, which have an additional property for Managers which of course is really a column of the Person table.
The problem appears when I want to insert an Employee. I have created a form with the following partial code:
------------------------
NorthwindDataContext dc = new NorthwindDataContext(); BindingList<Employee> persons; private void Form1_Load(object sender, EventArgs e) { var results = from emp in dc.Persons where emp is Employee select (Employee)emp;
this.persons = results.ToBindingList();
this.employeeBindingSource.DataSource = this.persons; }
private void employeeBindingNavigatorSaveItem_Click(object sender, EventArgs e) { this.dc.SubmitChanges(); }
private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e) { int largestId = dc.Persons.Max( p => p.ID); Employee emp = this.persons[this.persons.Count-1]; emp.ID = largestId + 1; emp.Type = 2; } -----------------------
No error is given on save but the new employee does not get saved. And of course, it is understandable since the row type is Person not Employee.
this is why it seems to me to be an issue of how to deal with operations on subclasses.
Any light
Best regards,\
Juan Dent
- 6
- Visual Studio MSBuild More info on sgen.exe and why it fails.
I am trying to build a project in VS 2005 but I am getting the error:
Error 67 "sgen.exe" exited with code 1. C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets 1892 9 TAI.Util
This project had been building just fine earlier today. The only thing that happened between is I refreshed the web references in this project. As a test I added the same web references to a new project and it builds just fine.
- 7
- Windows Presentation Foundation (WPF) How to instantiate PropertyPath for the StoryBoard with the Dependency property in C#?
Hi All
Below is the Xaml Code which is working as per the need to animate an image. I am tring to animate the same image through C#. Can Someone help in Setting the Storyboard.TargetProperty in C#.
How to instantiate PropertyPath for the StoryBoard with the Dependency property for Image Translate.XProperty in C# as shown below eg. (UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X) which is in XAML.
< Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ccl="clr-namespace:CustomControlLibrary;assembly=CustomControlLibrary"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/interactivedesigner/2006"
mc:Ignorable="d"
Background="#FFFFFFFF"
x:Name="DocumentRoot"
x:Class="Animation.SampleMouseAnimation"
Width="640" Height="480">
< Grid.Resources>
< Storyboard x:Key="OnLoaded">
< DoubleAnimationUsingKeyFrames BeginTime="00:00:01" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)" Storyboard.TargetName="Button">
< SplineDoubleKeyFrame KeySpline="0.5,0.5,0.5,0.5" Value="370" KeyTime="00:00:00"/>
< SplineDoubleKeyFrame KeySpline="0.5,0.5,0.5,0.5" Value="11" KeyTime="00:00:10.9580000"/>
</ DoubleAnimationUsingKeyFrames>
< DoubleAnimationUsingKeyFrames BeginTime="00:00:01" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.Y)" Storyboard.TargetName="Button">
< SplineDoubleKeyFrame KeySpline="0.5,0.5,0.5,0.5" Value="224" KeyTime="00:00:00"/>
< SplineDoubleKeyFrame KeySpline="0.5,0.5,0.5,0.5" Value="19" KeyTime="00:00:10.9580000"/>
</ DoubleAnimationUsingKeyFrames>
</ Storyboard>
</ Grid.Resources>
< Grid.Triggers>
< EventTrigger RoutedEvent="FrameworkElement.Loaded">
< BeginStoryboard x:Name="OnLoaded_BeginStoryboard" Storyboard="{DynamicResource OnLoaded}"/>
</ EventTrigger>
</ Grid.Triggers>
< Grid.ColumnDefinitions>
< ColumnDefinition/>
</ Grid.ColumnDefinitions>
< Grid.RowDefinitions>
< RowDefinition Height="*"/>
</ Grid.RowDefinitions>
< Image HorizontalAlignment="Left" VerticalAlignment="Top" Margin="89,107,0,0" Width="16" Height="31" x:Name="Button" Source="C:\Documents and Settings\tsinha\My Documents\Interactive Designer Projects\UntitledProject1\mouse11.JPG" RenderTransformOrigin="0.5,0.5" Grid.Row="0">
< Image.RenderTransform>
< TransformGroup>
< TranslateTransform X="0" Y="0"/>
</ TransformGroup>
</ Image.RenderTransform>
</ Image>
</ Grid>
C# Code:
using System;
using System.IO;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.ComponentModel;
namespace Animation
{
public partial class Sample:Page
{
private string _targetName = "mouseImage";
private string _xtargetProperty = "(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)";
private string _ytargetProperty = "(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.Y)";
private double _xBeginTime = 5;
public string TargetName
{
get { return _targetName; }
set { _targetName = value; }
}
public string XTargetProperty
{
get { return _xtargetProperty; }
set { _xtargetProperty = value; }
}
public string YTargetProperty
{
get { return _ytargetProperty; }
set { _ytargetProperty = value; }
}
public Image mouseImage;
public Sample()
{
mouseImage = new Image();
mouseImage.HorizontalAlignment = HorizontalAlignment.Left;
mouseImage.VerticalAlignment = VerticalAlignment.Top;
mouseImage.Margin = new Thickness(89, 107, 0, 0);
mouseImage.Width = 16;
mouseImage.Height = 31;
BitmapImage bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.UriSource = new Uri("C:\\Documents and Settings\\tsinha\\My Documents\\Interactive Designer Projects\\UntitledProject1\\mouse11.JPG");
bitmap.EndInit();
mouseImage.Source = bitmap;
mouseImage.RenderTransformOrigin = new Point(0.5, 0.5);
TransformGroup imgTransformGroup = new TransformGroup();
TranslateTransform tt = new TranslateTransform(0,0);
imgTransformGroup.Children.Add(tt);
mouseImage.RenderTransform = imgTransformGroup;
mouseImage.Name = TargetName;
// Create a name scope for the page.
NameScope.SetNameScope(this, new NameScope());
this.RegisterName(TargetName, mouseImage);
DoubleAnimationUsingKeyFrames xDoubleAnimationUsingKeyFrames = new DoubleAnimationUsingKeyFrames();
xDoubleAnimationUsingKeyFrames.BeginTime = TimeSpan.FromMilliseconds(_xBeginTime);
SplineDoubleKeyFrame xSplineDoubleKeyFrame1 = new SplineDoubleKeyFrame();
xSplineDoubleKeyFrame1.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(0));
KeySpline xKeySpline1 = new KeySpline(0.5, 0.5, 0.5, 0.5);
xSplineDoubleKeyFrame1.KeySpline = xKeySpline1;
xSplineDoubleKeyFrame1.Value = 370;
SplineDoubleKeyFrame xSplineDoubleKeyFrame2 = new SplineDoubleKeyFrame();
xSplineDoubleKeyFrame2.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(10.9580000));
KeySpline xKeySpline2 = new KeySpline(0.5, 0.5, 0.5, 0.5);
xSplineDoubleKeyFrame2.KeySpline = xKeySpline2;
xSplineDoubleKeyFrame2.Value = 11;
xDoubleAnimationUsingKeyFrames.KeyFrames.Add(xSplineDoubleKeyFrame1);
xDoubleAnimationUsingKeyFrames.KeyFrames.Add(xSplineDoubleKeyFrame2);
//Y Co-ordinate
DoubleAnimationUsingKeyFrames yDoubleAnimationUsingKeyFrames = new DoubleAnimationUsingKeyFrames();
yDoubleAnimationUsingKeyFrames.BeginTime = TimeSpan.FromMilliseconds(_xBeginTime);
SplineDoubleKeyFrame ySplineDoubleKeyFrame1 = new SplineDoubleKeyFrame();
ySplineDoubleKeyFrame1.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(0));
KeySpline yKeySpline1 = new KeySpline(0.5, 0.5, 0.5, 0.5);
ySplineDoubleKeyFrame1.KeySpline = xKeySpline1;
ySplineDoubleKeyFrame1.Value = 224;
SplineDoubleKeyFrame ySplineDoubleKeyFrame2 = new SplineDoubleKeyFrame();
ySplineDoubleKeyFrame2.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(10.9580000));
KeySpline yKeySpline2 = new KeySpline(0.5, 0.5, 0.5, 0.5);
ySplineDoubleKeyFrame2.KeySpline = xKeySpline2;
ySplineDoubleKeyFrame2.Value = 19;
yDoubleAnimationUsingKeyFrames.KeyFrames.Add(ySplineDoubleKeyFrame1);
yDoubleAnimationUsingKeyFrames.KeyFrames.Add(ySplineDoubleKeyFrame2);
// Create a name scope for the page.
NameScope.SetNameScope(this, new NameScope());
Storyboard.SetTargetProperty(xDoubleAnimationUsingKeyFrames, new PropertyPath(TranslateTransform.XProperty));
Storyboard.SetTargetName(yDoubleAnimationUsingKeyFrames, TargetName);
Storyboard.SetTargetProperty(yDoubleAnimationUsingKeyFrames, new PropertyPath(TranslateTransform.YProperty));
Storyboard mouseImageStoryboard = new Storyboard();
//mouseImageStoryboard.Children.Add(myDoubleAnimation);
mouseImageStoryboard.Children.Add(xDoubleAnimationUsingKeyFrames);
mouseImageStoryboard.Children.Add(yDoubleAnimationUsingKeyFrames);
ResourceDictionary resourceStoryBoard = new ResourceDictionary();
resourceStoryBoard.Add( "mouseImageStoryboard", mouseImageStoryboard);
Grid grid = new Grid();
grid.Width = 640 ;
grid.Height = 480;
grid.Resources = resourceStoryBoard;
ColumnDefinition col = new ColumnDefinition();
grid.ColumnDefinitions.Add(col);
RowDefinition row = new RowDefinition();
row.Height = GridLength.Auto;
grid.RowDefinitions.Add(row);
Grid.SetRow(mouseImage, 0);
BeginStoryboard beginStoryboard = new BeginStoryboard();
beginStoryboard.Storyboard = mouseImageStoryboard;
EventTrigger mouseImageTrigger = new EventTrigger();
mouseImageTrigger.RoutedEvent = Image.LoadedEvent;
mouseImageTrigger.Actions.Add(beginStoryboard);
grid.Triggers.Add(mouseImageTrigger);
grid.Children.Add(mouseImage);
this.Content = grid;
this.Loaded += delegate(object sender, RoutedEventArgs args)
{
mouseImageStoryboard.Begin(mouseImage);
};
}
}
}
Tuhin
- 8
- Windows Communication Foundation ("Indigo") How do I get WSHttpBinding to work on a clientI can run a WCF client and WCF Service on the same machine using BasicHttpBinding, and I can get the cleint to run on a remote machine.
I take the same code for both client and service and replace BasicHttpBinding with WSHttpBinding, and the Service and client will work on the same machine properly.
However, when I take the cleint (Containing WSHttpBinding) and access the WCF Service (also containing WSHttpBinding) from a REMOTE client, the client fails with the following error:
Unhandled Exception: System.ServiceModel.Security.MessageSecurityException: An u nsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail. ---> System.ServiceModel.Fa ultException: An error occurred when verifying security for the message.
How can I get the WCF client containing WSHttpBinding to work properly on a remote client
- 9
- Visual Studio Tools for Office Assembly * cound not be found
Hi All,
I just installed VSTO SE (last version), and created WordAddIn , and just compiled, it give me three Error
Error 1: The type or namespace name 'AddIn' does not exist in the namespace 'Microsoft.Office.Tools' (are you missing an assembly reference ) C:\code\WordAddIn4\WordAddIn4\ThisAddIn.Designer.cs 19 68 WordAddIn4
Error 2: The type or namespace name 'IStartup' does not exist in the namespace 'Microsoft.VisualStudio.Tools.Applications.Runtime' (are you missing an assembly reference ) C:\code\WordAddIn4\WordAddIn4\ThisAddIn.Designer.cs 19 125 WordAddIn4
Error 3: The type or namespace name 'ICachedDataProvider' does not exist in the namespace 'Microsoft.VisualStudio.Tools.Applications.Runtime' (are you missing an assembly reference ) C:\code\WordAddIn4\WordAddIn4\ThisAddIn.Designer.cs 31 67 WordAddIn4
I add many different Assembly include those one in GAC , Office12 .... is still i me getting this Error
Any help Apperciate in advance! -:)
Reza
- 10
- Windows Presentation Foundation (WPF) Corrupt Back Buffer?
I have a fairly complex app that suddenly has been displaying what looks like a corrupt back buffer... as if the backing store for the window is confused about it's size or something.
When the app starts everything looks fine, but whenever i mouse over any control that changes state on mouse over, the whole rest of the window gets corrupted with what looks like the right image render with the wrong "width" if you know what i mean.
There are no errors in the debug output while this happens...
Here's what it looks like before I mouse over the button:
http://i126.photobucket.com/albums/p110/xamlgeek/notcorrupt.png
And here what it looks like after:
http://i126.photobucket.com/albums/p110/xamlgeek/corrupt.png
Is this a driver issue And if so, why did it just start happening today after months of never seeing it. I have refactored a bunch of my code, but done nothing really new or trickier...
This is on Windows XP Pro SP2, Dell D-820 laptop, RC1 WPF bits, NVidia Quadro NVS 120M
- 11
- 12
- Windows Presentation Foundation (WPF) XMLDataProvider and node subitem Databinding question
Hi,
My client have a XML data source containing a list of elements' records;
any record contains multiple fields which will bound to a listview;
one of the fields contains a sub XML structure which represents the Details of one record.
To avoid any discussions, I can't change the data structure...
The goal is to display the list of records into a Grid or Listview and when a record is selected,
to display the XML details into a Treeview in the right of the Grid like a master details form except both are contained by same record.
Anybody can give some hint to do this
Thxs in advance
-Vince
Thxs
-Vince
- 13
- Visual Studio Extensibility Enterprise Library
Has anyone used Enterprise Library in their VSPackage implementations I'm trying to use the Exception Handling Block, but having some difficulties, since the actual application is devenv.exe.
Thanks,
Mike
- 14
- 15
|
| Author |
Message |
Kent Boogaart

|
Posted: Windows Presentation Foundation (WPF), Unit Testing with WPF + MVP |
Top |
Hi,
I'm trying to suss out the best way to unit test presenters with WPF views in a multithreading scenario. This is easiest to explain via code. Here's a view interface:
public interface ISearchView { Dispatcher Dispatcher { get; }
SearchCriteria SearchCriteria { set; }
SearchResults SearchResults { set; }
event EventHandler<EventArgs> PerformSearch; }
The implementation of this interface is a WPF user control that binds various child controls to the search criteria to enable the user to edit the criteria prior to searching. The PerformSearch event is raised whenever the user clicks the search button. The Dispatcher property gets the view's dispatcher so the presenter can pass results back to it safely.
The presenter code looks something like this:
public class SearchPresenter { private readonly ISearchView _view; private readonly SearchCriteria _searchCriteria;
public SearchPresenter(ISearchView view) { _searchCriteria = new SearchCriteria(); _view = view; _view.SearchCriteria = _searchCriteria; _view.PerformSearch += View_PerformSearch; }
private void ViewPerformSearch(object sender, EventArgs e) { DoSearch(); }
private void DoSearch() { _view.Results = null;
ThreadPool.QueueUserWorkItem(delegate { //search logic is here - it might take a while to execute
//search is finished - assign results to view _view.Dispatcher.Invoke(DispatcherPriority.Send, new AssignHandler(Assign), results); }); } }
This all works fine and the beauty is that the view has no idea that the search is taking place on a separate thread. It doesn't need to know. We could change the presenter so that it is single-threaded or only switches to a separate thread in certain circumstances and the view would be none the wiser. Also, the view code is kept much simpler as a result.
The problem occurs during unit testing and, specifically, mocking the view's interface. The Dispatcher class is sealed and only has private constructors. The only way to get a Dispatcher is via the static CurrentDispatcher property. This makes it extremely cumbersome and hard, if not impossible, to unit test this code.
I have thought of only a couple of workarounds:
- Put the thread-safety code into the view implementation, and just have the presenter assign the results directly rather than via the dispatcher.
- Define my own IDispatcher interface and two implementations of this interface: DispatcherWrapper and MockDispatcher. DispatcherWrapper would wrap WPF's Dispatcher class and MockDispatcher would be used in unit testing. Views would expose an IDispatcher instead of a Dispatcher.
I don't like option 1 because it complicates the view implementation and requires it to understand the threading context in which it is running. I don't like 2 because, well, it's ugly and requires more work.
Any help much appreciated.
Thanks, Kent Boogaart
Visual Studio 20084
|
| |
|
| |
 |
| |
 |
Index ‹ Visual Studio 2008 ‹ Windows Presentation Foundation (WPF) |
- Next
- 1
- 2
- Windows Communication Foundation ("Indigo") Serialization issues with XmlElement and DataContrac
Hello all ,
I just sorted out my inheritance issues and now have an issue where an Xml element when serialized has xmlns="" inserted .
ie
<CommsMessage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:q1="http://tempuri.org/" xsi:type="q1:AckMessage"> <q1:MessagesToAck><q1:string>urn:uuid:11a072c0-4b78-44b1-b2ec-9ea6cda90b07</q1:string></q1:MessagesToAck> </CommsMessage>
the proxy changes it to
<CommsMessage xsi:type="q1:AckMessage" xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:q1="http://tempuri.org/"> <q1:MessagesToAck> <q1:string>urn:uuid:11a072c0-4b78-44b1-b2ec-9ea6cda90b07</q1:string> </q1:MessagesToAck> </CommsMessage>
as you can see from the log
2006-10-31 05:44:18.030,<MessageLogTraceRecord Time="2006-10-31T16:44:18.0295600+11:00" Source="ServiceLevelReceiveRequest" Type="System.ServiceModel.Channels.MessagePatterns+PatternMessage" xmlns="http://schemas.microsoft.com/2004/06/ServiceModel/Management/MessageTrace"><s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><a:Action s:mustUnderstand="1">Store</a:Action><a:MessageID>urn:uuid:c1650b91-ff21-44b3-9d3e-85ec74b56c07</a:MessageID><a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo><a:To s:mustUnderstand="1">net.tcp://adswebsrvr:8032/MessageStorageService</a:To></s:Header><s:Body><StoreMessage xmlns="http://STE.MessageStorage.ServiceContracts/2006/08/"><Topic>HandScanner:SerialNumber.TestScanner</Topic><Message xmlns="http://tempuri.org/" xmlns:b="STE.MessageStorage.DataContract" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><b:Identifier>urn:uuid:5e250015-dc7a-4752-9cdb-47dfc0769d9b</b:Identifier><b:MessageBody><CommsMessage xsi:type="q1:AckMessage" xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:q1="http://tempuri.org/"><q1:MessagesToAck><q1:string>urn:uuid:6b6cf44a-8ebd-4772-afba-bb36fabef6ec</q1:string></q1:MessagesToAck></CommsMessage></b:MessageBody></Message></StoreMessage></s:Body></s:Envelope></MessageLogTraceRecord>
2006-10-31 05:44:17.983, message to client <CommsMessage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:q1="http://tempuri.org/" xsi:type="q1:AckMessage"><q1:MessagesToAck><q1:string>urn:uuid:6b6cf44a-8ebd-4772-afba-bb36fabef6ec</q1:string></q1:MessagesToAck></CommsMessage>
I could prob go to XmlSerializer but dont want to change the service.
Any ideas will be appreciated.
Regards,
Ben
PS: sorry for the badly formatted code.
private void SendMessageToClient(CommsMessage message)
{
string deviceId = OperationContext.Current.IncomingMessageProperties[DEVICE_ID] as string;
string topic = new MessageStoreTopic().SerialNumberToTopic(deviceId);
IMessageStorageService client = new MessageStorageServiceClient();
//XmlElement element = XmlHelper.ObjectToXml(message);
System.Xml.Serialization. XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(CommsMessage),
new Type[3] {
typeof(DriverLoginResponseMessage),
typeof(AckMessage),
typeof (ErrorMessage)
}
);
XmlDocument doc = new XmlDocument();
using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
{
XmlWriter xtw = XmlTextWriter.Create(ms, null);
// XmlSerializer xs = new XmlSerializer(message.GetType());
xs.Serialize(xtw, message);
ms.Position = 0;
doc.Load(ms);
}
Logger.Write(" message to client " + doc.DocumentElement.OuterXml); // Correct
AckMessage ackMessage = new AckMessage();
ackMessage.MessagesToAck = new MessagesList();
ackMessage.MessagesToAck.Add( "test123" );
XmlDocument doc2 = new XmlDocument();
using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
{
XmlWriter xtw = XmlTextWriter.Create(ms, null);
// XmlSerializer xs = new XmlSerializer(message.GetType());
xs.Serialize(xtw, ackMessage);
ms.Position = 0;
doc2.Load(ms);
}
Logger.Write(" message to client test " + doc2.DocumentElement.OuterXml);
MessageHolder holder = new MessageHolder();
holder.Identifier = new System.Xml.UniqueId().ToString();
holder.MessageBody = doc.DocumentElement;
// holder.MessageBody.SetAttribute(holder.MessageBody.Name, @"http://tempuri.org/"); // hack could strip for storage
StoreMessage messageToStore = new StoreMessage(topic , holder);
client.StoreMessage(messageToStore);
} // SendMessageToClient
Proxy -----------------------------------------------------------------
[System.CodeDom.Compiler. GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")]
[System.Runtime.Serialization. DataContractAttribute(Namespace="STE.MessageStorage.DataContract")]
[System. SerializableAttribute()]
public partial class MessageHolder : object, System.Runtime.Serialization.IExtensibleDataObject
{
[System. NonSerializedAttribute()]
private System.Runtime.Serialization.ExtensionDataObject extensionDataField;
[System.Runtime.Serialization. OptionalFieldAttribute()]
private string IdentifierField;
[System.Runtime.Serialization. OptionalFieldAttribute()]
private System.Xml.XmlElement MessageBodyField;
public System.Runtime.Serialization.ExtensionDataObject ExtensionData
{
get
{
return this.extensionDataField;
}
set
{
this.extensionDataField = value;
}
}
[System.Runtime.Serialization. DataMemberAttribute()]
public string Identifier
{
get
{
return this.IdentifierField;
}
set
{
this.IdentifierField = value;
}
}
[System.Runtime.Serialization. DataMemberAttribute()]
public System.Xml.XmlElement MessageBody
{
get
{
return this.MessageBodyField;
}
set
{
this.MessageBodyField = value;
}
}
}
[System.Diagnostics. DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler. GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.ServiceModel. MessageContractAttribute(WrapperName="StoreMessage", WrapperNamespace="http://STE.MessageStorage.ServiceContracts/2006/08/", IsWrapped=true)]
public partial class StoreMessage
{
[System.ServiceModel. MessageBodyMemberAttribute(Namespace="http://STE.MessageStorage.ServiceContracts/2006/08/", Order=0)]
public string Topic;
[System.ServiceModel. MessageBodyMemberAttribute(Namespace="http://tempuri.org/", Order=1)]
public STE.HandScanner.BusinessLogic.MessageStorageServiceProxy.MessageHolder Message;
public StoreMessage()
{
}
// added namepsace to holder no change
public StoreMessage(string Topic, STE.HandScanner.BusinessLogic.MessageStorageServiceProxy.MessageHolder Message)
{
this.Topic = Topic;
this.Message = Message;
}
}
[System.Diagnostics. DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler. GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
public partial class MessageStorageServiceClient : System.ServiceModel.ClientBase<STE.HandScanner.BusinessLogic.MessageStorageServiceProxy.IMessageStorageService>, STE.HandScanner.BusinessLogic.MessageStorageServiceProxy.IMessageStorageService
{
public MessageStorageServiceClient()
{
}
public MessageStorageServiceClient(string endpointConfigurationName) :
base(endpointConfigurationName)
{
}
public MessageStorageServiceClient(string endpointConfigurationName, string remoteAddress) :
base(endpointConfigurationName, remoteAddress)
{
}
public MessageStorageServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
base(endpointConfigurationName, remoteAddress)
{
}
public MessageStorageServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress)
{
}
STE.HandScanner.BusinessLogic.MessageStorageServiceProxy. StoreResponseMessage STE.HandScanner.BusinessLogic.MessageStorageServiceProxy.IMessageStorageService.StoreMessage(STE.HandScanner.BusinessLogic.MessageStorageServiceProxy.StoreMessage request)
{
return base.Channel.StoreMessage(request);
}
public string StoreMessage(string Topic, STE.HandScanner.BusinessLogic.MessageStorageServiceProxy.MessageHolder Message)
{
STE.HandScanner.BusinessLogic.MessageStorageServiceProxy. StoreMessage inValue = new STE.HandScanner.BusinessLogic.MessageStorageServiceProxy.StoreMessage();
inValue.Topic = Topic;
inValue.Message = Message;
STE.HandScanner.BusinessLogic.MessageStorageServiceProxy. StoreResponseMessage retVal = ((STE.HandScanner.BusinessLogic.MessageStorageServiceProxy.IMessageStorageService)(this)).StoreMessage(inValue);
return retVal.UniqueId;
}
- 3
- Visual Studio Tools for Office How to associate an icon with a Message Class to display in folder views (VSTO 2005 SE + C#)?
I am currently writing an add-in for Outlook 2007 with VSTO 2005 SE.
I have used a form region with a formRegionType of replaceAll which is associated in the registry to the message class IPM.Post.MyPost. My add-in works as expected with a compose and a read form.
I am in the stage of polishing the GUI with icons and proper ribbons. One requirement is to display the folder items with one of two icons depending on item status.
My initial thought was to define the <icons> in the form region manifest but it does not seem to have any effect.
< xml version="1.0" encoding="utf-8" > <FormRegion xmlns="http://schemas.microsoft.com/office/outlook/12/formregion.xsd"> ... <icons> <default>icon.png</default> <read>icon.png</read> <unread>icon.png</unread> <window>icon.png</window> </icons> </FormRegion>
Note that there is no custom form. In tehse circumstances, what is the proper way to achieve the above
Thank you for your help.
- 4
- 5
- Windows Communication Foundation ("Indigo") Using the Hands-On labs with September CTP
Ok I figured out a few of the things I needed to change to make the InterceptorBinding code work in the advanced WCF hands on lab that initially targeted the June CTP. What I'm not able to figure out is this change to no longer use the "InnerChannelListener" from the ChannelListenerBase. I've found a handful of postings on using "GetProperty" to do it but I have not been able to implement it. This is confusing me a little, can someone explain this Below is my code for the InnerChannelListener property that does not like my setter because it's not setting an actual variable:
public IChannelListener<TChannel> InnerChannelListener {
get { return (IChannelListener<TChannel>)base.GetProperty<TChannel>() ; }
set { (IChannelListener<TChannel>)base.GetProperty<TChannel>() = value; }
}
- 6
- 7
- Windows Presentation Foundation (WPF) How to use resource in dll ?
I want use MeshGeometry3D resource in dll project ,but can not run
below is my code and resource .
//resource myDictionary.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <MeshGeometry3D x:Key="SphereMesh" TriangleIndices="0 1 2 3 2 4 5 4 6... <MeshGeometry3D.Positions> <Point3DCollection> 0,42.529461,0 0,41.712269,-8.2970867 -1.618682,... </Point3DCollection> </MeshGeometry3D.Positions> <MeshGeometry3D.Normals> <Vector3DCollection> 0,1,0 0,0.97959799,-0.200969 -0.039207, ... </Vector3DCollection> </MeshGeometry3D.Normals> <MeshGeometry3D.TextureCoordinates> <PointCollection> 0.015625,0 0,0.0625 0.03125,0.0625 0.046875 ... </PointCollection> </MeshGeometry3D.TextureCoordinates> </MeshGeometry3D> </ResourceDictionary>
//code
MeshGeometry3D MeshSphere = (MeshGeometry3D)Application.Current.FindResource("SphereMesh");
thanks !!
- 8
- 9
- Windows Presentation Foundation (WPF) Binding problem after selection on ListView
I have created a binding style1 which binds SelectedItem to a DependencyProperty and is programmatically applied to a control.
If a style is applied to a control before making selection the binding works, but if a selection is made first and style is applied after that the selection binding will not work...
Is that a bug.. or am I missing something (Try this code and see if you hit the breakpoint)
< Window x:Class="BorkenBindingAfterStyleSwitch.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="BorkenBindingAfterStyleSwitch" Height="395" Width="499"
Name="root">
< Grid>
< Button Height="31" HorizontalAlignment="Right" Margin="0,29,28,0" Name="button1" VerticalAlignment="Top" Width="129" Click="ShowStyle1">style1</Button>
< Button Height="31" HorizontalAlignment="Right" Margin="0,71,28,0" VerticalAlignment="Top" Width="129" Click="ShowStyle2">style2</Button>
< ListView Height="96" Margin="21,22,0,0" Name="listView1" VerticalAlignment="Top" HorizontalAlignment="Left" Width="120">
< TextBlock Text="string1"/>
< TextBlock Text="string2"/>
</ ListView>
</Grid>
</ Window>
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
public partial class Window1 : System.Windows.Window
{
public Window1()
{
InitializeComponent();
}
public static readonly DependencyProperty SelectionProperty =
DependencyProperty.Register("Selection",
typeof(object),
typeof(Window1),
new FrameworkPropertyMetadata(null, new PropertyChangedCallback(Callback)));
public object Selection
{
get { return (object)GetValue(SelectionProperty); }
set { SetValue(SelectionProperty, value); }
}
private static void Callback(DependencyObject obj, DependencyPropertyChangedEventArgs e)
{
// property changed
// SET BREAKPOINT HERE
}
private void ShowStyle1(object sender, RoutedEventArgs e)
{
this.listView1.Style = Application.Current.FindResource("style1") as Style;
}
private void ShowStyle2(object sender, RoutedEventArgs e)
{
this.listView1.Style = Application.Current.FindResource("style2") as Style;
}
}
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
< Application x:Class="BorkenBindingAfterStyleSwitch.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="Window1.xaml"
>
< Application.Resources>
< Style x:Key="style1" TargetType ="{x:Type ListView}">
< Setter Property="SelectedItem" Value="{Binding Selection, ElementName=root}"/>
< Setter Property="Background" Value="green"/>
</ Style>
< Style x:Key="style2" TargetType ="{x:Type ListView}">
< Setter Property="SelectedItem" Value="{x:Null}"/>
< Setter Property="Background" Value="yellow"/>
</ Style>
</ Application.Resources>
</Application>
- 10
- Visual Studio Extensibility VS local variables extensible? Blocking issueHi,
I added an option in the context menu when you right-click on a local variable while debugging.
Now I can't figure out how to get the currently selected variable (ie variable right-clicked on). The local variable list do not seam to work with IVsMonitorSelection and IVsSelectionEvents. I also tried with the DTE which exposes the local variables but it has no information on what is selected. The debugger API do not allow me to obtain this information either as far as my research went.
Finally, with spy++ I can find the hwnd of the list which is of type TREEGRID with no child windows. Can you provide any information on how to access the treegrid information or another way to get the currently selected local variable
This is a blocking issue for me.
Thanks Charles Verdon
- 11
- Visual Studio MSBuild Compile Release Config using MSBuild from Web Application
I am trying to use MSBuild from within ASP.NET code to compile a project using the Release Configuration. Doing so logs the following in my log file. When I executed the same code without trying to change the Configuration I had no problem.
Build started 10/30/2006 6:20:57 PM. __________________________________________________ Project "C:\Documents and Settings\joness\My Documents\Visual Studio 2005\Projects\ClassLibrary1\ClassLibrary1.sln" (default targets):
Target ValidateSolutionConfiguration: Building solution configuration "Release|Any CPU". Target Build: Target ClassLibrary1: __________________________________________________ Project "C:\Documents and Settings\joness\My Documents\Visual Studio 2005\Projects\ClassLibrary1\ClassLibrary1.sln" is building "C:\Documents and Settings\joness\My Documents\Visual Studio 2005\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj" (default targets):
Target CoreCompile: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:TRACE /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /debug:pdbonly /optimize+ /out:obj\Release\ClassLibrary1.dll /target:library Class1.cs Properties\AssemblyInfo.cs CSC : fatal error CS0007: Unexpected common language runtime initialization error -- 'Class not registered ' Done building target "CoreCompile" in project "ClassLibrary1.csproj" -- FAILED.
Done building project "ClassLibrary1.csproj" -- FAILED.
Build FAILED. CSC : fatal error CS0007: Unexpected common language runtime initialization error -- 'Class not registered ' 0 Warning(s) 1 Error(s)
Time Elapsed 00:00:00.09
The code that I am using (right now, I've tried many things) is:
Microsoft.Build.BuildEngine.Engine msBuild; Microsoft.Build.BuildEngine.FileLogger logger;
msBuild = new Microsoft.Build.BuildEngine.Engine(); msBuild.BinPath = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory();
logger = new Microsoft.Build.BuildEngine.FileLogger(); logger.Parameters = @"logfile=C:\build.log"; msBuild.RegisterLogger(logger); msBuild.OnlyLogCriticalEvents = false;
Microsoft.Build.BuildEngine.Project project = new Microsoft.Build.BuildEngine.Project(msBuild); project.Load(projToCompile);
foreach (Microsoft.Build.BuildEngine.BuildPropertyGroup pg in project.PropertyGroups) { pg.AddNewProperty("Configuration", "Release"); }
result = msBuild.BuildProject(project); msBuild.UnregisterAllLoggers();
- 12
- LINQ Project General Insert image with dlinq
I want to do the following
var qry =
from c in db.Customer
select c;
foreach (var cust in qry)
{
cust.Photo = pictureBox1.Image;// won't compile why
};
isn't this the way it should work
cust.Photo.PropertyType = System.Byte[]
cust.ServerType = image
- 13
- 14
- Visual Studio Tools for Office Errors loading add-ins created with VSTO SE
Hi, I have a problem that was not there in VSTO V3. But now after installing VSTO SE Beta the addins that works in Office 2007 Beta2 CTP are no longer working in Office 2007 Beta2TR. Word Options Add-ins list it under inactive add-ins. In COM Add-ins it says under Load Behaviour "Not Loaded. A runtime error occurred during the loading of the COM add-in". The errors is not displayed even though the "Show add-in user interface errors checkbox" is checked. If the VSTO project is executed by clicking the debug button the addin work perfectly. The error only occurred when installed by double clicking the setup.exe in debug folder or by right clicking the Setup project in VSTO and installing it. This is true for addins created for PowerPoint too. Registry entries are the same when installed in any of the way mentioned above. So I guess the registry entries are ok. Iam using VSTO SE Beta with Visual Studio 2005 prof. and Office 2007 Beta2TR. The error occurred in both WinXP and Vista. Please kindly give me a pointer on this. Thanks
- 15
- Visual Studio Tools for Office New Inspector Event does not fire in MS-Outlook 2007
I am trying to execute 2 Addins in MS-Outlook 2007.
AddIn1 : Made using AddInExpress
AddIn2 : Made using VSTO
AddIn1 makes a folder in mail items of MS-Outlook 2007 and when we select that it starts functioning.
Addin2 works starts functioning when a contact item is open in new inspector window. It displays a CustomTaskPane that executes a standalone application.
I have tested the following scenarios.
1) AddIn2 fires New Inspector Event when MS-Outlook 2007 is started and first contact is opened in new Inspector.
2) AddIn2 does not fire New Inspector Event when contacts are opened after closing the New Inspector window
3) Addin2 does not fire New Inspector Event when we click the folder created by AddIn1.
Can any one help me why New Inspector event does not fire in some cases
|
|
|