Thursday, July 29, 2010

"Microsoft Messenger Daemon" is still in use

Well, not to sully the Microsoft name - this could happen to any other application on a Mac - replace "Microsoft Messenger" with any other which would not uninstall completely and keep files in the trash.
To begin with, I was having issues with the Microsoft messenger on my iMac. Though it works perfectly well on my MacBookPro it somehow decided it doesn't want to find the system available after a few minutes and sign out.
To uninstall the messenger I decided to try out the "AppCleaner" application for a 'clean' uninstall. But, it still left some files in the Trash and I wasn't able to empty the bin cause the daemon (an part of an application which keeps running in the background where it does not get in the way of other stuff) was still running!
On trying to find out the simplest way to get over this I couldn't get a straight answer quickly, though after doing this it is pretty simple:
1. Use spotlight or Quicksilver to find Activity Monitor (this is found in the Applications -> Utilities -> Activity Monitor)
2. On the top bar there is a drop down menu for the selection of type of processes to display. Use the 'All Processes' display (just to be sure)
3. In the name column there is an entry for "Microsoft Messenger Daemon" -> use the 'Quit Process' button on the top bar to Quit / Force Quit the daemon
4. Try to empty the Trash

Now it goes away without any error!

Tuesday, August 26, 2008

Report Viewer in WPF application

I have started working on a WPF application which has to display some data in a graphical manner. Instead of using the different available charting tools, I decided to use the report facility inbuilt in the Visual Studio to display .
Visual Studio allows for binding objects as the report's data source to create an local report. On trying to achieve my purpose, I came across a few difficulties and on spending some time through various posts and forums I got the basic direction, so thought of consolidating my learning and putting it up.

The problems I came across were as folows:


  • Report viewer is not available as a native control in WPF applications, and therefore it could not be placed in the application.

  • Binding the data source (the object) to the report.

To solve these couple of issues, I went about it in the following way:



  • Since the report viewer is not available on WPF, but on Windows Forms - I used WindowsFormsHost to integrate the report viewer control with the WPF form. WindowsFormsHost is the implementation from Microsoft, which would have other wise required me to derive a class from the HwndHost base class, to add a HWND to my WPF application to host Windows Form control.


  1. I added the following references to my project: Microsoft.ReportViewer.Common, Microsoft.ReportViewer.WinForms, System.Windows.Forms, WindowsFormIntegration.

  2. Create an object of ReportViewer and specify the processing mode as local, the report path (the .rdlc path)

  3. Create an object of the ReportDataSource with the name of the data source and the object which contains the data as its parameters.

  4. Add the data source to the Local report created.

  5. Refresh the report.

  6. Create WindowsFormsHost object which is used for inserting the report to the control on the WPF form.
Sample Code Snippet (Window1.xaml.cs):

//Merchant is the class used to enter new product names and their prices.
Merchant merchant = new Merchant(); List products = new List(); products = merchant.GetProducts(); WindowsFormsHost host = new WindowsFormsHost(); Microsoft.Reporting.WinForms.ReportViewer reportViewer = new Microsoft.Reporting.WinForms.ReportViewer();
//Specifying local processing mode for the ReportViewer. reportViewer.ProcessingMode = ProcessingMode.Local;

//Specifying the location of the report definition file. reportViewer.LocalReport.ReportPath = "..\\..\\ProductReport.rdlc";

//Creating a new ReportDataSource with the name of the DataSource and the object // which is to be used as the DataSource. ReportDataSource ds = new ReportDataSource("ReportViewer_Product", products);

//Adding the ReportDataSource to the DataSoure of the ReportViewer reportViewer.LocalReport.DataSources.Add(ds);

//Causes the current report in the Report Viewer to be processed and rendered. reportViewer.RefreshReport();

//Sets the child control hosted by the WindowsFormsHost element. host.Child = reportViewer;
//Add the WindowsFormsHost element to the Grid in the Window1.xaml reportGrid.Children.Add(host);


The final result will look something like this, other items can also be used instead of a table which has been placed here: