none
How to handle Foreign language such as Japanesse, Chinese in WPF rehosted workflow designer.

    Question

  • Hello Everyone.,

       Am developing WPF rehosted workflow designer and WF4 custom activity too.

    When I attempt to read foreign language such as Japanesse , Chinese from Inargument. I'll get question marks.

    I've tried

    publicInArgument<string>Caption { get; set; }

    I tried

    varstr = context.GetValue(this.Caption);

    and

    varsStr = this.Caption.Get<string>(context); //too

    //But I get only question marks "?????????"

    kindly help me to resolve this.

    Thanks in Advance.. 


    Wednesday, April 19, 2017 4:11 PM

All replies

  • Hi friend,

    Thanks for you posting.

    Tried to rehost the workflow designer, and I found this:

    do you add these reference in your end? please have a look.

    and the reference link:

    https://msdn.microsoft.com/en-us/library/dd489451(v=vs.110).aspx

    Best regards,

    Fletch


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Thursday, April 20, 2017 1:17 PM
  • Thanks Fletch,

                I already did rehosted workflow designer and with some more custom activities also...

    My query is how to handle foreign language in custom activity which returns (???????) instead of 中餐館遍佈全球, 是神預備的宣教點

    Monday, April 24, 2017 8:50 AM
  • Hi friend, 

    As I know if we want to receive data on custom activities we use input arguments.

    Sample code: 

    public sealed CustomActivity : CodeActivity
    {
        public InArgument<string> StringInput { get; set; }
    
        protected override void Execute(CodeActivityContext context) 
        {
            string inputString = StringInput.Get<string>(context);
    
            
        }
    }

    Now you could pass the variable name of those Chinese characters to your custom activity's StringInput argument.

    Please have a try and feel free to let me know if I misunderstood

    Best regards, 

    Fletch



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.



    Monday, April 24, 2017 4:03 PM
  • Thanks for your reply. I had tried that too, in CodeActivity and AsynccodeActivity too

    I don't know what I am missing.  your quick response will be appreciable.

    publicInArgument<string> Caption

            {

               

    get;

               

    set;

            }

           

    publicFileWriter()

    :

    base()

            {

            }

           

    protectedoverrideIAsyncResultBeginExecute(AsyncCodeActivityContextcontext, AsyncCallbackcallback, objectstate)

            {

               

    stringtempFileName = Path.GetTempFileName();

               

    Console.WriteLine("Writing to file: "+ tempFileName);

               

    varsStr = this.Caption.Get<string>(context);

    Monday, April 24, 2017 4:30 PM
  • Hi friend,

    As the code is fine, may I ask what the format of the file?

    e.g. if it's a .text file, please remember to save it with encoding of UTF-8:

    then run the code again.

    Best regards,

    Fletch 


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Wednesday, April 26, 2017 5:46 AM
  • Hi Fletch, First of all, I would like to say thanks. I found the Actual problem, The problem is the way of executing

    the workflow. The below workflow executing methods will reflects foreign (Chinese) language,

    yup allows to see those characters while having breakpoint and debugging times.

    WorkflowInvoker workflowInvoker = new WorkflowInvoker(ActivityXamlServices.Load(xamlpath)); workflowInvoker.InvokeAsync(); And other method is below static Activity loadworkflow() { Activity act = ActivityXamlServices.Load(GeneralFunctions.XAMLFilePath + "\\" + GeneralFunctions.currenttabitem + ".xaml"); return act; } DynamicActivity DYN = new DynamicActivity(); DYN.Implementation = loadworkflow; WorkflowInvoker.Invoke(DYN); Both method has few drawbacks, such as

    * Cant able to access Main Window while workflow is executing. * And cant able to see the flow of activities executing.

    I need to access Main Window to Abort in between two custom activities if anything goes wrong. While the below executing method allows both WorkflowViewModel model = this.ActiveWorkflowViewModel; model.RunWorkflow(); Can you suggest any other method which will allows us to debug, abort the workflow execution

    and at same time reflects foreign characters. Hope your response will be pretty much interesting...



    Friday, April 28, 2017 12:17 PM