예제 #1
0
        //To set the dictionary for the datagrid.
        public static void SetKey(int index, SF_GridStatus status, string path = "")
        {
            //Checking if key has already been set.
            if (gridDict.ContainsKey(index))
            {
                //Removing key.
                gridDict.Remove(index);
            }

            //Adding new key.
            gridDict.Add(index, new SF_GridItem(status, path));
        }
예제 #2
0
        //Instance-based public method to switch all of one type in a grid to another type.
        public void SwitchAll(SF_GridStatus initialStatus, SF_GridStatus newStatus)
        {
            //Finding in dictionary the integer corresponding to GridStatuses.
            int initStatusID = gridDict.First(x => x.Value.status == initialStatus).Key;
            int newStatusID  = gridDict.First(x => x.Value.status == newStatus).Key;

            //Replacing all IDs in grid.
            foreach (var k in gridIndex)
            {
                for (int l = 0; l < k.Count; l++)
                {
                    if (k[l] == initStatusID)
                    {
                        k[l] = newStatusID;
                    }
                }
            }
        }
예제 #3
0
 //Constructor setting public properties.
 public SF_GridItem(SF_GridStatus status_, string contents_ = "")
 {
     status   = status_;
     contents = contents_;
 }