Example #1
0
    /// <summary>
    /// Constructor of the class
    /// </summary>
    /// <param name="pId"></param>
    /// <param name="pText"></param>
    /// <param name="pCreator"></param>
    public Expense(string pId, string pText, IUser pCreator, IInteraction pTarget)
    {
        Image pReceipt= null;
        decimal pValue= 0;

        InitializeProperties(pId, pText, pReceipt, pValue, pCreator, pTarget);
    }
        public void Execute(IInteraction selectedInteraction)
        {
            try
            {
                var sessionKey = "";

                // Get as attribute
                if (selectedInteraction != null)
                    sessionKey = selectedInteraction.GetAttribute("webtools_glanceSessionKey");

                // If we don't have it, ask the user
                if (string.IsNullOrEmpty(sessionKey))
                {
                    var d = new SessionKeyDialog();
                    d.ShowDialog();
                    if (d.SessionKeyDialogResult == SessionKeyDialogResult.JoinSession)
                        sessionKey = d.SessionKey;
                }

                // Launch join page
                if (!string.IsNullOrEmpty(sessionKey))
                    Process.Start("https://glance.net/cobrowse/AgentView.aspx?Wait=1&SessionKey=" + sessionKey);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error executing Glance button", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #3
0
        protected override bool Process(IInteraction parameters)
        {
            IIncomingBodiedInteraction incoming = (IIncomingBodiedInteraction)parameters.GetClosest(typeof(IIncomingBodiedInteraction));
            IOutgoingBodiedInteraction outgoing = (IOutgoingBodiedInteraction)parameters.GetClosest(typeof(IOutgoingBodiedInteraction));

            incoming.IncomingBody.CopyTo(outgoing.OutgoingBody);

            return(true);
        }
        private void handleInteractionMessage(InteractionMessage message)
        {
            switch (message.Action)
            {
            case InteractionMessageAction.Created:
            {
                CreateNewInteraction(message);
            }
            break;

            case InteractionMessageAction.Assigned:
            {
                IInteraction interaction = Interactions.FirstOrDefault(i => string.Compare(i.Id, message.Interaction.Id.ToString()) == 0);

                if (interaction != null)
                {
                    ((CtiServiceInteraction)interaction).State = InteractionState.Active;

                    OnInteractionConnected(new InteractionEventArgs(interaction));
                }
            }
            break;

            case InteractionMessageAction.StateChanged:
            {
                IInteraction interaction = Interactions.FirstOrDefault(i => string.Compare(i.Id, message.Interaction.Id.ToString()) == 0);

                switch (message.Interaction.State)
                {
                case SwitchInteractionState.Active:
                    break;

                case SwitchInteractionState.Held:
                    break;

                case SwitchInteractionState.Disconnected:

                case SwitchInteractionState.Completed:
                    if (interaction != null)
                    {
                        OnInteractionDisconnected(new InteractionEventArgs(interaction));
                    }
                    Interactions.Remove(interaction);
                    OnInteractionCompleted(new InteractionEventArgs(interaction));
                    CurrentInteraction = Interactions.FirstOrDefault();
                    break;

                default:
                    break;
                }
            }
            break;

            default:
                break;
            }
        }
Example #5
0
 internal TealBeanRenderWalker(IInteraction tealBean, VersionNumber version, TimeZoneInfo dateTimeZone, TimeZoneInfo dateTimeTimeZone
                               , BridgeFactory factory)
 {
     this.tealBean         = tealBean;
     this.dateTimeZone     = dateTimeZone;
     this.dateTimeTimeZone = dateTimeTimeZone;
     this.factory          = factory;
     this.version          = version;
 }
Example #6
0
 private void Update()
 {
     if (PerformedInteraction == null && _interactionQueue.Any())
     {
         PerformedInteraction = _interactionQueue.First.Value;
         _interactionQueue.Remove(PerformedInteraction);
         SetDestinationFlag(PerformedInteraction.InteractionSource);
     }
 }
Example #7
0
        /// <summary>
        /// Adds an interaction to the manager.  Interactions listen to UI
        /// events and operate on them.
        /// </summary>
        public virtual void AddInteraction(IInteraction interaction)
        {
            _interactions.Add(interaction);

            interaction.IsEnabled = true;
            interaction.Activated += (sender, args) => ChildActivated(sender);
            interaction.Deactivated += (sender, args) => ChildDeactivated();
            //todo: Possible memory leaks--check on weak references for these
        }
Example #8
0
        public void PerformAction(IInteraction interaction, GameObject gameObject)
        {
            if (interaction == null)
            {
                throw new ArgumentNullException();
            }

            interaction.PerformAction(gameObject);
        }
Example #9
0
 public SimpleInteraction(IInteraction parent, string name, object value)
 {
     if (parent != null)
     {
         this.parent           = parent;
         this.ExceptionHandler = parent.ExceptionHandler;
     }
     this [name] = value;
 }
Example #10
0
 private void ExitActiveInteraction()
 {
     if (_ActiveInteraction == null)
     {
         return;
     }
     _ActiveInteraction.OnExit();
     _ActiveInteraction = null;
 }
        public override void AddInteraction(IInteraction interaction)
        {
            base.AddInteraction(interaction);

            // child interactions on a composite interaction start out disabled
            // the composite will enable interaction when its interaction is triggered
            interaction.IsEnabled = false;
            interaction.Completed += (sender, args) => ChildCompleted(sender);
        }
Example #12
0
        /// <summary>
        /// Pick from list
        /// </summary>
        /// <returns><c>true</c>, if successful, <c>false</c> otherwise.</returns>
        /// <param name="ourList">Our list.</param>
        /// <param name="i">The index.</param>
        /// <param name="parameters">Parameters.</param>
        bool ListPick(List <IInteraction> ourList, int i, IInteraction parameters)
        {
            if (i < ourList.Count)
            {
                return(iterator.TryProcess(ourList [i].Clone(parameters)));
            }

            return(true);
        }
Example #13
0
 public ErrorHandledInteraction(
     Service cause, IInteraction context, Exception problem
     ) : base(context)
 {
     this ["errorfile"]         = cause.ConfigLine;
     this ["errormessage"]      = problem.Message;
     this ["errorcause"]        = cause.Description;
     this ["errorinitializing"] = cause.InitErrorMessage;
     this ["errorstack"]        = problem.StackTrace;
 }
Example #14
0
        protected void UseCommand(IInteraction parameters, Action <IDbCommand> callback)
        {
            IDbConnection connection = GetConnection(parameters);

            lock (connection) {
                using (IDbCommand command = connection.CreateCommand()) {
                    UseCommand(parameters, callback, command);
                }
            }
        }
Example #15
0
        protected override bool Process(IInteraction parameters)
        {
            CacheInteraction cache;

            cache = (CacheInteraction)parameters.GetClosest(typeof(CacheInteraction));

            cache.List.Add(parameters);

            return(true);
        }
Example #16
0
        public List <ValidationResult> ValidateResource(IInteraction resource)
        {
            var context = new ValidationContext(resource, null, null);
            var results = new List <ValidationResult>();

            Validator.TryValidateObject(resource, context, results, true);
            ValidateInteractionRules(resource, results);

            return(results);
        }
Example #17
0
        static void Main(string[] args)
        {
            ChannelFactory <IInteraction> factory = new ChannelFactory <IInteraction>(new NetTcpBinding(), new EndpointAddress("net.tcp://localhost:11000/InputRequest"));

            IInteraction proxy = factory.CreateChannel();

            Console.WriteLine(proxy.sendMsg("Raaaadi " + DateTime.Now));

            Console.ReadLine();
        }
Example #18
0
        protected override bool Process(IInteraction parameters)
        {
            int affectedRows = 0;

            UseCommand(parameters, delegate(IDbCommand command) {
                affectedRows = command.ExecuteNonQuery();
            });

            return(changeCountBranches[affectedRows].TryProcess(parameters));
        }
 public MainWindow()
 {
     InitializeComponent();
     DataContext = new AppModel()
     {
         Settings = new SettingsModel(),
         Renderer = new RendererModel()
     };
     _fileSystem = new XmlInteraction();
 }
 public MainWindow()
 {
     InitializeComponent();
     DataContext = new AppModel()
     {
         Settings = new SettingsModel(),
         Renderer = new RendererModel()
     };
     _fileSystem = new XmlInteraction();
 }
Example #21
0
        protected override bool Process(IInteraction parameters)
        {
            lock (jobs) {
                jobs.Enqueue(parameters);
                locker.Release();
                locker.WaitOne();
            }

            return(true);
        }
Example #22
0
        protected bool TryGetImage(IInteraction parameters, ImageProcessor imageCallback)
        {
            bool success = false;

            IInteraction candidateImageOut;

            if (parameters.TryGetClosest(typeof(IOutgoingBodiedInteraction), out candidateImageOut))
            {
                IOutgoingBodiedInteraction imageOut = (IOutgoingBodiedInteraction)candidateImageOut;

                if (imageOut is IHttpInteraction)
                {
                    if (this.UseJpgInsteadOfPng)
                    {
                        ((IHttpInteraction)imageOut).ResponseHeaders["Content-Type"] = "image/jpg";
                    }
                    else
                    {
                        ((IHttpInteraction)imageOut).ResponseHeaders["Content-Type"] = "image/png";
                    }
                }

                MemoryStream imageData = new MemoryStream();
                SimpleOutgoingInteraction imageSourcer = new SimpleOutgoingInteraction(
                    imageData, Encoding.Default, parameters);

                if (WithBranch.TryProcess(imageSourcer))
                {
                    Image inImage = Bitmap.FromStream(imageData);

                    Bitmap outImage = imageCallback(inImage);

                    inImage.Dispose();

                    if (outImage != emptyBitmap)
                    {
                        outImage.Save(imageOut.OutgoingBody, selectedImageformat);

                        outImage.Dispose();
                    }

                    success = true;
                }
                else
                {
                    Secretary.Report(5, "Image source failure");
                }
            }
            else
            {
                Secretary.Report(5, "No outgoing body found to write result image to.");
            }

            return(success);
        }
Example #23
0
        /// <summary>
        /// Iterates without partitioning.
        /// </summary>
        /// <returns><c>true</c>, if successful, <c>false</c> otherwise.</returns>
        /// <param name="parameters">Parameters.</param>
        /// <param name="cache">Cache.</param>
        bool IterateWithoutPartition(IInteraction parameters, CacheInteraction cache)
        {
            bool success = true;

            foreach (IInteraction item in cache.List)
            {
                success &= iterator.TryProcess(item.Clone(parameters));
            }

            return(success);
        }
Example #24
0
        private void DoScreenPop(IInteraction interaction)
        {
            var url = String.Format("http://localhost:{0}/?{1}", SAPPort, CreateQueryString(interaction));

            _traceService.Status("Screen pop to " + url);

            WebRequest request = WebRequest.Create(url);

            request.Method = HttpMethod.Get.Method;
            request.GetResponse();
        }
Example #25
0
 /// <summary>
 /// 交互时事件
 /// </summary>
 /// <param name="obj"></param>
 private void Single_OnInteraction(IInteraction obj)
 {
     if (obj == null)
     {
         HiedTispText();
     }
     else
     {
         ShowTipsText(obj.Tips);
     }
 }
Example #26
0
        protected override bool Process(IInteraction uncastParameters)
        {
            IHttpInteraction parameters;
            string           trimmedrootpath, trimmedurl, finalpath, extension, mimeType = "application/octet-stream";

            parameters      = (IHttpInteraction)uncastParameters.GetClosest(typeof(IHttpInteraction));
            trimmedrootpath = rootPath.TrimEnd('/');
            trimmedurl      = HttpUtility.UrlDecode(parameters.URL.ReadToEnd().TrimStart('/'));
            finalpath       = string.Format("{0}/{1}", trimmedrootpath, trimmedurl);

            FileInfo sourcefile = new FileInfo(finalpath);

            extension = sourcefile.Extension.TrimStart('.').ToLower();

            if (mimeTypes.TryGetString(extension, out mimeType) || optionalMimetypes)
            {
                if (sourcefile.Exists)
                {
                    FileInfo info = new FileInfo(finalpath);

                    if (doSendFile)
                    {
                        parameters.SetStatusCode(200);
                        parameters.SetContentType(mimeType);
                        parameters.SetContentLength(info.Length);
                        parameters.PurgeBuffer();
                        sendFileToStream(info, parameters.OutgoingBody);
                    }

                    if ((doneBranch ?? Stub) != Stub)
                    {
                        doneBranch.TryProcess(
                            new FilesystemChangeInteraction(
                                info,
                                Splitter.Split(
                                    info.Name),
                                this.rootPath,
                                uncastParameters));
                    }
                }
                else
                {
                    parameters.SetStatusCode(404);
                    notFoundBranch.TryProcess(uncastParameters);
                }
            }
            else
            {
                parameters.SetStatusCode(410);
                badRequestBranch.TryProcess(uncastParameters);
            }

            return(true);
        }
Example #27
0
 public DataInteraction(
     IInteraction parameters,
     string[] columnNames,
     object[] values) : base(
         parameters)
 {
     for (int columnIndex = 0; columnIndex < columnNames.Length; columnIndex++)
     {
         this [columnNames [columnIndex]] = values [columnIndex];
     }
 }
Example #28
0
        public IInteraction GetClosest(Type t)
        {
            IInteraction closest = null;

            if (t.Equals(this.GetType()))
            {
                closest = this;
            }

            return(closest);
        }
    private void Update()
    {
        if (GameMarager.Single.State != State.Game)
        {
            return;
        }

        //player旋转
        transform.Rotate(0, InputMarager.Horizontal * RotationSpeed * Time.deltaTime, 0);
        //player移动 方向
        if (InputMarager.Space)
        {
            UpSpeed = 1; Invoke("ResetUpSpeed", 0.2f);
        }
        Vector3 Direction = new Vector3(InputMarager.LeftRight, UpSpeed, InputMarager.ForwardBack);

        //把方向改变为自己的移动方向
        Direction = transform.TransformDirection(Direction);
        //角色控制器 控制移动
        MoveController.Move(Direction * MoveSpeed * Time.deltaTime);

        //发射线检测是否有交互物体
        InteractionObject = null;

        RaycastHit hit;

        if (Physics.Raycast(Camera.main.transform.position, Camera.main.transform.TransformDirection(Vector3.forward), out hit, 4f, InteractionLayerMask))
        {
            InteractionObject = hit.collider.gameObject.GetComponent <IInteraction>();
            //如果找到的物体不为空 并且是未激活
            if (InteractionObject != null && InteractionObject.IsActive == false)
            {
                InteractionObject = null;
            }

            if (InteractionObject != null && InteractionObject != LastInteractionObject)
            {
                OnInteraction(InteractionObject);
            }
            //如果不为空 并且按下E 展开交互的ui
            if (InteractionObject != null)
            {
                if (InputMarager.Use)
                {
                    InteractionObject.Use();
                }
            }
        }
        else
        {
            OnInteraction(InteractionObject);
        }
        LastInteractionObject = InteractionObject;
    }
Example #30
0
 private void OnTriggerExit2D(Collider2D other)
 {
     if (other.tag == "Usable")
     {
         usable = null;
     }
     if (other.tag == "SavePoint")
     {
         savePoint = null;
     }
 }
Example #31
0
        /// <summary>
        /// Shows form for faulty input
        /// </summary>
        /// <returns><c>true</c>, if successfully shown form, <c>false</c> otherwise.</returns>
        /// <param name="parsedData">Parsed data.</param>
        /// <param name="parameters">Parameters.</param>
        private bool DoFaultyForm(VerificationInteraction parsedData, IInteraction parameters)
        {
            bool success = true;

            Encoding encoding;

            IInteraction outgoingCandidate;

            if (parameters.TryGetClosest(typeof(IOutgoingBodiedInteraction), out outgoingCandidate))
            {
                IOutgoingBodiedInteraction outgoing = (IOutgoingBodiedInteraction)outgoingCandidate;

                encoding = outgoing.Encoding;
            }
            else
            {
                encoding = Encoding.UTF8;
            }

            foreach (string fieldName in parsedData.FaultyFields)
            {
                string failName = string.Format("{0}_failure", fieldName);

                Service handler;
                FailureWrapperInteraction fwInteraction = null;
                IInteraction interaction = parameters;

                handler = FailureHandler ?? Branches [failName];

                if (handler != null)
                {
                    if (MapErrorStrings)
                    {
                        interaction = fwInteraction = new FailureWrapperInteraction(parameters, encoding);
                    }

                    if (FailureHandler != null)
                    {
                        SimpleInteraction failureInteraction;
                        interaction = failureInteraction = new SimpleInteraction(interaction);
                        failureInteraction ["failurename"] = failName;
                    }

                    success &= handler.TryProcess(interaction);

                    if (fwInteraction != null)
                    {
                        parsedData [failName] = fwInteraction.GetTextAndClose();
                    }
                }
            }

            return(success & Form.TryProcess(parsedData));
        }
Example #32
0
        private MessageTypeKey GetTypeFromPartTypeMapping(VersionNumber version, IInteraction messageBean)
        {
            var mapping = GetClassAttributes(messageBean.GetType(), typeof(Hl7PartTypeMappingAttribute));

            if (mapping != null && mapping.Value.Length > 0 && StringUtils.IsNotBlank(mapping.Value[0]))
            {
                return(new MessageTypeKey(version, mapping.Value[0]));
            }

            throw new MarshallingException("Cannot find a type for " + messageBean.GetType());
        }
        public GridSimulation(int length, int width, Configuration config)
            : base(config)
        {
            Length = length;
            Width = width;

            attackInteraction = new AttackInteraction(2, -2, 0, 1, 1.0, 1);
            crossoverInteraction = new CrossoverInteraction(true, config.AgentSettings.ReproductionInheritance);
            multipointCrossoverInteraction = new MultipointCrossoverInteraction(true, config.AgentSettings.ReproductionInheritance);
            asexualReproductionInteraction = new AsexualInteraction(true, config.AgentSettings.ReproductionInheritance);
        }
Example #34
0
        protected virtual string GetCacheName(IInteraction parameters)
        {
            string cacheName;

            if (!parameters.TryGetFallbackString(this.CacheNameSource, out cacheName))
            {
                cacheName = "noname";
            }

            return(cacheName);
        }
Example #35
0
        public void ClientInteract(InteractionEvent interactionEvent, IInteraction interaction,
                                   InteractionReference reference)
        {
            IClientInteraction clientInteraction = interaction.CreateClient(interactionEvent);

            if (clientInteraction != null)
            {
                clientInteractions.Add(new ClientInteractionInstance(clientInteraction,
                                                                     interactionEvent, reference));
            }
        }
Example #36
0
        public bool TryGetClosest(Type t, IInteraction limit, out IInteraction closest)
        {
            for (closest = this; (closest != limit); closest = closest.Parent)
            {
                if (t.IsAssignableFrom(closest.GetType()))
                {
                    return(true);
                }
            }

            return(false);
        }
Example #37
0
 /// <summary>
 /// This method adds an interaction to the users overview section
 /// </summary>
 /// <param name="pInteraction">The interaction to add</param>
 public void AddRecentlyChangedInteraction(IInteraction pInteraction)
 {
     switch (pInteraction.Type)
     {
         case InteractionType.Project:
             Project project = (Project) pInteraction;
             dgw_Recent.Rows.Add(project.Id,
                 project.Type.ToString(),
                 project.Name,
                 project.State.ToString(),
                 project.ModifiedDateTime.ToString("u"));
             break;
         case InteractionType.Task:
             Task task = (Task)pInteraction;
             dgw_Recent.Rows.Add(task.Id,
                 task.Type.ToString(),
                 task.Title,
                 task.State.ToString(),
                 task.ModifiedDateTime.ToString("u"));
             break;
         case InteractionType.Survey:
             Survey survey = (Survey) pInteraction;
             dgw_Recent.Rows.Add(survey.Id,
                 survey.Type.ToString(),
                 survey.Text,
                 survey.State.ToString(),
                 survey.ModifiedDateTime.ToString("u"));
             break;
         case InteractionType.Expense:
             Expense expense = (Expense)pInteraction;
             dgw_Recent.Rows.Add(expense.Id,
                 expense.Type.ToString(),
                 expense.Text,
                 expense.State.ToString(),
                 expense.ModifiedDateTime.ToString("u"));
             break;
         case InteractionType.Timeslice:
             Timeslice timeslice = (Timeslice)pInteraction;
             dgw_Recent.Rows.Add(timeslice.Id,
                 "Timeslice",
                 $"Time spent = {new TimeSpan(0,0,0,timeslice.Duration).TotalHours.ToString()}:{new TimeSpan(0, 0, 0, timeslice.Duration).TotalMinutes.ToString()}:{new TimeSpan(0, 0, 0, timeslice.Duration).TotalSeconds.ToString()}",
                 "Finished",
                 timeslice.Target.CreatedDateTime.ToString("u"));
             break;
         default:
             return;
     }
 }
        protected override void InteractionAdded(IInteraction interaction)
        {
            base.InteractionAdded(interaction);
            _traceContext.Note("interaction added: " + interaction.InteractionId);

            var url = interaction.GetAttribute(UrlAttribute);

            var browser = BrowserControl.Instance;

            if (browser != null)
            {
                if (!String.IsNullOrEmpty(url))
                {
                    _traceContext.Note("Navigating to: " + url);
                    browser.NavigateToUrl(url);
                }
            }    
        }
Example #39
0
 public Timeslice(string pId, IUser pUser, DateTime pStartDT, DateTime pEndDT, IInteraction pTarget)
 {
 }
 public void AddInteraction(IInteraction interaction)
 {
     _interactions.Add(interaction);
     interaction.Activated += Interaction_Activated;
     interaction.DeActivated += Interaction_DeActivated;
 }
 private InteractionViewModel(IInteraction interaction)
 {
 }
Example #42
0
 /// <summary>
 /// Initializes all attributes
 /// </summary>
 /// <param name="pId"></param>
 /// <param name="pUser"></param>
 /// <param name="pDuration"></param>
 private void InitializeProperties(string pId, IUser pUser, int pDuration, IInteraction pTarget)
 {
     Id = pId;
     User = pUser;
     Duration = pDuration;
     Target = pTarget;
 }
Example #43
0
 /// <summary>
 /// Constructor of the class
 /// </summary>
 /// <param name="pId"></param>
 /// <param name="pUser"></param>
 /// <param name="pStartDT"></param>
 /// <param name="pEndDT"></param>
 public Timeslice(string pId, IUser pUser, DateTime pStartDT, DateTime pEndDT, IInteraction pTarget)
 {
     int pDuration = CalculateDuration(pStartDT, pEndDT);
     InitializeProperties(pId, pUser, pDuration, pTarget);
 }
Example #44
0
 /// <summary>
 /// Constructor of the class
 /// </summary>
 /// <param name="pId"></param>
 /// <param name="pUser"></param>
 /// <param name="pDuration"></param>
 public Timeslice(string pId, IUser pUser, int pDuration, IInteraction pTarget)
 {
     InitializeProperties(pId, pUser, pDuration, pTarget);
 }
 public InteractionState(IInteraction interaction)
 {
     State = interaction.GetAttribute(InteractionAttributes.State);
     IsMuted = interaction.GetAttribute(InteractionAttributes.Muted) == "1";
 }
Example #46
0
 public virtual IExpense CreateExpense(string pId, string pText, IUser pUser, IInteraction pTarget)
 {
     throw new System.NotImplementedException();
 }
Example #47
0
 public virtual IExpense CreateExpense(string pId, string pText, System.Drawing.Image pReceipt, decimal pValue, IUser pUser, IInteraction pTarget)
 {
     throw new System.NotImplementedException();
 }
        private IList<IAgent> DoSexualReproduction(IAgent parent1, IAgent parent2, IInteraction<ICell, ICell, IList<ICell>> interaction, ILocation location)
        {
            if (parent1 == null) throw new ArgumentNullException("parent1");
            if (parent1.Cells.Count == 0) throw new ArgumentException("Agent must have at least one cell", "parent1");
            if (parent2 == null) throw new ArgumentNullException("parent2");
            if (parent2.Cells.Count == 0) throw new ArgumentException("Agent must have at least one cell", "parent2");
            if (interaction == null) throw new ArgumentNullException("interaction");
            if (location == null) throw new ArgumentNullException("location");

            if (parent1.IsMultiAgent() || parent2.IsMultiAgent())
            {
                return DoMulticellularSexualReproduction(parent1, parent2, interaction, location);
            }

            // Reproduce assuming both agents have a single cell
            var childCells = interaction.Interact(parent1.Cells[0], parent2.Cells[0]);

            var child1 = new GridAgent();
            child1.Cells.Add(childCells[0]);
            this.RegisterBirth(child1, new BirthEvent(location, CurrentGeneration, interaction.GetType(), parent1.Species, parent2.Species));

            var child2 = new GridAgent();
            child2.Cells.Add(childCells[1]);
            this.RegisterBirth(child2, new BirthEvent(location, CurrentGeneration, interaction.GetType(), parent1.Species, parent2.Species));

            // Events
            this.AddEventToAgent(parent1, new ReproductionEvent(location, CurrentGeneration, interaction.GetType(), parent2.Species, child1.Species, child2.Species));
            this.AddEventToAgent(parent2, new ReproductionEvent(location, CurrentGeneration, interaction.GetType(), parent1.Species, child1.Species, child2.Species));

            return new[] {child1, child2};
        }
 public bool CanExecute(IInteraction selectedInteraction)
 {
     return true;
 }
Example #50
0
 public virtual ITimeslice CreateTimeslice(string pId, IUser pUser, int pDuration, IInteraction pTarget)
 {
     if (string.IsNullOrEmpty(pId))
         pId = Helper.GenerateId();
     return (new Timeslice(pId, pUser, pDuration, pTarget));
 }
Example #51
0
 public virtual ITimeslice CreateTimeslice(string pId, IUser pUser, DateTime pStartDT, DateTime pEndDT, IInteraction pTarget)
 {
     if (string.IsNullOrEmpty(pId))
         pId = Helper.GenerateId();
     return (new Timeslice(pId, pUser, pStartDT, pEndDT, pTarget));
 }
Example #52
0
 public virtual ITimeslice CreateTimeslice(string pId, IUser pUser, DateTime pStartDT, DateTime pEndDT, IInteraction pTarget)
 {
     throw new System.NotImplementedException();
 }
Example #53
0
 public Timeslice(string pId, IUser pUser, int pDuration, IInteraction pTarget)
 {
 }
Example #54
0
 public virtual ITimeslice CreateTimeslice(string pId, IUser pUser, int pDuration, IInteraction pTarget)
 {
     throw new System.NotImplementedException();
 }
Example #55
0
 public virtual void RemoveInteraction(IInteraction pInteraction)
 {
     throw new System.NotImplementedException();
 }
 private IList<IAgent> DoMulticellularSexualReproduction(IAgent parent1, IAgent parent2, IInteraction<ICell, ICell, IList<ICell>> interaction, ILocation location)
 {
     throw new NotImplementedException();
 }
Example #57
0
 /// <summary>
 /// Initializes all attributes
 /// </summary>
 /// <param name="pId"></param>
 /// <param name="pText"></param>
 /// <param name="pImage"></param>
 /// <param name="pValue"></param>
 /// <param name="pCreator"></param>
 /// <param name="pTarget"></param>
 private void InitializeProperties(string pId, string pText, Image pImage, decimal pValue, IUser pCreator, IInteraction pTarget)
 {
     Id = pId;
     User = pCreator;
     Creator = pCreator;
     Text = pText;
     Receipt = pImage;
     Value = pValue;
     Target = pTarget;
     CreatedDateTime = DateTime.Now;
     ModifiedDateTime = DateTime.Now;
     IsActive = true;
 }
 public static InteractionViewModel FromIInteraction(IInteraction interaction)
 {
     return new InteractionViewModel(interaction);
 }
Example #59
0
 public virtual IExpense CreateExpense(string pId, string pText, IUser pUser, IInteraction pTarget)
 {
     if (string.IsNullOrEmpty(pId))
         pId = Helper.GenerateId();
     return (new Expense(pId, pText, pUser, pTarget));
 }
Example #60
0
 public virtual IExpense CreateExpense(string pId, string pText, System.Drawing.Image pReceipt, decimal pValue, IUser pUser, IInteraction pTarget)
 {
     if (string.IsNullOrEmpty(pId))
         pId = Helper.GenerateId();
     return (new Expense(pId, pText, pReceipt, pValue, pUser, pTarget));
 }