Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Micros Simphony Extensibility: How to create a WPF dialog and display it from c# code

Status
Not open for further replies.

Yusuf SRC

Programmer
Nov 2, 2022
11
TR
thread693-1810782

Hello everyone, I'm developing an extensibility application for micros simphony and I want to show some dynamic content in a dialog like content area. I couldn't see any OpsContext method to do that. I read from the above thread it can be done with normal WPF user control dialog. My question is How can I create a WPF dialog as normal and display it from c# code ?

 
this.OpsContext.RequestCustomDialog Can be done.
First, you need to write the UserControl in WPF.
Then replace this part.
Code:
<UserControl 
        xmlns="[URL unfurl="true"]http://schemas.microsoft.com/winfx/2006/xaml/presentation"[/URL]
        xmlns:x="[URL unfurl="true"]http://schemas.microsoft.com/winfx/2006/xaml"[/URL]
        xmlns:mc="[URL unfurl="true"]http://schemas.openxmlformats.org/markup-compatibility/2006"[/URL] 
        xmlns:system="clr-namespace:System;assembly=mscorlib"
        xmlns:mconverters="clr-namespace:Micros.OpsUI.Converters;assembly=OpsUI"
        xmlns:mcontrol="clr-namespace:Micros.OpsUI.Controls;assembly=OpsUI"
        xmlns:mcfg="clr-namespace:Micros.OpsUI.Controls.Configuration;assembly=OpsUI"
        xmlns:mdesign="clr-namespace:Micros.OpsUI.Controls.Design;assembly=OpsUI"
        xmlns:d="[URL unfurl="true"]http://schemas.microsoft.com/expression/blend/2008"[/URL] 
        mc:Ignorable="d"
        d:DesignHeight="800" d:DesignWidth="800">
</UserControl>
Then configure it in EMC.
Just call the method this.OpsContext.RequestCustomDialog

Simphony Developer,Welcome to contact me
 
What I mean by custom content is the content generated dynamically in c# extension code. I want to display a content dialog in a grid like system and update the data on it dynamically. You know the extension code is something written as a c# class library.

- I created another wpf user control project and referenced it from the extension library. I need to show that wpf by calling from c# code and send send dynamic data and update it.

I just need to display content in a grid system. I believe there is no method on the OpsContext to do that. only ShowTextList and ShowMessage methods can show text but that is not enough.
 
goodboy thanks for the replies. I mean the reply based on here in this thread
@CathalMF replied this: Personally i dont see many advantages to using "RequestCustomDialog" unless you want to use SIM scripts to display dialogs. Create a WPF dialog as normal and display it from your code without the RequestCustomDialog.

So I believe a normal wpf dialog.

By the way I tried to add content in the EMC. I created the wpf and add the xaml code in the EMC as application content. like the images below. But when I run the code
OpsContext.RequestCustomDialog("the message", "title", "control", new { });

I got this error "The resource 'control' can not be found" What is that I'm missing ?

Capture2_mjntxx.png
Capture1_xivonq.png
 
Yes it is the same name "control" I added that content under the extension application content is that the right place ?

it is the name in the "Zonable Key" location

Capture3_w2q18j.png
 
Thank you, I think it is the right direction, it did find the resource now. But I got this error "System.Exception: 'Unable to parse XAML
Source: control
'Failed to create a 'TextChanged' from the text 'TextBox_TextChanged_1'.' Line number '10' and line position '137'.'

"

how can I bind the events in code ? like in my "usercontrol.xaml.cs"

there should be TextBox_TextChanged_1(object sender, TextChangedEventArgs e) function written in somewhere
 
goodboy said:
Events cannot be used. This method is more biased towards one-time binding of data.
Thank you so much for the replies. I need somehow two way binding and send data back and front.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top