public void UpdateInboundParam(Point inboundLocation, ParamIOGate paramGate)
        {
            ParameterConnection line = paramGate.ConnectionLine;

            try
            {
                Point outboundLocation = new Point(line.Connection.X1, line.Connection.Y1);
                ParamInputModel inboundModel = GetParamModelByCoord(inboundLocation) as ParamInputModel;

                if (inboundModel.Value != null)
                {
                    UndoLineDrawing(paramGate);

                    throw new Exception
                        ("This parameter has already got a data source. You can only have one data source," +
                            "try removing its data source before connecting again.");

                }

                ParameterModel outboundModel = GetParamModelByCoord(outboundLocation) as ParameterModel;

                inboundModel.Value = new ParamBinder(outboundModel.ParentName, outboundModel.Name);
                source = inboundModel; //keep a copy of the source for easy alteration of value
                line.LineDeletionEvent += new ParameterConnection.ParamConnectionEventHandler(line_LineDeletionEvent);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private List<ParameterModel> CopyParameters(List<ParameterModel> paramCollection, string parentName)
        {
            List<ParameterModel> parameters = new List<ParameterModel>();

            foreach (ParameterModel param in paramCollection)
            {
                ParameterModel clonedModel = null;

                if (param.IsInputParam)
                    clonedModel = new ParamInputModel() { IsMandatory = (param.isMandatory) };
                else
                    clonedModel = new ParamOutputModel();

                AssignParamValues(param, clonedModel, parentName);

                parameters.Add(clonedModel);
            }

            AssignSiblingsValue(parameters);

            return parameters;
        }
        public void TestReadBasicParamValuesFrmXML()
        {
            ParamInputModel inputParam1 = new ParamInputModel()
            {
                Name = "InputFile",
                DataType = "System.String",
                ValueStr = "C:\\TestDocument.txt"
            };

            ParamInputModel inputParam2 = new ParamInputModel()
            {
                Name = "InputText",
                DataType = "System.String",
                ValueStr = "HelloWorld"
            };

            Node1.InputParam.Add(inputParam1);
            Node2.InputParam.Add(inputParam2);

            workflowMang.AddActivities("start_0", StartNode);
            workflowMang.AddActivities("Item_1", Node1);
            workflowMang.AddActivities("Item_2", Node2);

            //First parallel
            workflowMang.AddActivityLink("start_0", "Item_1");
            workflowMang.AddActivityLink("start_0", "Item_2");

            System.Diagnostics.Debug.WriteLine("Test Case - direct inputvalue for param");
            string xmlContent = workflowMang.GetWorkflowXML();
            System.Diagnostics.Debug.WriteLine(xmlContent);

            workflowsvc.WorkflowServiceClient service = new workflowsvc.WorkflowServiceClient();
            //service.SaveANDExecuteWFAsync(xmlContent);

        }
        public void TestReadAdvParamBinderFrmXML()
        {
            ParamBinder binder = new ParamBinder("Node_1", "SequenceList");
            ParamInputModel inputParam1 = new ParamInputModel()
            {
                Name = "InputText",
                DataType = "System.String",
                Value = binder
            };

            Node2.InputParam.Add(inputParam1);

            workflowMang.AddActivities("start_0", StartNode);
            workflowMang.AddActivities("Item_1", Node1);
            workflowMang.AddActivities("Item_2", Node2);

            //double sequential activities 
            workflowMang.AddActivityLink("start_0", "Item_1");
            workflowMang.AddActivityLink("Item_1", "Item_2");

            string xmlContent = workflowMang.GetWorkflowXML();

            System.Diagnostics.Debug.WriteLine("Test Case - Adv linkage param value");
            System.Diagnostics.Debug.WriteLine(xmlContent);

            workflowsvc.WorkflowServiceClient service = new workflowsvc.WorkflowServiceClient();
            //service.SaveANDExecuteWFAsync(xmlContent);

        }
        /// <summary>
        /// If this param has a binder object we will write it out first otherwise
        /// we will just write its original input value.
        /// </summary>
        /// <param name="writer">writer object</param>
        /// <param name="param">the subject</param>
        private void WriteInputParam(XmlWriter writer, ParamInputModel param)
        {
            string parameterValue =
                param.ValueStr  != null ? param.ValueStr : null;

            string parameterBinderValue = 
                param.Value     != null ? param.Value.ToString() : null;

            if (parameterValue != null || parameterBinderValue != null)
            {
                writer.WriteStartElement("InputValue");
                writer.WriteAttributeString("name", param.Name);

                if (parameterBinderValue != null)
                    writer.WriteAttributeString("linkFrom", param.Value.ToString());
                    
                else
                    writer.WriteAttributeString("value", param.ValueStr);


                writer.WriteEndElement();
            }
        }