示例#1
0
        private async void InitializeSDK()
        {
            if (String.IsNullOrEmpty(SecretKey))
            {
                Messages.ShowMessage(Messages.SecretKeyRquired);
                return;
            }

            IsSDKInitializing = true;

            var countries = new List <Country>();
            var protocols = new List <Protocol>();

            await Task.Factory.StartNew(() =>
            {
                //Can be initialized using this
                atomManagerInstance = AtomManager.Initialize(SecretKey);
                //Or this
                //var atomConfig = new AtomConfiguration(SecretKey);
                //atomManagerInstance = AtomManager.Initialize(atomConfig);

                atomManagerInstance.Connected                += AtomManagerInstance_Connected;
                atomManagerInstance.DialError                += AtomManagerInstance_DialError;
                atomManagerInstance.Disconnected             += AtomManagerInstance_Disconnected;
                atomManagerInstance.StateChanged             += AtomManagerInstance_StateChanged;
                atomManagerInstance.Redialing                += AtomManagerInstance_Redialing;
                atomManagerInstance.OnUnableToAccessInternet += AtomManagerInstance_OnUnableToAccessInternet;
                atomManagerInstance.SDKAlreadyInitialized    += AtomManagerInstance_SDKAlreadyInitialized;

                atomManagerInstance.AutoRedialOnConnectionDrop = true;

                //To get countries
                try
                {
                    countries = atomManagerInstance.GetCountries();
                }
                catch { }

                //To get protocols
                try
                {
                    protocols = atomManagerInstance.GetProtocols();
                }
                catch { }

                //AtomHelper lets you use the functionality of above created instance in all usercontrols and pages
                AtomHelper.SetAtomManagerInstance(atomManagerInstance);
            });

            ConnectionWithDedicatedIP.Initialize(protocols, countries);
            ConnectionWithParams.Initialize(protocols, countries);
            IsSDKInitializing    = false;
            ISSDKInitialized     = true;
            IsConnDisconnAllowed = true;
        }
示例#2
0
        private async void InitializeSDK()
        {
            if (String.IsNullOrEmpty(SecretKey))
            {
                Messages.ShowMessage(Messages.SecretKeyRquired);
                return;
            }

            IsSDKInitializing = true;

            var countries = new List <Country>();
            var protocols = new List <Protocol>();

            await Task.Factory.StartNew(() =>
            {
                //Can be initialized using this
                atomManagerInstance = AtomManager.Initialize(SecretKey);
                //Or this
                //var atomConfig = new AtomConfiguration(SecretKey);
                //atomManagerInstance = AtomManager.Initialize(atomConfig);

                atomManagerInstance.Connected                += AtomManagerInstance_Connected;
                atomManagerInstance.DialError                += AtomManagerInstance_DialError;
                atomManagerInstance.Disconnected             += AtomManagerInstance_Disconnected;
                atomManagerInstance.StateChanged             += AtomManagerInstance_StateChanged;
                atomManagerInstance.Redialing                += AtomManagerInstance_Redialing;
                atomManagerInstance.OnUnableToAccessInternet += AtomManagerInstance_OnUnableToAccessInternet;
                atomManagerInstance.SDKAlreadyInitialized    += AtomManagerInstance_SDKAlreadyInitialized;
                atomManagerInstance.ConnectedLocation        += AtomManagerInstance_ConnectedLocation;
                atomManagerInstance.AtomInitialized          += AtomManagerInstance_AtomInitialized;
                atomManagerInstance.AtomDependenciesMissing  += AtomManagerInstance_AtomDependenciesMissing;

                // Add sensitive application that needs to be close if network connections drops automatically.
                atomManagerInstance.SensitiveApplications = new List <SensitiveApplication>()
                {
                    new SensitiveApplication()
                    {
                        CompleteExePath = @"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
                    }
                };

                atomManagerInstance.AutoRedialOnConnectionDrop = true;

                //To get countries
                try
                {
                    countries = atomManagerInstance.GetCountries();
                }
                catch { }

                //To get protocols
                try
                {
                    protocols = atomManagerInstance.GetProtocols();
                }
                catch { }

                //AtomHelper lets you use the functionality of above created instance in all usercontrols and pages
                AtomHelper.SetAtomManagerInstance(atomManagerInstance);
            });

            ConnectionWithDedicatedIP.Initialize(protocols, countries);
            ConnectionWithParams.Initialize(protocols, countries);
            IsSDKInitializing    = false;
            ISSDKInitialized     = true;
            IsConnDisconnAllowed = true;
        }
示例#3
0
        public static void ConfitureSystem(string userName, string password)
        {
            AtomManagerInstance = AtomManager.Initialize("b12e0405d803ba771c46bb94be29a0a59f976b06");

            AtomManagerInstance.Connected    += AtomManagerInstance_Connected;
            AtomManagerInstance.DialError    += AtomManagerInstance_DialError;
            AtomManagerInstance.Disconnected += AtomManagerInstance_Disconnected;
            AtomManagerInstance.StateChanged += AtomManagerInstance_StateChanged;
            AtomManagerInstance.Redialing    += AtomManagerInstance_Redialing;

            VPNProperties vpnProperties = new VPNProperties(AtomManagerInstance.GetCountries()[0], AtomManagerInstance.GetProtocols()[0]);

            MainSettings.AtomManagerInstance.Credentials = new Credentials(userName, password);
            MainSettings.AtomManagerInstance.Connect(vpnProperties);
        }