Пример #1
0
        public void WPFLoginLoadSavedInfo(bindingsFile bindingFile)
        {
            projInfoFile = bindingFile;

            if (projInfoFile.Exists())
            {
                projInfoFile.readInfofile();

                var dict = (Dictionary <string, object>)projInfoFile.getInfo("Cred");

                url                   = (string)dict["URL"];
                username              = (string)dict["User"];
                password              = (string)dict["Password"];
                url_textbox.Text      = url;
                username_textbox.Text = username;
                try
                {
                    passwordBox.Password = Unprotect(password);
                }
                catch { }
                //Unprotect(password);
            }
            //}
            else
            {
                projInfoFile.Create();
            }
        }
Пример #2
0
        public void InitProjnFile(IAgUiPluginEmbeddedControlSite Site)
        {
            SetSite(Site);
            try
            {
                IAgStkObject     Scenario       = m_root.CurrentScenario;
                IAgExecCmdResult result         = m_root.ExecuteCommand("GetDirectory / Scenario");
                string           m_scenarioPath = string.Empty;
                if (result.IsSucceeded)
                {
                    m_scenarioPath = result[0];
                }
                // ADD SCENARIO PATH TO BINDING FILE CLASS
                projInfoFile = new bindingsFile(m_scenarioPath);
            }
            catch
            {
                MessageBox.Show("STK Instance does not exist or is lost! \n Make sure STK is open and the scenario is loaded ");
                //Environment.Exit(0);
            }

            try
            {
                projInfoFile.readInfofile();
                m_root.UnitPreferences.ResetUnits();
                WPFLoginLoadSavedInfo(projInfoFile);
            }

            catch
            { }
        }
Пример #3
0
        public Login(bindingsFile bindingFile)
        {
            InitializeComponent();
            projInfoFile = bindingFile;

            if (projInfoFile.Exists())
            {
                projInfoFile.readInfofile();

                var dict = (Dictionary <string, object>)projInfoFile.getInfo("Cred");

                url      = (string)dict["URL"];
                username = (string)dict["User"];
                password = (string)dict["Password"];
                //string fileName = @"C:\Temp\temp_valicred.txt";
                //if (File.Exists(fileName))
                //{
                //    // Open the stream and read it back.
                //    using (StreamReader sr = File.OpenText(fileName))
                //    {
                //        string s = "";
                //        while ((s = sr.ReadLine()) != null)
                //        {
                //            string[] lines = s.Split(':');
                //            url = lines[0];
                //            username = lines[1];
                //            password = lines[2];
                //        }
                //    }
                url_textbox.Text      = url;
                username_textbox.Text = username;
                try
                {
                    passwordBox.Password = Unprotect(password);
                }
                catch { }
                //Unprotect(password);
            }
            //}
            else
            {
                projInfoFile.Create();
            }
            this.Show();
        }