コード例 #1
0
 public IMappingExpression <T> ForMember <TMember>(Expression <Func <T, TMember> > memberSelectorExpression, Expression <Func <TMember, T, bool> > memberValidationFunc,
                                                   string errorMessage = null)
 {
     Constraints.Add(new ObjectValidator <T, TMember>(memberSelectorExpression, memberValidationFunc, errorMessage ?? memberSelectorExpression + " did not pass validation"));
     return(this);
 }
コード例 #2
0
        protected override void fillFromDatabase(List <TableInfo> tables, bool fillRowCount, int maxRecurseDepth)
        {
            if (tables.Exists(t => {
                return(t.TableName.ToUpper().Trim() == TableName.ToUpper().Trim());
            }))
            {
                // this table has already been added and loaded.
                return;
            }


            using (DataManager dm = DataManager.Create(DataConnectionSpec)) {
                // first determine options for the table itself

                DataTable dtTable = null;
                try {
                    dtTable = dm.Read(String.Format("show create table {0}", FullTableName));
                } catch (Exception ex) {
                    if (ex.Message.ToLower().Contains(" doesn't exist"))
                    {
                        // this table isn't defined -- a FK is pointing at a non-existent table.
                        // just jump out and continue processing.
                        return;
                    }
                }

                if (dtTable.Rows.Count > 0)
                {
                    string createTable = dtTable.Rows[0]["Create Table"].ToString();

                    Regex reEngine = new Regex(@"ENGINE=([^\s]*)", RegexOptions.Multiline);
                    Match m        = reEngine.Match(createTable);
                    if (m.Success)
                    {
                        Engine = m.Groups[1].Value;
                    }
                    Regex reCharset = new Regex(@"CHARSET=([^\s]*)", RegexOptions.Multiline);
                    m = reCharset.Match(createTable);
                    if (m.Success)
                    {
                        CharacterSet = m.Groups[1].Value;
                    }

                    Regex reCollate = new Regex(@"COLLATE=([^\s]*)", RegexOptions.Multiline);
                    m = reCollate.Match(createTable);
                    if (m.Success)
                    {
                        Collation = m.Groups[1].Value;
                    }
                    Regex rePkType = new Regex(@"USING ([^\s]*) ", RegexOptions.Multiline);
                    m = rePkType.Match(createTable);
                    if (m.Success)
                    {
                        PrimaryKeySortType = m.Groups[1].Value;
                    }
                }



                // now fill in the fields


                DataTable dt = dm.Read(String.Format("describe {0};", FullTableName));

                Fields = new List <FieldInfo>();

                foreach (DataRow dr in dt.Rows)
                {
                    // create a field object based on the datarow information
                    FieldInfo fi = null;

                    Match  m         = Regex.Match(dr["Type"].ToString(), @"([^(]*)(?:\(([0-9]*),?([0-9]*)?\))?");
                    int    minlength = 0;
                    int    maxlength = 0;
                    int    scale     = 0;
                    int    precision = 0;
                    string fieldType = null;
                    if (m.Success)
                    {
                        fieldType = m.Groups[1].Value.ToString().ToLower();
                        precision = maxlength = Toolkit.ToInt32(m.Groups[2].Value.ToString(), 0);
                        scale     = Toolkit.ToInt32(m.Groups[3].Value.ToString(), 0);
                    }

                    string fieldName = dr["Field"].ToString().ToUpper();

                    bool nullable   = dr["Null"].ToString().ToLower().Trim() != "no";
                    bool primaryKey = dr["Key"].ToString().ToLower().Trim() == "pri";

                    // TODO: Mysql's describe statement does not kick out character set info!
                    //       How are we going to get that for fields that have different char set
                    //       than the default for its table?

                    bool unsigned      = dr["Type"].ToString().ToLower().Contains("unsigned");
                    bool zerofill      = dr["Type"].ToString().ToLower().Contains("zerofill");
                    bool autoIncrement = dr["Extra"].ToString().ToLower().Contains("auto_increment");
                    bool createdDate   = fieldName == "CREATED" || fieldName == "CREATED_AT" || fieldName == "CREATED_DATE";
                    bool createdBy     = fieldName == "CREATED_BY";
                    bool modifiedDate  = fieldName == "MODIFIED" || fieldName == "MODIFIED_AT" || fieldName == "MODIFIED_DATE";
                    bool modifiedBy    = fieldName == "MODIFIED_BY";
                    bool ownedDate     = fieldName == "OWNED" || fieldName == "OWNED_AT" || fieldName == "OWNED_DATE";
                    bool ownedBy       = fieldName == "OWNED_BY";

                    fi           = new MySqlFieldInfo(this);
                    fi.Name      = dr["Field"].ToString();
                    fi.TableName = this.TableName;

                    switch (fieldType)
                    {
                    case "int":
                        fi.DataType = typeof(int);
                        break;

                    case "bigint":
                    case "long":
                        fi.DataType = typeof(long);
                        break;

                    case "text":
                    case "varchar":
                    case "nvarchar":
                        fi.DataType = typeof(string);
                        break;

                    case "char":
                    case "nchar":
                        minlength   = maxlength;
                        fi.DataType = typeof(string);
                        break;

                    case "datetime2":
                    case "datetime":
                        fi.DataType = typeof(DateTime);
                        break;

                    case "float":
                        fi.DataType = typeof(float);
                        break;

                    case "decimal":
                        fi.DataType = typeof(Decimal);
                        break;

                    case "double":
                        fi.DataType = typeof(Double);
                        break;

                    default:
                        throw new InvalidOperationException(getDisplayMember("fillFromDatabase{default}", "Fields of type '{0}' are not supported.\nYou must change the type for {1}.{2} before continuing or add the code to support that type to GrinGlobal.DatabaseInspector.\nSupported types are:\nint\nvarchar\nchar\nnvarchar\nnchar\ndatetime\nfloat\ndouble\ndecimal\n", fieldType, TableName, fieldName));
                    }


                    fi.AddOptions("name", dr["Field"].ToString(),
                                  "nullable", nullable,
                                  "minlength", minlength,
                                  "maxlength", maxlength,
                                  "scale", scale,
                                  "precision", precision,
                                  "primarykey", primaryKey,
                                  "unsigned", unsigned,
                                  "zerofill", zerofill,
                                  "autoincrement", autoIncrement,
                                  "createdby", createdBy,
                                  "createdat", createdDate,
                                  "modifiedby", modifiedBy,
                                  "modifiedat", modifiedDate,
                                  "ownedby", ownedBy,
                                  "ownedat", ownedDate);

                    object defaultVal = dr["default"];
                    if (defaultVal != null)
                    {
                        if (defaultVal == DBNull.Value)
                        {
                            fi.AddOptions("defaultvalue", "{DBNull.Value}");
                        }
                        else if (defaultVal.GetType().ToString().ToLower() == "system.string")
                        {
                            fi.AddOptions("defaultvalue", @"""" + defaultVal + @"""");
                        }
                        else
                        {
                            fi.AddOptions("defaultvalue", defaultVal);
                        }
                    }


                    Fields.Add(fi);
                }

                // now get index information
                DataTable dtTemp      = dm.Read(String.Format("SHOW INDEX FROM {0}", FullTableName));
                string    prevKeyName = null;
                IndexInfo idx         = null;
                foreach (DataRow drTemp in dtTemp.Rows)
                {
                    bool   unique   = drTemp["non_unique"].ToString().Trim() == "0";
                    string keyName  = drTemp["key_name"].ToString();
                    string typeName = drTemp["index_type"].ToString();
//					int sequenceInIndex = Toolkit.ToInt32(drTemp["seq_in_index"].ToString(), 0);
                    if (keyName == "PRIMARY")
                    {
                        // skip.  primary keys are built as part of create table.
                    }
                    else
                    {
                        if (keyName != prevKeyName)
                        {
                            // new index.
                            idx           = IndexInfo.GetInstance(this);
                            idx.TableName = TableName;
                            idx.IndexName = keyName;
                            if (unique)
                            {
                                idx.IndexKind = "UNIQUE";
                            }
                            idx.IndexType = typeName;
                            Indexes.Add(idx);
                            prevKeyName = keyName;
                        }

                        FieldInfo fi = Fields.Find(fi2 => {
                            return(fi2.Name.ToLower() == drTemp["column_name"].ToString().ToLower());
                        });

                        if (fi != null)
                        {
                            idx.Fields.Add(fi);
                        }
                    }
                }



                // fill in rowcount
                if (fillRowCount)
                {
                    RowCount = Toolkit.ToInt32(dm.ReadValue(String.Format("select count(1) from {0}", FullTableName)), 0);
                }

                // we've defined the table as well as all its fields and indexes.
                // add it to the list BEFORE resolving constraints.
                // this lets us sidestep recursion black holes due to circular referential integrity constraints
                // (aka self-referential or t1 -> t2 -> t1, or t1 -> t2 -> t3 -> t1
                if (!tables.Exists(t => {
                    return(this.TableName.ToUpper().Trim() == t.TableName.ToUpper().Trim());
                }))
                {
                    tables.Add(this);
                }



                // now get constraint information
                // (this is already in the dtTable from CREATE TABLE, just parse it here)
                if (dtTable.Rows.Count > 0)
                {
                    string createTable = dtTable.Rows[0]["Create Table"].ToString();

                    //   CONSTRAINT `FK_ACC_PI` FOREIGN KEY (`PIVOL`) REFERENCES `pi` (`PIVOL`),
                    //              name                     src fields           tgt   tgt fields

                    Regex           reConstraint = new Regex(@"CONSTRAINT[\s]*([^\s]*) FOREIGN KEY \(([^\s,]*)*\) REFERENCES ([^\s]*) \(([^\s,]*)*\)", RegexOptions.Multiline);
                    MatchCollection mc           = reConstraint.Matches(createTable);
                    if (mc.Count > 0)
                    {
                        foreach (Match m in mc)
                        {
                            ConstraintInfo ci = new MySqlConstraintInfo(this);
                            ci.ConstraintName      = m.Groups[1].Value.Replace("`", "").ToUpper();
                            ci.TableName           = this.TableName;
                            ci.ReferencesTableName = m.Groups[3].Value.Replace("`", "").ToUpper();
                            // needed for lazy evaluation
                            ci.TableList = tables;

                            // determine which field(s) this foreign key points at
                            TableInfo tiRef = null;
                            if (this.TableName.ToLower().Trim() == ci.ReferencesTableName.ToLower().Trim())
                            {
                                // self-referential.
                                tiRef = this;
                            }
                            else
                            {
                                // see if it's pointing at a table we've already resolved
                                foreach (TableInfo ti in tables)
                                {
                                    if (ti.TableName.ToLower().Trim() == ci.ReferencesTableName.ToLower().Trim())
                                    {
                                        tiRef = ti;
                                        break;
                                    }
                                }
                            }


                            if (tiRef == null)
                            {
                                // if (maxRecurseDepth > 0) {

                                // the current table references one that isn't loaded yet.
                                // load it (and all of its referenced tables)
                                if (!tables.Exists(te => {
                                    return(te.TableName.ToLower().Trim() == ci.ReferencesTableName.ToLower().Trim());
                                }))
                                {
                                    tiRef = new MySqlTableInfo(DataConnectionSpec);
                                    tiRef.Fill(SchemaName, ci.ReferencesTableName, tables, fillRowCount, maxRecurseDepth - 1);
                                    if (!tables.Exists(t => {
                                        return(tiRef.TableName.ToUpper().Trim() == t.TableName.ToUpper().Trim());
                                    }))
                                    {
                                        tables.Add(tiRef);
                                    }
                                }
                                //} else {
                                //    // there's more FK relationships, but they specified not to follow them.
                                //    // we already filled in the ci.ReferencesTableName so we can do lazy evaluation on it later if need be.
                                //    // the lazy evaluation will essentially redo everything we did above, but get past this step to fill the constraint info.
                                //    Constraints.Add(ci);

                                //    continue;

                                //}
                            }

                            ci.ReferencesTable = tiRef;

                            foreach (Capture cap2 in m.Groups[4].Captures)
                            {
                                if (cap2.Length > 0)
                                {
                                    string refFieldName = cap2.Value.Replace("`", "").ToUpper();
                                    foreach (FieldInfo fi2 in tiRef.Fields)
                                    {
                                        if (fi2.Name.ToUpper().Trim() == refFieldName.ToUpper().Trim())
                                        {
                                            ci.ReferencesFields.Add(fi2);
                                            break;
                                        }
                                    }
                                }
                            }

                            // tell each field in our table if they're a foreign key elsewhere
                            for (int i = 0; i < m.Groups[2].Captures.Count; i++)
                            {
                                Capture cap = m.Groups[2].Captures[i];
                                if (cap.Length > 0)
                                {
                                    string srcFieldName = cap.Value.Replace("`", "").ToUpper();
                                    foreach (FieldInfo fi in this.Fields)
                                    {
                                        if (fi.Name.ToUpper().Trim() == srcFieldName.ToUpper().Trim())
                                        {
                                            fi.IsForeignKey        = true;
                                            fi.ForeignKeyTableName = ci.ReferencesTableName;
                                            if (ci.ReferencesFields.Count > i)
                                            {
                                                fi.ForeignKeyFieldName = ci.ReferencesFields[i].Name;
                                            }
                                            ci.SourceFields.Add(fi);
                                            break;
                                        }
                                    }
                                }
                            }
                            Constraints.Add(ci);
                        }
                    }
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Builds a new PivotTable based on a given DataTable, a pivot column,
        /// and the column that contains the values to be summarized.
        /// </summary>
        /// <param name="dt">DataTable with the original data.</param>
        /// <param name="pivotField">Name of the column that contains the pivot values (e.g. year, quarter).</param>
        /// <param name="valueField">Name of the column that contains the values to summarize (e.g. sales).</param>
        /// <param name="sum">Set to true to sum values, false to count.</param>
        public PivotTable(DataTable dt, string pivotField, string valueField, bool sum)
        {
            // sort source table by pivot values
            // so pivot columns will be added in order
            DataView dv = new DataView(dt);

            dv.Sort = pivotField;

            // create list of key columns
            // used as keys when adding rows to the pivot table
            ArrayList keyColumns = new ArrayList();

            foreach (DataColumn col in dt.Columns)
            {
                string colName = col.ColumnName;
                if (colName != pivotField && colName != valueField)
                {
                    DataColumn key = Columns.Add(colName, col.DataType);
                    keyColumns.Add(key);
                }
            }

            // add keys to pivot table (to enable lookup)
            UniqueConstraint unique = new UniqueConstraint(
                (DataColumn[])keyColumns.ToArray(typeof(DataColumn)), true);

            Constraints.Add(unique);

            // dimension look up array
            object[] keys = new object[keyColumns.Count];

            // use int or decimal to count or sum values
            Type type = (sum)? typeof(decimal): typeof(int);

            // add values to pivot table
            Hashtable pivotNames = new Hashtable();

            foreach (DataRowView drv in dv)
            {
                // get pivot value
                string pivotValue = drv[pivotField].ToString();

                // get pivot column name (from hash if we can, to save time)
                string pivotName = pivotNames[pivotValue] as string;
                if (pivotName == null)
                {
                    // build pivot column name
                    pivotName = Regex.Replace(pivotField, "[aeiou]", string.Empty);
                    if (pivotName.Length > 5)
                    {
                        pivotName = pivotName.Substring(0, 5);
                    }
                    pivotName += pivotValue;
                    pivotName  = Regex.Replace(pivotName, "[^A-Za-z0-9_]", string.Empty);

                    // save it for next time
                    pivotNames[pivotValue] = pivotName;
                }

                // add pivot column if necessary
                if (!Columns.Contains(pivotName))
                {
                    Columns.Add(pivotName, type);
                }

                // lookup existing row based on key columns
                for (int i = 0; i < keys.Length; i++)
                {
                    string name = ((DataColumn)keyColumns[i]).ColumnName;
                    keys[i] = drv[name];
                }
                DataRow drp = Rows.Find(keys);

                // add new row if necessary
                if (drp == null)
                {
                    drp = NewRow();
                    foreach (DataColumn col in keyColumns)
                    {
                        string name = col.ColumnName;
                        drp[name] = drv[name];
                    }
                    Rows.Add(drp);
                }

                // get current aggregate value
                decimal oldVal = (drp[pivotName] != DBNull.Value)
                                        ? (decimal)Convert.ChangeType(drp[pivotName], typeof(decimal))
                                        : (decimal)0;

                // calculate aggregate (sum or count)
                if (sum)
                {
                    decimal newVal = (drv[valueField] != DBNull.Value)
                                                ? (decimal)Convert.ChangeType(drv[valueField], typeof(decimal))
                                                : (decimal)0;
                    drp[pivotName] = oldVal + newVal;
                }
                else
                {
                    if (drv[valueField] != DBNull.Value)
                    {
                        drp[pivotName] = (int)oldVal + 1;
                    }
                }
            }
        }
コード例 #4
0
 public GetPhoneNumberPricing()
 {
     Constraints.Add(ActivityConstraints.HasParentType <GetPhoneNumberPricing, TwilioApiScope>(string.Format(Resources.ValidationScope_Error, Resources.TwilioApiScope_DisplayName)));
 }
コード例 #5
0
 public ExtractTextUntilBlankLine()
 {
     Constraints.Add(ActivityConstraints.HasParentType <ExtractTextUntilBlankLine, TextApplicationScope>(string.Format(Resources.ValidationScope_Error, Resources.TextApplicationScope_DisplayName)));
 }
コード例 #6
0
 public Update_Subscriber()
 {
     Constraints.Add(CheckParentConstraint.GetCheckParentConstraint <Update_Subscriber>(typeof(Salesforce_Marketing_Cloud_Scope).Name));
     Parameters = new List <ParametersArgument>();
     cmdTYPE    = Type_of_Command.UpdateSubscriber;
 }
コード例 #7
0
 public GetMessageMedia()
 {
     Constraints.Add(ActivityConstraints.HasParentType <GetMessageMedia, TwilioApiScope>(string.Format(Resources.ValidationScope_Error, Resources.TwilioApiScope_DisplayName)));
 }
コード例 #8
0
 public SendResponse()
 {
     persist = new Persist();
     Constraints.Add(OperationActivityHelper.VerifyParentIsWorkflowActivity());
     Constraints.Add(OperationActivityHelper.VerifyParentIsReceiveRequestSendResponseScope());
 }
コード例 #9
0
 public UpdateTicket()
 {
     Constraints.Add(ActivityConstraints.HasParentType <UpdateTicket, ZendeskScope>(string.Format(Resources.ValidationScope_Error, Resources.ZendeskScope_DisplayName)));
 }
コード例 #10
0
 public Get_DataExtensionObject_List()
 {
     Constraints.Add(CheckParentConstraint.GetCheckParentConstraint <Get_DataExtensionObject_List>(typeof(Salesforce_Marketing_Cloud_Scope).Name));
 }
コード例 #11
0
 public ManageRepository()
 {
     Constraints.Add(item: ActivityConstraints.HasParentType <ManageRepository, BitbucketAPIScope>(validationMessage: string.Format(Resources.ValidationScope_Error, Resources.BitbucketAPIScope_DisplayName)));
 }
コード例 #12
0
 public SomeOtherAction()
 {
     AddList.Add(new STRIPS.Fact("True"));
     AddList.Add(new STRIPS.Fact("OneParam", new STRIPS.NamedParameter("test")));
     Constraints.Add(TypeCheck(typeof(string), new STRIPS.NamedParameter("test")));
 }
 public ExtractAllLinesBelowAnchorText()
 {
     Constraints.Add(ActivityConstraints.HasParentType <ExtractAllLinesBelowAnchorText, TextApplicationScope>(string.Format(Resources.ValidationScope_Error, Resources.TextApplicationScope_DisplayName)));
 }
コード例 #14
0
 public DeleteFax()
 {
     Constraints.Add(ActivityConstraints.HasParentType <DeleteFax, TwilioApiScope>(string.Format(Resources.ValidationScope_Error, Resources.TwilioApiScope_DisplayName)));
 }
コード例 #15
0
 public DeleteDatabase()
 {
     Constraints.Add(ParentConstraint.CheckThatParentsAreOfType <DeleteDatabase, ParentScope>("Activity is valid only inside Mongo Database Scope"));
 }
コード例 #16
0
 public Add_List()
 {
     Constraints.Add(CheckParentConstraint.GetCheckParentConstraint <Add_List>(typeof(Salesforce_Marketing_Cloud_Scope).Name));
     Parameters = new List <ParametersArgument>();
     cmdTYPE    = Type_of_Command.AddList;
 }
コード例 #17
0
 public ChildActivity()
 {
     Constraints.Add(ActivityConstraints.HasParentType <ChildActivity, ParentScope>(Resources.ValidationMessage));
 }
コード例 #18
0
ファイル: Next.cs プロジェクト: alexandretperez/Autossential
 public Next()
 {
     Constraints.Add(ActivityConstraints.CreateConstraint <Next, Iterate>(Resources.Validation_ScopeErrorFormat(nameof(Iterate))));
 }
コード例 #19
0
 public GetUserFields()
 {
     Constraints.Add(ActivityConstraints.HasParentType <GetUserFields, ZendeskScope>(string.Format(Resources.ValidationScope_Error, Resources.ZendeskScope_DisplayName)));
 }
 protected IndicoActivityBase()
 {
     Constraints.Add(ActivityConstraints.HasParentType <IndicoActivityBase <TInput, TOutput>, IndicoScope>(string.Format(Resources.ValidationScope_Error, Resources.IndicoScope_DisplayName)));
 }
コード例 #21
0
        public KeyBoardInteractionDiagramVM()
        {
            #region Properties

            Constraints = Constraints.Add(GraphConstraints.Undoable);

            DefaultConnectorType = ConnectorType.Line;

            PageSettings = new PageSettings()
            {
                PageBackground  = new SolidColorBrush(Colors.Transparent),
                PageBorderBrush = new SolidColorBrush(Colors.Transparent),
            };

            SelectedItems = new SelectorViewModel()
            {
                SelectorConstraints = SelectorConstraints.Default & ~SelectorConstraints.QuickCommands,
            };

            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.All,
                SnapToObject    = SnapToObject.All,
            };

            HorizontalRuler = new Ruler();
            VerticalRuler   = new Ruler()
            {
                Orientation = Orientation.Vertical,
            };



            Theme            = new LinearTheme();
            Theme.NodeStyles = (Theme as LinearTheme).VariantStyles[1];

            #endregion

            #region Nodes and Connectors Creation

            CustomNode Node1  = CreateNode(550, 100, "A", "SkyBlue", "1", "");
            CustomNode Node2  = CreateNode(450, 200, "B", "Red", "2", "1");
            CustomNode Node3  = CreateNode(550, 200, "C", "Red", "3", "1");
            CustomNode Node4  = CreateNode(650, 200, "D", "Red", "4", "1");
            CustomNode Node5  = CreateNode(400, 300, "E", "Yellow", "5", "2");
            CustomNode Node6  = CreateNode(500, 300, "F", "Yellow", "6", "2");
            CustomNode Node7  = CreateNode(600, 300, "G", "Yellow", "7", "4");
            CustomNode Node8  = CreateNode(700, 300, "H", "Yellow", "8", "4");
            CustomNode Node9  = CreateNode(450, 400, "I", "Violet", "9", "6");
            CustomNode Node10 = CreateNode(550, 400, "J", "Violet", "10", "6");
            CustomNode Node11 = CreateNode(650, 400, "K", "Violet", "11", "8");
            CustomNode Node12 = CreateNode(750, 400, "L", "Violet", "12", "8");
            CustomNode Node13 = CreateNode(400, 500, "M", "Green", "13", "9");
            CustomNode Node14 = CreateNode(500, 500, "N", "Green", "14", "9");
            CustomNode Node15 = CreateNode(600, 500, "O", "Green", "15", "11");
            CustomNode Node16 = CreateNode(700, 500, "P", "Green", "16", "11");
            CustomNode Node17 = CreateNode(450, 600, "Q", "SkyBlue", "17", "14");
            CustomNode Node18 = CreateNode(550, 600, "R", "SkyBlue", "18", "14");
            CustomNode Node19 = CreateNode(650, 600, "S", "SkyBlue", "19", "16");
            CustomNode Node20 = CreateNode(750, 600, "T", "SkyBlue", "20", "16");

            (Nodes as NodeCollection).Add(Node1);
            (Nodes as NodeCollection).Add(Node2);
            (Nodes as NodeCollection).Add(Node3);
            (Nodes as NodeCollection).Add(Node4);
            (Nodes as NodeCollection).Add(Node5);
            (Nodes as NodeCollection).Add(Node6);
            (Nodes as NodeCollection).Add(Node7);
            (Nodes as NodeCollection).Add(Node8);
            (Nodes as NodeCollection).Add(Node9);
            (Nodes as NodeCollection).Add(Node10);
            (Nodes as NodeCollection).Add(Node11);
            (Nodes as NodeCollection).Add(Node12);
            (Nodes as NodeCollection).Add(Node13);
            (Nodes as NodeCollection).Add(Node14);
            (Nodes as NodeCollection).Add(Node15);
            (Nodes as NodeCollection).Add(Node16);
            (Nodes as NodeCollection).Add(Node17);
            (Nodes as NodeCollection).Add(Node18);
            (Nodes as NodeCollection).Add(Node19);
            (Nodes as NodeCollection).Add(Node20);

            CreateConnector(Node1, Node2);
            CreateConnector(Node1, Node3);
            CreateConnector(Node1, Node4);
            CreateConnector(Node2, Node5);
            CreateConnector(Node2, Node6);
            CreateConnector(Node4, Node7);
            CreateConnector(Node4, Node8);
            CreateConnector(Node6, Node9);
            CreateConnector(Node6, Node10);
            CreateConnector(Node8, Node11);
            CreateConnector(Node8, Node12);
            CreateConnector(Node9, Node13);
            CreateConnector(Node9, Node14);
            CreateConnector(Node11, Node15);
            CreateConnector(Node11, Node16);
            CreateConnector(Node14, Node17);
            CreateConnector(Node14, Node18);
            CreateConnector(Node16, Node19);
            CreateConnector(Node16, Node20);

            #endregion

            #region Commands and CommandManager

            // Custom command and Modified Commands

            CustomGroup   = new Command(OnCustomGroupCommand);
            CustomUngroup = new Command(OnCustomUngroupCommand);
            ChildNode     = new Command(OnChildNodeCommand);
            ParentNode    = new Command(OnParentNodeCommand);
            NextChild     = new Command(OnNextChildCommand);
            PreviousChild = new Command(OnPreviousChildCommand);

            ItemAddedCommand = new Command(OnItemAdded);

            CommandManager = new Syncfusion.UI.Xaml.Diagram.CommandManager();

            (CommandManager as Syncfusion.UI.Xaml.Diagram.CommandManager).Commands = new CommandCollection();

            (CommandManager.Commands as CommandCollection).Add
            (
                new GestureCommand()
            {
                Name    = "CustomGroup",
                Command = CustomGroup,
                Gesture = new Gesture
                {
                    KeyModifiers = ModifierKeys.Control,
                    KeyState     = KeyStates.Down,
                    Key          = System.Windows.Input.Key.G,
                },
            }
            );

            (CommandManager.Commands as CommandCollection).Add
            (
                new GestureCommand()
            {
                Name    = "CustomUngroup",
                Command = CustomUngroup,
                Gesture = new Gesture
                {
                    KeyModifiers = ModifierKeys.Control,
                    KeyState     = KeyStates.Down,
                    Key          = System.Windows.Input.Key.U,
                },
            }
            );


            (CommandManager.Commands as CommandCollection).Add
            (
                new GestureCommand()
            {
                Name    = "ChildNode",
                Command = ChildNode,
                Gesture = new Gesture
                {
                    KeyState = KeyStates.Down,
                    Key      = System.Windows.Input.Key.Down,
                },
            }
            );


            (CommandManager.Commands as CommandCollection).Add
            (
                new GestureCommand()
            {
                Name    = "ParentNode",
                Command = ParentNode,
                Gesture = new Gesture
                {
                    KeyState = KeyStates.Down,
                    Key      = System.Windows.Input.Key.Up,
                },
            }
            );

            (CommandManager.Commands as CommandCollection).Add
            (
                new GestureCommand()
            {
                Name    = "NextChild",
                Command = NextChild,
                Gesture = new Gesture
                {
                    KeyState = KeyStates.Down,
                    Key      = System.Windows.Input.Key.Right,
                },
            }
            );

            (CommandManager.Commands as CommandCollection).Add
            (
                new GestureCommand()
            {
                Name    = "PreviousChild",
                Command = PreviousChild,
                Gesture = new Gesture
                {
                    KeyState = KeyStates.Down,
                    Key      = System.Windows.Input.Key.Left,
                },
            }
            );

            #endregion
        }
コード例 #22
0
 public ExtractAllCharactersUntilWhiteSpace()
 {
     Constraints.Add(ActivityConstraints.HasParentType <ExtractAllCharactersUntilWhiteSpace, TextApplicationScope>(string.Format(Resources.ValidationScope_Error, Resources.TextApplicationScope_DisplayName)));
 }
コード例 #23
0
 /// <summary>
 /// Adds a block definition into the Killer
 /// </summary>
 /// <param name="cells">Integer array of cell coordinates in the block: [x1, y1, x2, y2, ...]</param>
 /// <param name="sum">Integer value the block adds up to</param>
 /// <returns>This puzzle so we can use fluent programming</returns>
 public Killer AddBlock(int[] cells, int sum)
 {
     Constraints.Add(new BlockSumNoDuplicatesConstraint(cells, sum));
     return(this);
 }
コード例 #24
0
ファイル: Delete.cs プロジェクト: 4al14me011/SFTP_Uipath
 public Delete()
 {
     Constraints.Add(ActivityConstraints.HasParentType <Delete, SFTPScope>(string.Format(Resources.ValidationScope_Error, Resources.SFTPScope_DisplayName)));
 }
コード例 #25
0
 public void Add(ForeignKeyConstraint fk, Table owner)
 {
     Owners.Add(owner);
     Constraints.Add(fk);
 }
コード例 #26
0
 public Format_Combobox_SFDC_API()
 {
     Constraints.Add(CheckParentConstraint.GetCheckParentConstraint <Format_Combobox_SFDC_API>(typeof(Salesforce_Marketing_Cloud_Scope).Name));
 }
コード例 #27
0
 private void AddConstraint(Constraint constraint)
 {
     Constraints.Add(constraint);
     SetModified(true, true);
 }
コード例 #28
0
        //--------------------------------------------------------------------------------------------------

        public int AddConstraint(SketchConstraint constraint)
        {
            Constraints.Add(constraint);
            return(Constraints.Count - 1);
        }
コード例 #29
0
 public QueryDoc()
 {
     Constraints.Add(ParentConstraint.CheckThatParentsAreOfType <QueryDoc, ParentScope>("Activity is valid only inside Mongo Database Scope"));
 }
コード例 #30
0
 public IMappingExpression <T> ForMember <TMember>(Expression <Func <T, TMember> > memberSelectorExpression, Expression <Func <TMember, T, IValidatorExpression, bool> > memberValidationExpression)
 {
     Constraints.Add(new ClassObjectValidator <T, TMember>(memberSelectorExpression, memberValidationExpression));
     return(this);
 }