コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public FileTransferHandler(IActivityExecutor executor, string name, long size, Stream content)
     : base(executor)
 {
     this.Name    = name;
     this.Size    = size;
     this.content = content;
 }
コード例 #4
0
ファイル: WorkflowExecutor.cs プロジェクト: mmusin/Workflow
 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;
 }
コード例 #5
0
ファイル: Workflow.cs プロジェクト: mmusin/Workflow
 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);
 }
コード例 #6
0
        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);
        }
コード例 #7
0
 public ActivityController(IActivityExecutor activityExecutor)
     : base(activityExecutor)
 {
 }
コード例 #8
0
ファイル: VoiceChatActivity.cs プロジェクト: dugu01/squiggle
        public IActivityHandler CreateInvite(IActivityExecutor executor, IDictionary <string, object> args)
        {
            var invitation = new VoiceChatHandler(executor);

            return(invitation);
        }
コード例 #9
0
ファイル: VoiceChatActivity.cs プロジェクト: dugu01/squiggle
        public IActivityHandler FromInvite(IActivityExecutor executor, IDictionary <string, string> metadata)
        {
            var invitation = new VoiceChatHandler(executor);

            return(invitation);
        }
コード例 #10
0
 protected DefaultActivityController(IActivityExecutor activityExecutor)
 {
     _activityExecutor = activityExecutor;
 }
コード例 #11
0
ファイル: WorkflowExecutor.cs プロジェクト: mmusin/Workflow
 public GenericActivity(IActivityExecutor executor, string activityType, string nodeName)
 {
     m_NodeName     = nodeName;
     m_ActivityType = activityType;
     m_Executor     = executor;
 }
コード例 #12
0
ファイル: WorkflowExecutor.cs プロジェクト: mmusin/Workflow
 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;
 }
コード例 #13
0
 public FileTransferHandler(IActivityExecutor executor, string name, long size)
     : base(executor)
 {
     this.Name = name;
     this.Size = size;
 }
コード例 #14
0
 public ActivityHandler(IActivityExecutor executor)
 {
     this.executor = executor;
     executor.SetHandler(this);
 }
コード例 #15
0
 public VoiceChatHandler(IActivityExecutor executor) : base(executor)
 {
 }