August 20, 2012

DevExpress ChartControl Printing

Problem:
- How to print DevExpress ChartControl ...
- How to printing ChartControl
- Print of DXChart ....
- How to print of DevExpress WPF ChartControl
- How to print DevExpress ChartControl via SimpleLink (DXPrinting) ...
- Print Preview a WPF Chart and Show Its
- WPF Chart Control - Print of DevExpress DXCharts for WPF

Solution:
Yes, it's simple. just call below method with chart control ;-)
private void PrintChartControl(ChartControl chartControl, bool withPreview = true)
{
    /// Prepare Template
    var templateImage = new FrameworkElementFactory(typeof(ImageEdit));
    templateImage.SetBinding(ImageEdit.SourceProperty, new Binding("Content"));
    DataTemplate templateData = new DataTemplate() { VisualTree = templateImage };
    /// Prepare Simple Link
    SimpleLink simpleLink = new DevExpress.Xpf.Printing.SimpleLink();
    simpleLink.DetailCount = 1;
    simpleLink.DetailTemplate = templateData;
    simpleLink.CreateDetail += new EventHandler<CreateAreaEventArgs>((sl_s, sl_e) =>
    {
        DrawingVisual vDrawing = new DrawingVisual();
        DrawingContext context = vDrawing.RenderOpen();
        context.DrawRectangle(new VisualBrush(chartControl), null, new Rect(0, 0, chartControl.ActualWidth, chartControl.ActualHeight));
        context.Close();
        RenderTargetBitmap bmp = new RenderTargetBitmap((int)chartControl.ActualWidth, (int)chartControl.ActualHeight, 96, 96, PixelFormats.Pbgra32);
        bmp.Render(vDrawing);
        sl_e.Data = bmp;
    });
    simpleLink.Landscape = true;
    simpleLink.CreateDocument(true);
    if (withPreview == true)
    {
        simpleLink.ShowPrintPreviewDialog(this);
    }
    else
    {
        simpleLink.Print();
    }
}

August 11, 2012

The tag does not exist in XML namespace


Error:
The tag 'XXX' does not exist in XML namespace 'clr-namespace:YYY;assembly=YYY'. Line zz Position zz.


Solution:
I know, it's really weird, but the solution is simple. Just change
FROM:
xmlns:ZZZ="clr-namespace:YYY;assembly=YYY"
TO:
xmlns:ZZZ="clr-namespace:YYY;assembly="
leave empty value for assembly=

August 10, 2012

Lunch Condition


Problems: 
- Install .Net Framework in Setup Project ...
- Adding Dot Net Framework to the Setup Project in ...
- Install .NET Framework with Visual Studio .NET ...
- Create setup project that includes .Net Framework 3.5 ...
- How to attach .Net framework 4.0 client profile to my setup project?
- Setup project wants to install .NET 4
- How to include .NET framework redistributable in Visual Studio setup ....
- Setup project: where .net framework 4.0 is
- Add Prerequisites of .NET Framework in Visual Studio Setup Project ...
- .Net 2.0 or 3.5 Setup Project Requires .Net Framework version 4.0

Solutions:
Windows Installer 3.1 (With Local Prerequisite)
Name: Windows Installer 3.1
Condition: VersionMsi >= "3.1"
InstallUrl: WindowsInstaller3_1\WindowsInstaller-KB893803-v2-x86.exe
Message: Windows Installer 3.1 is required to run this setup

Windows Installer 3.1
Name: Windows Installer 3.1
Condition: VersionMsi >= "3.1"
InstallUrl: go.microsoft.com/fwlink/?LinkId=42467
Message: Windows Installer 3.1 is required to run this setup

Windows Installer 4.5 (With Local Prerequisite)
Name: Windows Installer 4.5
Condition: VersionMsi >= "4.05"
InstallUrl: WindowsInstaller3_1\WindowsInstaller-KB893803-v2-x86.exe
Message: Windows Installer 4.5 is required to run this setup

Windows Installer 4.5
Name: Windows Installer 4.5
Condition: VersionMsi >= "4.05"
InstallUrl: http://go.microsoft.com/fwlink/?LinkId=120486
Message: Windows Installer 4.5 is required to run this setup

.NET Framework (With Local Prerequisite)
Name: .NET Framework
InstallUrl: DotNetFX40Client\dotNetFx40_Client_x86_x64.exe
Version: .NET Framework 4 Client Profile
Message: [VSDNETMSG]

PS: '.NET Framework' condition is a automatic added condition after add a .Net Project to Setup Project

August 08, 2012

Unable to update the EntitySet

Error:
Unable to update the EntitySet 'XYZ' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.

Solution:
Just add Primary Key for your Table in Database or DataModel (edmx file).

August 07, 2012

Change Entity Framework ConnectionString‎

Problem: 
- Dynamically change Entity Framework Connection String‎
- How to change the connection string in the EntityFramework ...
- How should I edit an Entity Framework connection string ...
- change db name in connection string at runtime in Entity Framework
- Cannot change the connectionstring with Entity Framework 4.1 code ...
- Entity Framework - how can I change connection string to be relative?
- Entity Framework Connection String Trouble - Stack Overflow

Solution:
Just add System.Configuration.dll to Refrences of your Project and then use of this code
ConfigurationManager.ConnectionStrings[0].ConnectionString = blah blah blah
ConfigurationManager.ConnectionStrings["XYZEntities"].ConnectionString = blah blah blah

Error in Solution:
Error: 
The configuration is read only.
Correction: 

var Configuration = ConfigurationManager.ConnectionStrings["amaBoxOfficeEntities"];
typeof(ConfigurationElement).GetField("_bReadOnly", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(Configuration, false);
Configuration.ConnectionString = blah blah blah


Install Window Without DVD or USB


Problem:
How to install Window 7 without DVD
How to install Window from network

Solution:
1- Download and Run TFTPBoot.exe
link: http://blog.ryantadams.com/wp-content/uploads/tftpboot.exe
link: http://www.megaupload.com/?d=V04T7KQ8
2- Change all settings (follow these screen shots)


3- Turn-on destination computer and press F12
4- after Windows Started ... type this command (on destination computer)
net use Y: \\10.0.0.102\E [PRESS ENTER]
PS: IP and Path are related your source computer
PS: After this prompt you need to enter username and password like COMPUERNAME\Administrator and password
5- Go to share folder and start windows setup ... (with these commands)
Y: [PRESS ENTER]
SETUP [PRESS ENTER]

References:
link: http://blog.ryantadams.com/2008/02/01/how-to-boot-from-the-network-pxe-boot-with-tftp-and-windows-pe
link: http://blog.dustinriley.net/2009/03/17/installing-windows-7-on-hp-mini-1000-through-network
link: http://www.expertcore.org/viewtopic.php?f=15&t=2560