Example #1
0
        public void CheckDict()
        {
            if (AppSingleton.Instance().AllLayersDict == null)
            {
                AppSingleton.Instance().AllLayersDict = new Dictionary <string, LayerType>();
            }

            for (int i = AppSingleton.Instance().AllLayersDict.Count - 1; i >= 0; i--)
            {
                bool kontrol = false;
                KeyValuePair <string, LayerType> peer = AppSingleton.Instance().AllLayersDict.ElementAt(i);

                for (int j = dataGridView1.Rows.Count - 1; j >= 0; j--)
                {
                    if (dataGridView1.Rows[j].Cells[0].Value != null)
                    {
                        string layerName = dataGridView1.Rows[j].Cells[0].Value.ToString();
                        if (peer.Key == layerName)
                        {
                            kontrol = true;
                            LayerType fieldGrid = peer.Value;
                            string    agirlik   = "";
                            string    metod     = "";
                            foreach (LayerType layerType in AppSingleton.Instance().TumKatmanlarListesi)
                            {
                                if (layerType.LayerObject.layer.Name == layerName)
                                {
                                    metod = layerType.Metod;
                                }
                            }
                            if (fieldGrid.Metod != metod)
                            {
                                AppSingleton.Instance().AllLayersDict[layerName].Metod = metod;
                            }
                            break;
                        }
                    }
                }
                if (kontrol == false)
                {
                    AppSingleton.Instance().AllLayersDict.Remove(peer.Key);
                }
            }

            for (int j = dataGridView1.Rows.Count - 1; j >= 0; j--)
            {
                string layerName = "";
                if (dataGridView1.Rows.Count > 0)
                {
                    bool kontrol = false;
                    if (dataGridView1.Rows[j].Cells[0].Value != null)
                    {
                        for (int i = AppSingleton.Instance().AllLayersDict.Count - 1; i >= 0; i--)
                        {
                            KeyValuePair <string, LayerType> peer = AppSingleton.Instance().AllLayersDict.ElementAt(i);

                            layerName = dataGridView1.Rows[j].Cells[0].Value.ToString();

                            if (peer.Key == layerName)
                            {
                                kontrol = true;
                                break;
                            }
                        }

                        if (kontrol == false)
                        {
                            AddToDictionary(dataGridView1.Rows[j]);
                        }
                    }
                }
            }
        }