Ejemplo n.º 1
0
 private void InitExt()
 {
     s_extension = this;
 }
Ejemplo n.º 2
0
 public CacheExt()
 {
     s_extension = this;
 }
Ejemplo n.º 3
0
        bool IMMLoginObject.Login(bool vbInitialLogin)
        {
            IExtensionManager pExtMgr;
            IExtension        pExt;
            UID          pUID;
            IApplication pApp;
            CacheExt     pCacheExt;

            _initialLogin = vbInitialLogin;


            _defaultLogin.ShowDialog = false;

            //this.ShowDialog(new WindowWrapper(hwnd));
            _propSet = new PropertySetClass();
            //var dic = new Dictionary<string, string>()
            //{
            //    {"SERVER"," "},
            //    {"DATABASE"," "},
            //    {"INSTANCE","SDE:oracle11g:pnm2"},
            //    {"USER","SDE"},
            //    {"PASSWORD","sde"},
            //    {"VERSION","SDE.DEFAULT"}
            //};

            //get the full location of the assembly with DaoTests in it
            string fullPath = System.Reflection.Assembly.GetAssembly(typeof(LoginForm)).Location;

            //get the folder that's in
            string theDirectory = Path.GetDirectoryName(fullPath);
            bool   bCacheEnabled;

            bCacheEnabled = false;
            Debug.WriteLine(theDirectory.ToString());

            string[] lines = System.IO.File.ReadAllLines(theDirectory.ToString() + "\\ARCFMLOGINOBJECT.CFG");
            foreach (string line in lines)
            {
                if (line.Substring(1, 1) != "#")
                {
                    // Use a tab to indent each line of the file.
                    string[] sValues = line.Split(',');
                    switch (sValues[0].ToUpper())
                    {
                    case "SERVER":
                        if (sValues.Length > 1)
                        {
                            _propSet.SetProperty("SERVER", sValues[1]);
                        }
                        else
                        {
                            _propSet.SetProperty("SERVER", "SDE");
                        }
                        break;

                    case "INSTANCE":
                        _propSet.SetProperty("INSTANCE", sValues[1]);
                        break;

                    case "DATABASE":
                        _propSet.SetProperty("DATABASE", sValues[1]);
                        break;

                    case "IS_GEODATABASE":
                        _propSet.SetProperty("IS_GEODATABASE", sValues[1]);
                        break;

                    case "AUTHENTICATION_MODE":
                        _propSet.SetProperty("AUTHENTICATION_MODE", sValues[1]);
                        break;

                    case "USER":
                        _propSet.SetProperty("USER", sValues[1]);
                        break;

                    case "PASSWORD":
                        _propSet.SetProperty("PASSWORD", sValues[1]);
                        break;

                    case "CONNPROP_REV":
                        _propSet.SetProperty("CONNPROP-REV", sValues[1]);
                        break;

                    case "VERSION":
                        _propSet.SetProperty("VERSION", sValues[1]);
                        break;

                    case "CACHE":
                        if (sValues[1].ToUpper() == "TRUE")
                        {
                            bCacheEnabled = true;
                        }
                        break;
                    }
                    Console.WriteLine("\t" + line);
                }
            }

            _defaultLogin.SetConnectionProperties(_propSet);
            _loginChanged = _defaultLogin.Login(_initialLogin);
            var isAlright = _defaultLogin.IsValidLogin;

            myworkspace = _defaultLogin.LoginWorkspace;
            pCacheExt   = CacheExt.GetExtension();
            if (bCacheEnabled == true)
            {
                pCacheExt.OpenClasses(myworkspace);
            }
            //ESRI.ArcGIS.Geodatabase.IEnumDataset pEDS = myworkspace.get_Datasets(esriDatasetType.esriDTAny);
            return(_loginChanged);
        }