Пример #1
0
        /// <summary>
        /// プラグインの種類の変更/設定
        /// </summary>
        /// <param name="strFileName"></param>
        public void setPluging(String strFileName)
        {
            #region Comment
            Debug.WriteLine(
                string.Concat(
                    "DllMapProvider - setPluging : [",
                    strFileName,
                    "]"
                    )
                );
            #endregion

            _strDllFileName = strFileName;

            #region Comment
            foreach (Guid key in GMapProviders.Hash.Keys)
            {
                Debug.WriteLine(
                    string.Concat(
                        "DllMapProvider - setPluging - Hash : ",
                        Convert.ToString(key),
                        "/",
                        Convert.ToString(GMapProviders.Hash[key])
                        )
                    );
            }
            foreach (int key in GMapProviders.DbHash.Keys)
            {
                Debug.WriteLine(
                    string.Concat(
                        "DllMapProvider - setPluging - DbHash : ",
                        Convert.ToString(key),
                        "/",
                        Convert.ToString(GMapProviders.DbHash[key])
                        )
                    );
            }
            #endregion

            GMapProviders.Hash.Remove(this.Id);
            GMapProviders.DbHash.Remove(this.DbId);

            #region Comment
            Debug.WriteLine(
                string.Concat(
                    "DllMapProvider - setPluging - Hash/DbHash Removed : "
                    )
                );
            foreach (Guid key in GMapProviders.Hash.Keys)
            {
                Debug.WriteLine(
                    string.Concat(
                        "DllMapProvider - setPluging - Hash : ",
                        Convert.ToString(key),
                        "/",
                        Convert.ToString(GMapProviders.Hash[key])
                        )
                    );
            }
            foreach (int key in GMapProviders.DbHash.Keys)
            {
                Debug.WriteLine(
                    string.Concat(
                        "DllMapProvider - setPluging - DbHash : ",
                        Convert.ToString(key),
                        "/",
                        Convert.ToString(GMapProviders.DbHash[key])
                        )
                    );
            }
            #endregion

            //            GMapProvPluginInfo pluginInfo = new GMapProvPluginInfo();
            // ここでCreateInstance
            // 使用するプラグインファイル名からPluginInfoを設定
            pluginInfo = new GMapProvPluginInfo(_strDllFileName);
            // DLLのインスタンス化
            ifPlugin = pluginInfo.getDllInstance();

            // DLL MapProviderのGUIDの設定
            id = pluginInfo.guidDll;
            // DLL MapProviderのNAMEの設定
            name = ifPlugin.strMapName;
            //            id = pluginInfo.getGUIDfromFile(strFileName);

            using (var HashProvider = new SHA1CryptoServiceProvider())
            {
                DbId = Math.Abs(BitConverter.ToInt32(HashProvider.ComputeHash(Id.ToByteArray()), 0));

                #region Comment
                Debug.WriteLine(
                    string.Concat(
                        "Name : [",
                        Name,
                        "] DbId : [",
                        Convert.ToString(DbId),
                        "]"
                        )
                    );
                #endregion
            }

            GMapProviders.Hash.Add(this.Id, this);
            GMapProviders.DbHash.Add(this.DbId, this);

            #region Comment
            Debug.WriteLine(
                string.Concat(
                    "DllMapProvider - setPluging - Hash Added : "
                    )
                );
            foreach (Guid key in GMapProviders.Hash.Keys)
            {
                Debug.WriteLine(
                    string.Concat(
                        "DllMapProvider - setPluging - Hash : ",
                        Convert.ToString(key),
                        "/",
                        Convert.ToString(GMapProviders.Hash[key])
                        )
                    );
            }
            foreach (int key in GMapProviders.DbHash.Keys)
            {
                Debug.WriteLine(
                    string.Concat(
                        "DllMapProvider - setPluging - DbHash : ",
                        Convert.ToString(key),
                        "/",
                        Convert.ToString(GMapProviders.DbHash[key])
                        )
                    );
            }
            #endregion

            //MemoryCache MC = new MemoryCache();
            //MC.Clear();

            //GMap.NET.Internals.Core.instances;
            //GMaps.Instance.OnTileCacheProgress;
        }
Пример #2
0
        /*
         * private void ModeComboBox_DropDownClosed(object sender, EventArgs e)
         * {
         *  //TODO: TBOモード選択
         *  SettingData.ModeSetting = ModeComboBox.Text;
         *  ModeLabel.Content = SettingData.ModeSetting;
         * }
         */
        #endregion
        #endregion

        #region 地図設定タブ
        // MapProvider指定
        private void SelectMapProviders()
        {
            // get map types
            var dicMapNameLicence = new Dictionary <String, String>();

            // GMapProversからの候補追加
            foreach (var item in GMapProviders.List)
            {
                #region Comment
                Debug.WriteLine(
                    string.Concat(
                        "MainWindow - Map Type : [",
                        item.Name,
                        "]"
                        )
                    );
                #endregion

                if (item.GetType().FullName.ToString().CompareTo("GMap.NET.MapProviders.DllMapProvider") != 0)
                {
#if DEBUG
                    dicMapNameLicence[item.Name] = item.Copyright;
#else
                    if ((GMapProviders.OpenStreetMap.ToString() == item.ToString()))
                    {
                        dicMapNameLicence[item.Name] = item.Copyright;
                    }
                    if (Properties.Settings.Default.Function2 == "MapProvider")
                    {
                        if ((GMapProviders.GoogleHybridMap.ToString() == item.ToString()))
                        {
                            dicMapNameLicence[item.Name] = item.Copyright;
                        }
                    }
#endif
                }
            }
            // GMapPluginからの候補追加
            // DLLを読み込む
            GMapProvPluginInfo pInfo    = new GMapProvPluginInfo();
            String[]           strArray = pInfo.FindPluginFileNames();
            foreach (var item in strArray)
            {
                GMapProvPluginInfo pluginInfo = new GMapProvPluginInfo(item);
                // DLLのインスタンス化
                GMapNetInterFace.IF_Plugin ifPlugin = pluginInfo.getDllInstance();

                Debug.WriteLine(
                    string.Concat(
                        "MainWindow - Map Type 2: [",
                        ifPlugin.strMapName,
                        "]"
                        )
                    );
                dicMapNameLicence[ifPlugin.strMapName] = ifPlugin.strLicence;

                dictGmapPlugin.Add(ifPlugin.strMapName, item);
            }


            ObservableCollection <MapProviderList> list = new ObservableCollection <MapProviderList>();
            foreach (var MapNameLicence in dicMapNameLicence)
            {
                list.Add(new MapProviderList {
                    ProviderName = MapNameLicence.Key, License = MapNameLicence.Value
                });
                System.Diagnostics.Debug.WriteLine("GMapProviders: " + MapNameLicence.Key + " >>> " + MapNameLicence.Value);
            }

            //MapProviders.ItemsSource = list;
        }