2)if i go with WCF or entity with local
servers wont it help me regarding handling data and image data types with
Sorry but I dont understand your conecrn
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
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
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.
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.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
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.
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
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.
I am working on a WPF application. The application uses Infragistics controls such as Ribbon Controls and XamDockManager. It has a File Menu wherein I have provided a Save menu item to save the items on the canvas to a file. On click of Save button, Save Dialog opens to provide the File name and file is saved at the defined location.
The saving process is quite time consuming and in order to show something to the user, I have used the WaitCursor.
I have used a class similar to the one mentioned(UiServices.ShowWaitCursor) in the below thread.
public void WriteToFile(string fileName)
This works fine, if we just save the things on the canvas into a file. However, if fails in the below scenario.
The application has a canvas where I display some UI elements. On double click of the UI element, we launch a Windows form in the Infragistic ContentPane.
We have a modeless dialog opened and perform File -> Save and provide a file name, the cursor stays indefinitely. It goes only once we click on the Canvas. The DispatcherTimer_Tick is fired only when we click on the Canvas which resets the cursor.
The DispatcherPriority is ApplicationIdle.
Another observation is, this happens only when we open the Save dialog through the File -> Save. It works fine if we open the Save dialog through Ctrl + S key combinations.
Is there a way I can debug the non firing of DispatcherTimer.Tick event or any other way to handle this?
I created a simple WPF application and it works fine in that.
///<summary>/// Interaction logic for MainWindow.xaml
///</summary>publicpartialclass MainWindow : Window
privatevoid button1_Click(object sender, RoutedEventArgs e)
System.Windows.Forms.Form form = new System.Windows.Forms.Form();
form.Height = 200;
form.Width = 400;
form.TopMost = true;
privatevoid MenuItem_Click(object sender, RoutedEventArgs e)
string fileName = SaveFileDialog();
// Create SaveFileDialog
Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
// Display SaveFileDialog by calling ShowDialog method
Nullable<bool> result = dlg.ShowDialog();
string filename = string.Empty;
// Get the selected file name if (result == true)
// Open document
filename = dlg.FileName;
///<summary>/// Sets the busy state on the application.
/// Displays a wait cursor for long running tasks.
///<summary>/// A value indicating whether the UI is currently busy
///<summary>/// Sets the state as busy.
///<summary>/// Sets the state to busy or not busy.
///</summary>///<paramname="busy">if set to <c>true</c> the application is now busy.</param>privatestaticvoid SetBusyState(bool busy)
if (busy != _isBusy &&
Application.Current != null &&
Application.Current.Dispatcher != null)
_isBusy = busy;
Mouse.OverrideCursor = busy ? Cursors.Wait : null;
new DispatcherTimer(TimeSpan.FromSeconds(0), DispatcherPriority.ApplicationIdle, DispatcherTimer_Tick, Application.Current.Dispatcher);
///<summary>/// Handles the Tick event of the dispatcherTimer control.
///</summary>///<paramname="sender">The source of the event.</param>///<paramname="e">The <seecref="System.EventArgs"/> instance containing the event data.</param>privatestaticvoid DispatcherTimer_Tick(object sender, EventArgs e)
var dispatcherTimer = sender as DispatcherTimer;
if (dispatcherTimer != null)
I can't execute your code (I don't have those libraries you use), but can you use another priority?
I don't know... maybe you have an animation or similar that is never really letting the application become idle.
Note: Seeing your code, you don't need to use a DispatcherTimer. It is enough to do a Dispatcher.BeginInvoke to call your delegate. This will also guarantee that it will execute only once, as soon as all the messages (including the actual one) are processed. In fact, I think your problem is that you never started your timer.
Hopefully this will be a quick question to answer, but personally I'm not sure which way to go.
Firstly I'm using SL5, MVVM, MEF, EF. I have a person entity - the person entity has a collection of account entities, address entities and order entities.
In my view I am displaying a list of the people on the left with the corresponding lists on the right (accounts, addresses, orders). When the person is changed in the list I obviously want the lists on the right to update.
Obviously it would be inefficient to just include the lists in the domain service query using the .Include() operation as it will return ALL the people with ALL the related list entities. This is where my dilemma is - when I change the person do I either:
Load each of these lists separately, each with their own completed events where I populate the view lists. Which is basically three extra calls to the DB.
2. Call a different GetPeople query in the domain service where I pass in the current person ID and use the .Include() operation to include accounts, address and orders, but filter by the passed in PersonID. (i.e. return this.ObjectContext.People.Include("Accounts").Include("Addresses").Include("Orders").Where(p=>p.ID == PersonID);)
Can I integrate WPF application in web application??
I am working in a website, in this I want to integrate a small WPF application. Can i do this?? for eg... I wanna open login/signin popUp ("which is created in WPF") in my web application to enter the user in main page.
or we can say that in any tutorial webpage, I want to insert demo application of WPF application.
If it is possible please let me know, how i can do this.
I'm working on an WPF MVVM application. The data entry screen has to have all it's fields disabled until the user clicks "Add" or "Edit", and also the fields cannot become enabled if the user does not have rights to that field.
So, I would like to bind all IsEnabled properties in the XAML to a single method on the ViewModel. I would need to pass in a string value which is the 'key' of the field. Then in the VM would use the key to check the rights. The method would be something like
publicbool CanEnableField(string Key)
// if the form is in Add or Edit Mode, and the user has rights to the field, then// return true, else false
A converter would probably not work because that class won't know about the VM and the form's mode (Add/Edit).
I could bind each field's IsEnabled to individual properties on the VM and handle all this in the getter, but that would be a lot of properties in the VM.
The best way is to have a bool Property in your VM, to which you caan bind the IsEnabled property of the relevant controls like this:-
publicbool CanEnableField(string Key)
// if the form is in Add or Edit Mode, and the user has rights to the field, then EnableControls = true
if (enableControls != value)
enableControls = value;
I have a combo box bound to an ObservableCollection<classmodel>. The entity passed into the view has an instance of a ClassModel. I want to select the item in the combo which matches the entite's ClassModel.
So far im lookping over the ObservableCollection to find the item:
foreach (var jobClass in Classes)
if (jobClass.Id == JobRevision.JobClass.Id)
SelectedClass = jobClass;
From my deep knowledge of all things xaml (insert sarcasm smiley): When you create a style.xaml file that contains the style for DataEnteryTextBlockForeColorBrush. you can reference it via the app.xaml (Silverlight) and it becomes a static resource available to all views. You can also create the style in the view's xaml as a resource (grid.resource/usercontrol.resouce etc) and it becomes a static resource usable by that view only.
Hang on you answer more of these than I do!
Never underestimate the power of human stupidity
Following example I managed to get fire both a RoutedEvent and an AttachedEvent from "GrandChild" and have them handled in "MainWindow" two levels up - but I am now confused what's difference between the two? Except how they are declared in "GrandChild". I want to add that both use "RegisterRoutedEvent" but RoutedEvent has a CLR wrapper
Now i tried to put it a Thread Sleep between, it work once after that the Second mp3 plays after the first one. So i want to call the same function twice to play different mp3's but i want one to wait for another to finish playing before playing, i hoped for a "isPlaying" Property to determine if the element was playing. Does anyone have a solution.
//Function to Play a Videoprivatevoid PlayAudio(string Fruit)
VideoPlayer.Source = new Uri(@"D:\Articles\How to identify Players in Kinect\IdentifyPlayers\WpfApplication1\WpfApplication1\Voices\" + Fruit + ".mp3", UriKind.Absolute);
VideoPlayer.LoadedBehavior = MediaState.Manual;
Hi I have a winforms application I wish to convert to WPF. I have never played in xaml before so looking for a few resources to learn from. I have read a few articles here on this wonderful website and looking for more help. Any suggestions appreciated.
Thank You in advance
Frazzle the name say's it all
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
John F. Woods