IActivityHandler StartActivity(Guid activityId, IDictionary <string, object> args, string title = null) { IActivityExecutor executor = chatSession.CreateActivity(activityId); IActivity activity = context.PluginLoader.GetActivity(activityId); IActivityHandler handler = activity.Coalesce(a => a.CreateInvite(executor, args)); if (handler == null) { return(null); } if (handler is IVoiceChatHandler) { var voiceHandler = (IVoiceChatHandler)handler; voiceHandler.Dispatcher = Dispatcher; chatTextBox.AddVoiceChatSentRequest(context, voiceHandler, PrimaryBuddy.DisplayName); } else if (handler is IFileTransferHandler) { var fileHandler = (IFileTransferHandler)handler; fileTransfers.Add(fileHandler); chatTextBox.AddFileSentRequest(fileHandler); } else { chatTextBox.AddActivitySentRequest(PrimaryBuddy.DisplayName, title, handler); } handler.Start(); chatState.ChatStarted = true; return(handler); }
public IActivityHandler FromInvite(IActivityExecutor executor, IDictionary <string, string> metadata) { var inviteData = new FileInviteData(metadata); IFileTransferHandler handler = new FileTransferHandler(executor, inviteData.Name, inviteData.Size); return(handler); }
public FileTransferHandler(IActivityExecutor executor, string name, long size, Stream content) : base(executor) { this.Name = name; this.Size = size; this.content = content; }
public WorkflowExecutor(Execution <TContext> execution, TContext context, INodesResolver <TContext> nodes, IActivityFactory factory, IActivityExecutor activityExecutor) { m_Context = context; m_Factory = factory; m_Execution = execution; m_Nodes = nodes; m_ActivityExecutor = activityExecutor; }
public Workflow(string name, IWorkflowPersister <TContext> persister, IActivityFactory activityFactory = null, IActivityExecutor activityExecutor = null) { m_ActivityExecutor = activityExecutor ?? this; m_ActivityFactory = activityFactory ?? this; m_Persister = persister; Name = name; m_Start = new GraphNode <TContext, EmptyActivity, object, object>("start", context => null, (context, o) => { }); m_End = new GraphNode <TContext, EndActivity, object, object>("end", context => null, (context, o) => { }); registerNode(m_End); }
public IActivityHandler CreateInvite(IActivityExecutor executor, IDictionary <string, object> args) { if (!args.ContainsKey("content") || !(args["content"] is Stream)) { throw new ArgumentException("metadata must include content stream.", "metadata"); } var stream = (Stream)args["content"]; var inviteData = new FileInviteData(args.ToDictionary(x => x.Key, x => x.Value.ToString())); IFileTransferHandler handler = new FileTransferHandler(executor, inviteData.Name, inviteData.Size, stream); return(handler); }
public ActivityController(IActivityExecutor activityExecutor) : base(activityExecutor) { }
public IActivityHandler CreateInvite(IActivityExecutor executor, IDictionary <string, object> args) { var invitation = new VoiceChatHandler(executor); return(invitation); }
public IActivityHandler FromInvite(IActivityExecutor executor, IDictionary <string, string> metadata) { var invitation = new VoiceChatHandler(executor); return(invitation); }
protected DefaultActivityController(IActivityExecutor activityExecutor) { _activityExecutor = activityExecutor; }
public GenericActivity(IActivityExecutor executor, string activityType, string nodeName) { m_NodeName = nodeName; m_ActivityType = activityType; m_Executor = executor; }
public WorkflowExecutor(Execution <TContext> execution, TContext context, INodesResolver <TContext> nodes, IActivityFactory factory, IActivityExecutor activityExecutor, object closure) : this(execution, context, nodes, factory, activityExecutor) { m_Resuming = true; m_Closure = closure; }
public FileTransferHandler(IActivityExecutor executor, string name, long size) : base(executor) { this.Name = name; this.Size = size; }
public ActivityHandler(IActivityExecutor executor) { this.executor = executor; executor.SetHandler(this); }
public VoiceChatHandler(IActivityExecutor executor) : base(executor) { }