|
Dear Buddies,
Required your help / suggestion.
I have created a WPF windows application. Now for some reason i wanted to convert the same to web application.
Can any one please give suggestion on how to convert the same with minimal effort?
Converting the application to silverlight would be easier? if so i googled on the same i am getting reply that need to use prism and all to acheive the same.
Can you guys please suggest the way to convert my wpf application to web application with minimal effort.
Thanks in advance.
|
|
|
|
|
Correct, you have to go with silverlight only. Prism is one of the popular MVVM frame work. there no mandatory that you need to use all of these things, You can create your app with out them as well. But Building WPF/Silverlight is advisable.
|
|
|
|
|
Strictly speaking, PRISM is not an MVVM framework. Yes, it has some MVVM features, but it is better regarded as an application composition framework. If the OP didn't build his original app with PRISM then he's got a whole host of work in trying to convert it into PRISM.
|
|
|
|
|
Dear hari,
Thanks for your suggestion will try the same and get back.
|
|
|
|
|
|
Dear Abinav,
Thanks for your time in replying.
Yes we can go with xbap application even i too thought that also.
But my basic requirement of converting this wpf to an web application is that
1) I am connecting centralized sql server with ado.net which have image data type also, so when i connect to the centralized database and fetch the data and also image am getting huge delay on getting the same.
I even asked a question on C# discussion forum on the same and they suggested me to go with image storage in physical drive and use web browser control to access the image. And instead of ado.net can use webservices.
But my thought is that if we create an web application and host the application in same server where the data base server exists will solve my problem. Thats the reason i wanted to convert into web application.
2) According to my understanding xbap application is that, when we trigger that it will download the exe to the local desktop through browser and run from local machine. If that is the case once again i hope i will be getting the same issue. If its is not the case i hope xbap would be the right option for me.
Please correct my if my understanding is wrong.
Thanks in advance.
|
|
|
|
|
Hema Bairavan wrote: According to my understanding xbap application is that, when we trigger that it will download the exe to the local desktop through browser and run from local machine.
Silverlight will be no different. A Xap file will be downloaded on your client.
Infact, SIlverlight does not support ADO.Net directly. You will need to use WCF (or the entity framework) on the server to communicate with the database.
Isolated storage would be faster, but fairly limited - so its good for a limited number of images.
|
|
|
|
|
Dear Abinav,
Thanks for reply.
1) So you mean even though i move to silver light also my issue wont get solved?
2)if i go with WCF or entity with local servers wont it help me regarding handling data and image data types with centralized server?
3) And regarding XBAP, Will it download the xbap file exe to the local machine and it will work from local desktop like windows application like that it will connect db via internet only rt?
Sorry for asking couple of questions as i am in critial phase.
Thanks in advance
|
|
|
|
|
Hema Bairavan wrote: 1) So you mean even though i move to silver light also my issue wont get solved?
You will be able to access isolated storage if that was your main requirement.
Hema Bairavan wrote: 2)if i go with WCF or entity with local servers wont it help me regarding handling data and image data types with centralized server?
Sorry but I dont understand your conecrn here.
Hema Bairavan wrote:
3) And regarding XBAP, Will it download the xbap file exe to the local machine and it will work from local desktop like windows application like that it will connect db via internet only rt?
Yes, an xbap file will be downloaded to you machine.
|
|
|
|
|
Abhinav S wrote:
Hema Bairavan wrote: 2)if i go with WCF or entity with local
servers wont it help me regarding handling data and image data types with
centralized server?
Sorry but I dont understand your conecrn
here.
No, Actually my issue was to handle the image through centralized server. So i thought to host the web application and db server in the same machine. if i use ado.net it will work fine and also its working fine now. But if i go for wcf or entity model, will it also take more time to give me data having image data type?
Abhinav S wrote:
Hema Bairavan wrote:
3) And regarding XBAP, Will it
download the xbap file exe to the local machine and it will work from local
desktop like windows application like that it will connect db via internet only
rt?
Yes, an xbap file will be downloaded to you machine.
Ok thanks for your reply. So, xbap will behave like local windows application, if i use ado.net to connect centralized sql server to get data having image data type it will also take time like windows application???
i hope with this reply our conversation will come to end
Thanks as always.
|
|
|
|
|
By your requirement, changing the application to a webapplication (be it by web forms, silverlight or XBAP) will not solve your problem. In fact, you will only lose yet more performance.
If your application is loading images from a centralized server and that is making things slow, I think your problem is on the transfer rate of those images. If you can change your application to do a local cache of the images, you will only need to go to the server the first time (the first download) of that image, and later you can use it locally.
Surely it is good to use some mechanism to check if the image needs to be updated or not (considering the server image changes), but that's all.
Doing an web page, you will:
Have to send the application throgh tcp/ip + the images through tcp/ip. Even if the webserver does a local access, the client will use tcp/ip to get to the webserver.
The only advantage is that browsers deal with the cache for you (but considering you will need to rewrite the application, it is not a real advantage).
For the item 2. All web applications do almost the same. HTML applications can have code that executes on the server, but they will send such HTML to the client. That HTML can then asks for postbacks or call a web-service, but it executes locally (on the client).
WPF (as XBAP) and Silverlight are like the HTML code in the sense they execute on the client machine, but for anything else, they should call the webserver (a service call... WCF, for example). So, I am sure your problem is not there.
|
|
|
|
|
Thanks paulo for your time on replying.
Will check on this and update you once it is done.
thanks
|
|
|
|
|
It all depends how you created your WPF app, and what resources it uses; e.g. does it use the local file system, are you using custom printing, etc. Is it written using an MVVM framework, or is it written using code behind?
There is no magic bullet - we can't give you a hard and fast figure I'm afraid.
|
|
|
|
|
Dear Hanlon,
Thanks for your time in replying.
My WPF app is not using any local file system, am just allowing the user to select and save the image to the database.
And yes i have some printing functionalities directly to the printer but that i can manage with some other reports and give a print to the pritner they have.
I am not using MVVM frame work, i just using the code behind with three tier architecture to do the coding.
So with this how can i proceed further please suggest.
Thanks in advance.
|
|
|
|
|
No, You cannot "convert" to a web application. This would be a massive re-work.
Silverlight however would be a very good way to get your application to be viewed in the web as this is in effect an application plugin hosted in a browser. You do not need Prism or any other framework but I would strongly recommend using one as it stops you re-writing many boiler plate code or functionality that is already written and tested.
With WPF and Silverlight, you can create an application and then share the same code across your platforms. I would recommend downloading the Prism framework. In there the Stock_RI application has a couple of samples, one being cross platform development / Multi target.
Failing that, follow this helpful link below
http://msdn.microsoft.com/en-us/library/ff921109(v=pandp.40).aspx[^]
|
|
|
|
|
Hi all,
I'm working on a WPF solution where I have to populate a combobox depending on the selected item of another combobox. But I get an error.
The XAML code is:
<Window xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
x:Class="ICP.Reporting.WPFReportViewer.Windows.Report_Script_Resultaten"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:navigation="clr-namespace:Infragistics.Silverlight.SampleBrowser.Framework.Controls;assembly=Infragistics.Silverlight.SampleBrowser.Framework"
xmlns:ig="http://schemas.infragistics.com/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:uri="clr-namespace:ICP.Reporting.WPFReportViewer.Resources.ReportUri"
xmlns:res="clr-namespace:ICP.Reporting.WPFReportViewer.Resources.Pages"
d:DesignHeight="500" d:DesignWidth="567" SizeToContent="WidthAndHeight"
Title="Report Scripts Resultaten"
WindowStartupLocation="CenterScreen" Icon="/ICP.Reporting.WPFReportViewer;component/Images/Report_New.ico">
<Window.Resources>
<uri:ReportLibraryUri x:Key="ReportLibraryUri" />
<res:ParametersStrings x:Key="ParametersStrings" />
</Window.Resources>
<Grid x:Name="LayoutRoot" HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Name="stackPanelParameters" Orientation="Vertical" VerticalAlignment="Top" Height="Auto" HorizontalAlignment="Center" Width="170" Grid.Row="0" Grid.RowSpan="1" Grid.Column="0" Grid.ColumnSpan="1" Margin="10,5">
<GroupBox Name="groupBoxBeginEindDatum" Header="Kies begin- en einddatum" Height="Auto" Width="Auto" Margin="0,5,0,0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
<StackPanel Name="stackPanelBeginEindDatum" Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" Height="Auto" Width="Auto" >
<!--
<Label Height="20" Content="Begindatum:" Margin="15,5,15,0" Width="77" Padding="5,0" HorizontalAlignment="Center" HorizontalContentAlignment="Center" />
<!--
<DatePicker Name="datePickerBeginDatum" Height="23" Width="120" SelectedDateFormat="Short" DisplayDate="01-01-2012" Text="" SelectedDate="01-01-2012" Margin="5,0" Padding="2" />
<!--
<Label Height="20" Content="Einddatum:" Margin="15,5,15,0" Width="77" Padding="5,0" HorizontalAlignment="Center" HorizontalContentAlignment="Center" />
<!--
<DatePicker Name="datePickerEindDatum" Height="23" Width="120" SelectedDateFormat="Short" DisplayDate="12-31-2012" Text="" SelectedDate="12-31-2012" Margin="5,0" Padding="2" />
</StackPanel>
</GroupBox>
<GroupBox Name="groupBoxAuthoriteitScript" Header="En authoriteit en script" Height="Auto" Width="Auto" Margin="0,5,0,0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
<StackPanel Name="stackPanelAuthoriteitScript" Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" Height="Auto" Width="Auto">
<Label Height="20" Content="Authoriteit:" Margin="15,5,15,0" Width="77" Padding="5,0" HorizontalAlignment="Center" HorizontalContentAlignment="Center" />
<ComboBox Height="25" Name="comboBoxAuthoriteit" Margin="5,0" Padding="2" SelectedIndex="-1" ItemsSource="{Binding}" DisplayMemberPath="Name" IsSynchronizedWithCurrentItem="True" SelectionChanged="comboBoxAuthoriteit_SelectionChanged" />
<Label Height="20" Content="Script:" Margin="15,5,15,0" Width="77" Padding="5,0" HorizontalAlignment="Center" HorizontalContentAlignment="Center" />
<ComboBox Height="25" Name="comboBoxScript" Margin="5,0" Padding="2" SelectedIndex="-1" ItemsSource="{Binding}" DisplayMemberPath="Name" />
</StackPanel>
</GroupBox>
<GroupBox Name="groupBoxRapport" Header="Rapport" Height="Auto" Width="Auto" Margin="0,5,0,0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
<StackPanel Name="stackPanelRapport" Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" Height="Auto" Width="Auto">
<!--
<Button Content="Genereer rapport" Margin="5" Click="Button_Refresh_Click" Height="23" Width="100" HorizontalAlignment="Center" VerticalAlignment="Center" />
</StackPanel>
</GroupBox>
</StackPanel>
<ig:XamReportViewer HorizontalAlignment="Center" Name="xamReportViewer1" VerticalAlignment="Bottom" PageFit="Width" UseLayoutRounding="True" MinWidth="380" MinHeight="445" PageMargin="0" AutoRender="True" Grid.Row="0" Grid.Column="1" Margin="0">
<ig:XamReportViewer.RenderSettings>
<ig:ClientRenderSettings DefinitionUri="/ICP.Reporting.ReportingClassLibrary;component/ReportDesigns/Report_Scripts_Resultaten.igr" />
</ig:XamReportViewer.RenderSettings>
<!--
<ig:XamReportViewer.Parameters>
<ig:Parameter ParameterName="beginDatum" ParameterValue="{Binding ElementName=datePickerBeginDatum, Path=SelectedDate}"/>
<ig:Parameter ParameterName="eindDatum" ParameterValue="{Binding ElementName=datePickerEindDatum, Path=SelectedDate}"/>
<!--
</ig:XamReportViewer.Parameters>
</ig:XamReportViewer>
</Grid>
</Window>
The code behind is:
using ICP.Reporting.ReportingClassLibrary;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Infragistics.Controls.Reports;
namespace ICP.Reporting.WPFReportViewer.Windows
{
public partial class Report_Script_Resultaten : Window
{
public Report_Script_Resultaten()
{
InitializeComponent();
CultureInfo ci = CultureInfo.CreateSpecificCulture(CultureInfo.CurrentCulture.Name);
ci.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy";
ci.DateTimeFormat.DateSeparator = "-";
Thread.CurrentThread.CurrentCulture = ci;
BindComboBoxAuthoriteit(comboBoxAuthoriteit);
}
private void Button_Refresh_Click(object sender, RoutedEventArgs e)
{
this.xamReportViewer1.Refresh();
}
public void BindComboBoxAuthoriteit(ComboBox comboBoxName)
{
string strConnectionAuthoriteit = ConfigurationManager.ConnectionStrings["ICP.Reporting.ReportingClassLibrary.Properties.Settings.sqlDS_Authorities"].ConnectionString;
SqlConnection connectionAuthoriteit = new SqlConnection(strConnectionAuthoriteit);
SqlDataAdapter daAuthoriteit = new SqlDataAdapter("SELECT Authority_ID, Description FROM Authorities ORDER BY Description", connectionAuthoriteit);
DataSet dsAuthoriteit = new DataSet();
daAuthoriteit.Fill(dsAuthoriteit, "Authorities");
comboBoxName.ItemsSource = dsAuthoriteit.Tables[0].DefaultView;
comboBoxName.DisplayMemberPath = dsAuthoriteit.Tables[0].Columns["Description"].ToString();
comboBoxName.SelectedValuePath = dsAuthoriteit.Tables[0].Columns["Authority_ID"].ToString();
}
private void comboBoxAuthoriteit_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (comboBoxAuthoriteit.SelectedIndex > -1)
{
BindComboBoxScript(comboBoxScript);
}
}
public void BindComboBoxScript(ComboBox comboBoxName)
{
string strqryScript = string.Format("SELECT Questionnaire_Id, Questionnaire_Name FROM Questionnaires WHERE (Authority_ID = {0}) ORDER BY Questionnaire_Name", comboBoxAuthoriteit.SelectedItem);
string strConnectionScript = ConfigurationManager.ConnectionStrings["ICP.Reporting.ReportingClassLibrary.Properties.Settings.sqlDS_Scripts"].ConnectionString;
SqlConnection connectionScript = new SqlConnection(strConnectionScript);
SqlDataAdapter daScript = new SqlDataAdapter(strqryScript, connectionScript);
DataSet dsScript = new DataSet();
daScript.Fill(dsScript, "Questionnaires");
comboBoxName.ItemsSource = dsScript.Tables[0].DefaultView;
comboBoxName.DisplayMemberPath = dsScript.Tables[0].Columns["Questionnaire_Name"].ToString();
comboBoxName.SelectedValuePath = dsScript.Tables[0].Columns["Questionnaire_Id"].ToString();
}
}
}
When I run the solution I get the sqlexception "The multi-part identifier "System.Data.DataRowView" could not be bound."
on the following line:
daScript.Fill(dsScript, "Questionnaires");
Can someone tell me where I'm going wrong and what I have to correct?
Thank you very much for your help.
Greetings,
Geert De Vylder
|
|
|
|
|
Without ratting through your code I would guess that you are passing in the row object into the query and it is turning the object into a string(). You should be passing in the SelectedValue from the combo not the SelectedItem.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi Mycroft,
I have tried this also, but that doesn't work neither.
Greetings,
Geert
|
|
|
|
|
I have a RichTextBox with attached property:
<RichTextBox x:Name="rtf" wpfPages:ScrollBarUtils.VerticalScrollValue="{Binding ElementName=scroll, Path=Value}"/>
which binds to ScrollBar.Value property.
I want to bind back ScrollBar.Value to this attached property. Smth like this:
<ScrollBar x:Name="scroll" Value="{Binding ElementName=rtf, Path=(wpfPages:ScrollBarUtils.VerticalScrollValue)}"/>
Please advice how can I do it?
savbace
|
|
|
|
|
Good Day i have a Window in WPF defined like this
<Window x:Class="RVI_Education.Gavigator"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Gavigator" Height="673.2" Width="1304.4">
<Frame Name="FrameWithinGrid" >
</Frame>
</Window>
and im using it as a start up in my app.xaml
<Application x:Class="RVI_Education.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="Gavigator.xaml">
<Application.Resources>
</Application.Resources>
</Application>
and on Window loaded event i navigate to another Window
like this
public Gavigator()
{
InitializeComponent();
Loaded += Gavigator_Loaded;
}
void Gavigator_Loaded(object sender, RoutedEventArgs e)
{
FrameWithinGrid.Navigate(new System.Uri("Splash.xaml",UriKind.RelativeOrAbsolute));
}
when i load the Project i get an Error
'RVI_Education.Splash' root element is not valid for navigation.
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa[at]dotnetfunda.com
http://www.Dotnetfunda.com
|
|
|
|
|
The error message indicates that the error is in Splash.xaml , which you haven't posted. I would guess that Splash.xaml is a Window , which won't work:
http://stackoverflow.com/a/7078211/124386[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
There is nothing wrong with the Splash Window , the problem is that im trying to navigate from a Window to a Window.
thank for the link , i will continue with the nasty creation of object and disposing them.
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa[at]dotnetfunda.com
http://www.Dotnetfunda.com
|
|
|
|
|
Hi guys, can u share with me about random image with array in WP ?
|
|
|
|
|
Eh? What exactly do you mean?
|
|
|
|
|
If you are using bytes to store a byte array, this[^] would give you an idea on what you need to do to display a random image.
Note that all API's may not be available in WP so you may have to improvise to achieve similar results.
|
|
|
|
|