10.07.2010, 02:37 | #1 |
Участник
|
In this blog you will find the source code (below) to “let NAV speak.” You would have a wide range of possibilities to use this simple Add-in and enlarge this project.
If you want to know more about Client Add-ins you can refer to this MSDN link: Extending the RoleTailored Client Using Control Add-ins and Microsoft Dynamics NAV 2009 SP1 This simple Client Add-In is based on System.Speech namespace: Microsoft.Speech.Synthesis Namespace Step by step creation of the NSpeech Add-In (Remember the ‘DodgeBall’ rules: Develop, Sign, Place, Register and Develop)
B. Create a Strong Name Key (SNK)
C. Add References to the Project
D. Develop your NSpeech Project (You can simply copy and paste this code into your Class project.) using System; using System.Collections.Generic; using System.Text; using System.ComponentModel; //Add a reference to the Add-in API (see the solution explorer) and all relevant references //Use all relevant references using System.Drawing; using System.Windows.Forms; using Microsoft.Dynamics.Framework.UI.Extensibility; using Microsoft.Dynamics.Framework.UI.Extensibility.WinForms; //this is to let this add-in speech //http://msdn.microsoft.com/en-us/library/dd146744(v=office.13).aspx using System.Speech; using System.Speech.Synthesis; namespace NSpeech { //Develop the control add-in class. //Assign a name to the control add-in <a name="OLE_LINK1">(MyCompany.MyProduct.MyAddIn) [ControlAddInExport("Cronus.DynamicsNAV.NSpeech")] [Description("Let this Add-in Speak")] //Select a base class as a starting point. //Select interfaces to implement features, such as data binding or event handling. public class Class1 : StringControlAddInBase { //Implement control creation protected override Control CreateControl() { //Create a brand new TextBox TextBox control = new TextBox(); //Define TextBox size control.MinimumSize = new Size(50, 0); control.MaximumSize = new Size(500, Int32.MaxValue); //Add a DoubleClick event for the TextBox control.DoubleClick += new EventHandler(control_DoubleClick); return control; } //Define a voice synth private SpeechSynthesizer synth; private void control_DoubleClick(object sender, EventArgs e) { //create a new speech synth and set default audio device synth = new SpeechSynthesizer(); synth.SetOutputToDefaultAudioDevice(); //Pass TextBox content in a string variable string data = this.Control.Text; //... and let NAV speak it! synth.SpeakAsync(data); } } } E. Build the NSpeech.dll
(typically the Add-ins folder is here: C:Program FilesMicrosoft Dynamics NAV60RoleTailored ClientAdd-ins)G. Determine the PKT (Public Key Token) of NSpeech
In the following example, 250f71f35a467631 is the PKT (Public Key Token) needed to register the Add-in into NAV. (You will have another value.) [url="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-84-65-metablogapi/5126.NSpeechSn_5F00_2.jpg"][*]Run Table 2000000069 Client Add-in[*]Insert a new line with these values:[/list]FieldValueControl Add-in NameCronus.DynamicsNAV.NSpeechPublic Key Token250f71f35a467631 (this is an example)Version1.0.0.0DescriptionLet this Add-in SpeakHow to Use This Add-in As an example, you can just let NAV speak the content of the field “Name” in Customer Card page (Page 21).
This simple Client Add-in project may be used in, e.g.
Best Regards, Duilio Tacconi (dtacconi) Microsoft Dynamics Italy Microsoft Customer Service and Support (CSS) EMEA Источник: http://feedproxy.google.com/~r/Micro...nt-add-in.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|