public SetWorkflowItemNextItemRequest(WorkflowItem workflowItem)
        {
            this.NextItem = workflowItem.NextItem;

            RestUrl = String.Format("/workflowitems/{0}/nextitem", workflowItem.Id);
            Method = Method.POST;
        }
        /// <summary>
        /// Erstellt eine neue Instanz eines ViewModel entsprechend dem übergebenen WorkflowItem-Model.
        /// </summary>
        /// <param name="item">Das Workflowitem.</param>
        /// <returns>Das dem Workflowitem entsprechende ViewModel.</returns>
        public static WorkflowItemViewModel CreateWorkflowitemViewModel(WorkflowItem item)
        {
            if (item is Task)
            {
                return new TaskViewModel((Task)item);
            }

            if (item is Start)
            {
                return new StartViewModel((Start)item);
            }

            if (item is End)
            {
                return new EndViewModel((End)item);
            }
            if (item is Decision)
            {
                return new DecisionViewModel((Decision)item);
            }
            if (item is Script)
            {
                return new ScriptViewModel((Script)item);
            }
            if (item is Fork)
            {
                return new ForkViewModel((Fork)item);
            }
            if (item is Join)
            {
                return new JoinViewModel((Join)item);
            }

            return null;
        }
        public SetWorkflowItemPositionRequest(WorkflowItem workflowItem)
        {
            this.Position = new Position(workflowItem.Position.X, workflowItem.Position.Y);

            RestUrl = String.Format("/workflowitems/{0}/position", workflowItem.Id);
            Method = Method.POST;
        }
        public CreateWorkflowItemRequest(int workflowId, WorkflowItem workflowItem)
        {
            Type = workflowItem.Type;
            this.Position = new Position(workflowItem.Position.X, workflowItem.Position.Y);

            RestUrl = String.Format("/workflows/{0}/workflowitems", workflowId);
            Method = Method.PUT;
        }
 public void DeleteNextItem(WorkflowItem itemToDel)
 {
     try
     {
         WorkflowItem.NextItem.Remove(itemToDel.Id);
         clientSession.RelaxoClient.SetWorkflowItemNextItem(WorkflowItem);
     }
     catch (Exception)
     {
         WorkflowItem.NextItem.Add(itemToDel.Id);
         throw;
     }
 }
 /// <summary>
 /// Setzt ein NextItem des aktuellen WorkflowItems
 /// </summary>
 /// <param name="nextWorkflowItem">Das Item, dass NextItem werden soll</param>
 public void SetNextItem(WorkflowItem nextWorkflowItem)
 {
     try
     {
         WorkflowItem.NextItem.Add(nextWorkflowItem.Id);
         clientSession.RelaxoClient.SetWorkflowItemNextItem(WorkflowItem);
     }
     catch (Exception)
     {
         WorkflowItem.NextItem.Remove(nextWorkflowItem.Id);
         throw;
     }
 }
        protected WorkflowItemViewModel(WorkflowItem item)
        {
            WorkflowItem = item;
            clientSession = ClientSession.Instance;
            CurrentDragged = false;

            Width = 40;
            Height = 40;
            BorderWidth = 2;
        }