Example #1
0
        protected override bool Process(IInteraction parameters)
        {
            bool successful = true;

            try {
                int      serviceInt   = GetServiceInt(parameters, this.ServiceIdKey);
                Service  foundService = GetServiceById(serviceInt);
                Settings config       = foundService.GetSettings();

                if (Reconfigure)
                {
                    config = GetContextSettings(parameters);

                    if (!Replace)
                    {
                        config = Settings.FromMerge(config, foundService.GetSettings());
                    }
                }

                if (!foundService.SetSettings(config))
                {
                    successful &= Failure.TryProcess(new FailureInteraction(parameters, foundService.InitErrorMessage, foundService.InitErrorDetail));
                }
                else
                {
                    successful &= Successful.TryProcess(MetaServiceInteraction.FromService(parameters, foundService));
                }
            } catch (ControlException ex) {
                successful &= Failure.TryProcess(new FailureInteraction(parameters, ex));
            }

            return(successful);
        }
Example #2
0
        bool VisualizeBlock(Service model, IInteraction parentParameters, List <int> history)
        {
            bool success = true;

            if (model is Proceed)
            {
                Service nextModel = ((Proceed)model).GetReturnService(parentParameters, Stub);
                success &= VisualizeBlock(nextModel, parentParameters);
            }
            else if (!history.Contains(model.ModelID))
            {
                history.Add(model.ModelID);


                foreach (KeyValuePair <string, Service> BranchTuple in model.Branches.Dictionary)
                {
                    success &= VisualizeBlock(BranchTuple.Value, parentParameters, history);
                }

                if ((model is MModule) && (ModuleView != Stub))
                {
                    // got rid of the module metadata it was a bit silly
                    MetaModuleInteraction modelContext = new MetaModuleInteraction(
                        parentParameters, model, new Map <object>());

                    success &= ModuleView.TryProcess(modelContext);
                }
                else
                {
                    MetaServiceInteraction modelContext = MetaServiceInteraction.FromService(
                        parentParameters, model);

                    if ((model is StubService) && (StubView != Stub))
                    {
                        success &= StubView.TryProcess(modelContext);
                    }
                    else
                    {
                        success &= BlockView.TryProcess(modelContext);
                    }
                }

                foreach (KeyValuePair <string, Service> BranchTuple in model.Branches.Dictionary)
                {
                    success &= VisualizeInteraction(model, BranchTuple.Key, BranchTuple.Value, parentParameters);
                }
            }

            return(success);
        }