我有一個名爲「BaseActivity」的基類,它來自NativeActivity。我想在基類中擁有所有我的共同行爲,並將它們用在被馴服的類中。假設我在基類中有常見的進/出參數。我的派生類有自己的輸入/輸出參數。我的問題是,我怎麼能從我的dervied類傳出一個參數到基類,以便基類out參數將消息傳回客戶端?從本機活動導出工作流活動
BASEACTIVITY CLASS
公共類BaseActivity:NativeActivity的 { #地區的 「公共參數列表」 //定義字符串類型的活動輸入/輸出參數 公共InArgument FirstArgument {獲得;組; } public InArgument SecondArgument {get;組; } public OutArgument Result {get;組; }
公共虛擬NativeActivityContext PushContext(NativeActivityContext上下文,詞典DictBase) { return context; }
protected override void CacheMetadata(NativeActivityMetadata元數據) base.CacheMetadata(metadata);
}
保護覆蓋無效執行(NativeActivityContext上下文) {
// Read context variables to local string variables.
string firstVal= context.GetValue(this.FirstArgument);
string secondVal= context.GetValue(this.SecondArgument);
string OutputResult = context.GetValue(this.Result);
Dictionary<string, object> contextdictionary = new Dictionary<string, object>();
contextdictionary.Add("first", firstVal);
contextdictionary.Add("second", secondVal);
contextdictionary.Add("output", OutputResult);
NativeActivityContext finalContext = PushContext(context, contextdictionary);
}
}
派生類
公共類兒童:BaseActivity { 公共InArgument XsltPath {獲得;組; } public OutArgument OutValue {get;組; }
public override NativeActivityContext PushContext(NativeActivityContext上下文,Dictionary DictBase) //對一些字符串進行操作,然後傳遞它。 OutValue.Set(context,outputStringBuilder.ToString());
}
return context;
}
}
的問題是如何傳遞的OutValue到基座活動出來的參數。子活動中的值是正確的,但是當我調用工作表時,它返回一個空字符串。 PL。幫我。提前致謝。
你可以更新你的文章,以有更好的格式?因爲你的代碼格式不正確 – Fabske 2014-11-03 14:30:25