Example #1
0
 public CalculatorWindow()
 {
     InitializeComponent();
     currentBinding = ContextOverHttp;
     Context        = ContextManager.DepersistContext(contextFile);
     if (Context != null)
     {
         PowerOn = true;
     }
 }
        public TChannel CreateLocalChannel <TChannel>()
        {
            ChannelFactory <TChannel> channelFactory = new ChannelFactory <TChannel>(localBinding, localWorkflowAddress);
            TChannel channel = channelFactory.CreateChannel();
            IDictionary <string, string> context = ContextManager.DepersistContext(contextFileName);

            if (context != null && context.Count > 0)
            {
                ContextManager.ApplyContextToChannel(context, (IClientChannel)channel);
                recoveredContext = true;
                // register handlers to cleanup context file when Workflow completes or terminates.
                this.Description.Behaviors.Find <WorkflowRuntimeBehavior>().WorkflowRuntime.WorkflowCompleted  += delegate(object sender, WorkflowCompletedEventArgs e) { ContextManager.DeleteContext(contextFileName); };
                this.Description.Behaviors.Find <WorkflowRuntimeBehavior>().WorkflowRuntime.WorkflowTerminated += delegate(object sender, WorkflowTerminatedEventArgs e) { ContextManager.DeleteContext(contextFileName); };
            }
            return(channel);
        }