Enrique posted on January 13, 2010 13:07

I’m going to quickly post the solution to this issue since its late ..or too early 5:41 a.m EST  basically when working with WPF using  CAL-PRISM- or whatever you want to call the Composite Application Guidance for WPF and Silverlight and you want to show a popup window you may want to use the WindowRegionAdapter from the WPF Contrib project   the problem is when you close the windows you may have the exception {"Cannot change ObservableCollection during a CollectionChanged event."}

 

private void window_Closed(object sender, EventArgs e)
{
Window window = sender as Window;
IRegion region = _regionWeakReference.Target as IRegion;
if (window != null && region != null)
if (region.Views.Contains(window.Content))
region.Remove(window.Content);//exception
                                             //Cannot change ObservableCollection 
                                             //during a CollectionChanged event."} 
}

 

 

 

I have made some changes to WindowRegionAdapter.cs in order to fix it and seems to be working, here are the changes:

add:

using System.Threading;
replace the  window_Closed  code for the code below:
 
class CloseWindwowCallbackParameter
{
    public IRegion theRegion { get; set; }
    public Window windowToClose { get; set; }
}
private void closeWindowinThread(object parameters)
{
    CloseWindwowCallbackParameter arguments = parameters as CloseWindwowCallbackParameter;
    IRegion region = arguments.theRegion;
    Window window = arguments.windowToClose;
    window.Dispatcher.Invoke(
                       System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate()
  {
      region.Remove(window.Content);
  }));
 
}
 
private void window_Closed(object sender, EventArgs e)
{
 
    Window window = sender as Window;
    IRegion region = _regionWeakReference.Target as IRegion;
    if (window != null && region != null)
        if (region.Views.Contains(window.Content))
        {
            WaitCallback callback = new WaitCallback(closeWindowinThread);
            ThreadPool.QueueUserWorkItem(callback, new CloseWindwowCallbackParameter 
                                                 {theRegion = region, windowToClose = window });
        }
}


Posted in: WPF  Tags: , ,
Enrique posted on October 23, 2009 08:06

In Visual Studio 2010, when working with the designer (WF, WPF, WEB…)  you can easily search for an specific item in your toolbox, just make the toolbox active (click anywhere in the toolbox window) type your search, you’ll see your search and options (Tab for next result, Esc to cancel) under the VS status bar but I think its just not as effective as the other searches implemented in VS 2010 as for example the Search implemented for the property grid.

image


Posted in: Misc  Tags: ,
Enrique posted on October 14, 2009 22:25

If you downloaded the RibbonControlsLibrary.dll  and having a hard time, for example I was having this error:

Undefined CLR namespace. The ‘clr-namespace’ URI refers to a namespace ‘Microsoft.Windows.Controls.Ribbon’ that is not included in the assembly.

you should read the comments found at the bottom of this post:

http://teusje.wordpress.com/2009/08/12/wpf-office-ribbon-control/

basically the dll is being blocked by the OS and visual studio is unable to load and use it, the solution is right click on the file and unblock it; after that  you may need to recreate(add\delete) the reference or\and open/close the solution again.

image

image


Posted in: WPF  Tags: , ,

If you are having the “'This TextNavigator' has no scoping text element.” exception working with the richtextbox control in WPF, probably you are manipulating the xaml "manually” and, at least in my case,  because an empty BlockUIContainer block.


Posted in: WPF  Tags: , ,
Enrique posted on October 2, 2009 18:08

I wanted to run my tests on each project build (CTRL-SHIft-B) I accomplished it using macros, here are the steps:

Make sure that you have a window where you can run the tests from visible , in my case I’m using Test Results because I had run a couple of test already but the same approach should work using Test View or Test List Editor)

  • First we need to record a macro to lunch the Tests

MacroRecorder

the macro toolbar will appear

image 

  • while recording the macro, click on the desire option to run the test, for example in my case I’ll click on “Run All Tests in Tests Results”

RunAllTests

  • if you are using the Test List Editor for example you should click on “Run Checked Test”

TestListEditor

  • Stop recording the macro using the macro toolbar.
  • Now open the Macros IDE

image

  • Under “MyMacros” Select the recording module

image

  • Cut the code generated under TemporaryMacro() and then from “MyMacros”  select (double click) EnviromentEvents
  • From the dropdowns select  BuildEvents and then OnBuildProjConfigDone

image

  • and then paste the code generated for the RecordingModule (the code should be in you clipboard from two steps above)
  • save it and ready to go… when you build your project you should see the tests running by themselves….

Posted in: Misc  Tags: , , ,
Enrique posted on February 26, 2007 18:31

If you are using the HTTP send adapter on BizTalk 2006 to send requests to an apache or other no-windows based http server  and getting the error “cannot access a disposed object. System.net.sockets.networkstream” probably you should read this KB you will need to 1-apply the hotfix mentioned 2-create a custom send pipeline with a custom pipeline component to set the keepalive property to false, I have created a a very simple one you can download it from here.


Calendar

«  March 2010  »
MoTuWeThFrSaSu
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234
View posts in large calendar

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010 BizTalkAnd .Net