iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hi
I am studying the possibility of partitioning applications in the option of Windowing Framework. Your documentation describes a way of using ApplicationURI with xap file name. Very major simplification is indicating only the object defined in MainType. If the application is divided into modules, flexibility is required in the references to all objects (View's) from the external xap.Maybe I have not noticed, but I miss, apart from ApplicationURI, indicating the type of object in external xap also. I simulate this action as follows (using the information in a Tag parameter)
MainPage.xaml
<Intersoft:UXDesktopDockButton Icon="Assets/Dock/ClientUILogoLarge.png" Text="Open External View" Click="UXDesktopDockButton_Click" Tag="ClientUIDesktopApp2.Notepad" />
MainPage.xaml.cs
private void UXDesktopDockButton_Click(object sender, RoutedEventArgs e) { ApplicationPackage app = UXShell.Current.GetApplication("ClientUIDesktopApp2"); if (app != null) { // load the application to the current domain context app.MainType = ((UXDesktopDockButton)sender).Tag.ToString(); app.Load(); if (app.IsLoaded) { IWindow win = app.CreateInstance() as IWindow ; if (win == null) throw new Exception("Unsupported instance type"); win.Show(); // Container.Child = element; } } }
Is it possible to do that in a declarative way ?
The important thing is the flexibility to transfer parameters (objects) to the called external objects (kind of StartupParameters or ... parameter of Constructor my opened view), but I assume that this can be achieved by binding an object WindowOption to CommandParameters, is not it. (as was done in ClientUIDesktopApp example on UXDesktopDockButton with customers).I miss the complementary example of the solution.It would be nice to find out more examples in your documentation.
Kind regards
Andrzej
Hi Andrzej,
As you pointed out, yes, it's possible to pass a parameter from dock button to the Window via the StartupParameters. The StartupParameters is defined in the WindowOptions instance that you pass along with the ApplicationURI.
Here's the code excerpt of the example that I took from our UXDesktopDock sample.
<Intersoft:UXStackItem Text="Interestingness" Command="Intersoft:WindowCommands.LaunchApplication" CommandTarget="{Binding ElementName=SampleDesktop}"> <Intersoft:UXStackItem.CommandParameter> <Intersoft:WindowOptions StartupParameters="Interestingness" ForceSingleInstance="True" ReactivateExistingInstance="True" Uri="/Intersoft.ClientUI.Samples.WindowControls;Intersoft.ClientUI.Samples.WindowControls.Views.UXDesktopDock.Photos"/> </Intersoft:UXStackItem.CommandParameter> </Intersoft:UXStackItem>
Of course, in your case, you can define the CommandParameter for your specific object such as UXDesktopDockButton, instead of UXStackItem.
If you need to pass a dynamic parameter, feel free to bind the StartupParameters to the object that contains the value you want to transfer. I.e., StartupParameters="{Binding ViewModel.DynamicValue}"
When you pass the WindowOptions that contains StartupParameters to the target application, and assuming the target is an IWindow, you can obtain the value of the parameters in the window.StartupParameters in the Load event of the window. With this technique, you can elegantly pass the parameters without intermediate/proxy code.
For an example, the following code obtains the parameter sent from the UXStackItem in the previous code example.
private void Photos_Loaded(object sender, RoutedEventArgs e) { FlickrPhotosViewModel model = new FlickrPhotosViewModel(); this.DataContext = model; if (this.StartupParameters == null) model.GetPhotosCommand.Execute("Interestingness"); else model.GetPhotosCommand.Execute(this.StartupParameters.ToString()); }
Let me know if it works in your end, or if you have other questions.
Hope this helps,Jimmy
Hi Jimmy,
Thank you for your accurate observations.
I'll study your examples more carefully.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname