示例#1
0
        private void OnResumeBookmark(NativeActivityContext context, Bookmark bookmark, object obj)
        {
            SyncWorkflowDataExtension.Resume(context, bookmark, obj);

            // заполняем ответ сервису
            var protExt = context.GetExtension <ProtocolExtension>();

            if (protExt != null)
            {
                var actionCode = protExt.GetRequestActionCode();
                ActionCode.Set(context, actionCode);
            }
        }
示例#2
0
        protected override void Execute(NativeActivityContext context)
        {
            const string viewKind = JsWfViewKind.Dialog;
            // check bookmark name
            var bookmarkName = Guid.NewGuid().ToString();
            var message      = Message.Get(context);
            var title        = Title.Get(context);
            var actions      = Actions.Get(context) ?? new WfActionsModel()
            {
                new WfAction()
                {
                    Code = "OK", Text = "OK"
                }
            };

            var data = new WfDataModel()
            {
                {
                    "MessageBoxStruct",
                    new List <WfDataObject>()
                    {
                        new WfDataObject
                        {
                            { "Message", message }
                        }
                    }
                }
            };
            var model = new WfMetadataModel
            {
                ControllerConfig = new SerializableDictionary <string, string> {
                    { "message", message }
                },
                ViewConfig = new SerializableDictionary <string, object> {
                    { "title", title }
                },
                KeyMap = new List <WfKeyMap>
                {
                    new WfKeyMap
                    {
                        ActionCode = actions[0].Code,
                        Key        = 13
                    }
                },
                Structures = new List <WfStructure>()
                {
                    new WfStructure
                    {
                        Name          = "MessageBoxStruct",
                        FieldBindings = new List <IFieldBinding>()
                        {
                            new WfFieldBinding()
                            {
                                FieldName   = "Message",
                                EditorLabel = "Сообщение",
                                Visible     = true,
                                ReadOnly    = true
                            }
                        }
                    }
                }
            };

            Console.WriteLine("Execute bookmark '{0}'", bookmarkName);

            SyncWorkflowDataExtension.TryProcess(context, bookmarkName);

            // заполняем ответ сервису
            var protExt = context.GetExtension <ProtocolExtension>();

            if (protExt != null)
            {
                protExt.FillResponse(context, bookmarkName, model, data, actions, viewKind);
            }

            // sleep
            context.CreateBookmark(bookmarkName, OnResumeBookmark);
        }