0

I have an activity that I am creating. I am using another activity... so that when my activity executes the activity calls the execute of another activity. The issue is that the other activity has a Execute method that looks like this protected override void Execute(CodeActivityContext executeContext). I thought the issue was that it was protected, so I derived my class with the class that had the method, but still no luck. Any suggestions?

Here is the activity in which I want to call the Execute statement into. I get an error at regClass.Execute(CodeActivityContext context); that says CodeActivityContext a type but used as a variable.

namespace Communication.Bzip2
{
public sealed class Bzip2_Assemble_Activity : CodeActivity
{
private Programming.Registry_Get.Get_String_Value regClass;
public Bzip2_Assemble_Activity()
    {
    regClass = new Programming.Registry_Get.Get_String_Value();
    }


     protected override void Execute(CodeActivityContext context)
    {
        regClass.Execute(CodeActivityContext context);
    }

}
}

Here is the code of the Execute statement I want to call from.

namespace Programming.Registry_Get
{
[Designer(typeof(GenericDesigner))]
public sealed class Get_String_Value : CodeActivity
{
protected override void Execute(CodeActivityContext context)
    {
        string KeyPath = this.kPath.Get(context);
        string KeyName = this.kValueName.Get(context);
        string KeyDirectory = Path.GetDirectoryName(KeyPath);
        string subkey = Path.GetFileName(KeyPath);
        string fullKeyPath = KeyDirectory + "\\" + subkey;
        RegistryKey rk = Registry.CurrentUser.CreateSubKey(fullKeyPath);


        object value = Registry.GetValue(fullKeyPath, KeyName, "");
        context.SetValue(this.varValue, value.ToString());
    }

}
}
Brandon
  • 133
  • 1
  • 2
  • 11
  • 1
    Are you sure you want to use `protected` here? [*A protected member is accessible within its class and by derived class instances.*](http://msdn.microsoft.com/en-us/library/bcd5672a(v=vs.110).aspx) If you want to call your method from "outside" the class you might want to make it `public` or `internal`. Can you show some actual code to help us understand the relations between your classes? – ChrisK Nov 25 '13 at 20:04
  • I am referencing the assembly. I do not want to change and will not have the ability to change the protected member to public in some cases. – Brandon Nov 25 '13 at 20:43
  • @Brandon - you stated "I derived my class with the class that had the method, but still no luck." Did you get an exception/compile error? – Stinky Towel Nov 25 '13 at 20:57
  • @StinkyTowel sorry for not adding error in first place but I added it in the main section. Also will post here for you... I get an error at `regClass.Execute(CodeActivityContext context);` that says CodeActivityContext a type but used as a variable. – Brandon Nov 25 '13 at 21:54
  • @Brandon - change **regClass.Execute(CodeActivityContext context);** to **regClass.Execute(context);** and post what you get next. – Stinky Towel Nov 26 '13 at 00:44
  • @StinkyTowel that gives me an error that says the name 'context' does not exist in the current context – Brandon Nov 27 '13 at 06:30
  • might have found solution. will test tomorrow. changed the method in `public sealed class Bzip2_Assemble_Activity : CodeActivity` method to `public void aMethod(CodeActivityContext context)` and no errors that pop out and build runs. Will see if it runs successful tomorrow. – Brandon Nov 27 '13 at 06:47

0 Answers0