protected override void Run ()
		{
			while (true) {
				Console.WriteLine (toPrint);
				Thread.Sleep (1000);
			}
		}
Esempio n. 2
0
        /// <summary>
        /// Indicates the authentication level of the nick
        /// </summary>
        /// <returns>
        /// 3 = logged in
        /// 2 = recognized (ACCESS)
        /// 1 = not logged in
        /// 0 = no such account / error
        /// </returns>
        public int GetUserStatus(string nick)
        {
            if (!m_userstatus_cache.ContainsKey(nick))
            {
                // Send information request
                // See also: Program.cs -> OnUserSay()
                if (Utils.isYes(G.settings["nickserv_acc"]) == 1)
                {
                    E.Say("NickServ", "ACC " + nick);
                }
                else
                {
                    E.Say("NickServ", "STATUS " + nick);
                }
            }

            int status = 0;

            for (int n = 0; n < 15; ++n)
            {
                if (m_userstatus_cache.TryGetValue(nick, out status))
                {
                    break;
                }

                Thread.Sleep(100);
            }
            return(status);
        }
Esempio n. 3
0
        public void WebProjectInstallOnNew(PythonVisualStudioApp app)
        {
            app.OptionsService.DefaultInterpreter.PipUninstall("bottle");

            var t = Task.Run(() => app.CreateProject(
                                 PythonVisualStudioApp.TemplateLanguageName,
                                 PythonVisualStudioApp.BottleWebProjectTemplate,
                                 TestData.GetTempPath(),
                                 "WebProjectInstallOnNew",
                                 suppressUI: false
                                 ));

            using (var dlg = new AutomationDialog(app, AutomationElement.FromHandle(app.WaitForDialog(t)))) {
                // Install to active environment
                dlg.ClickButtonAndClose("CommandLink_1001", nameIsAutomationId: true);
            }

            var project = t.WaitAndUnwrapExceptions();

            Assert.AreSame(app.OptionsService.DefaultInterpreter, project.GetPythonProject().ActiveInterpreter);

            for (int retries = 60; retries > 0; --retries)
            {
                if (project.GetPythonProject().ActiveInterpreter.FindModules("bottle").Any())
                {
                    break;
                }
                Thread.Sleep(1000);
            }
            AssertUtil.ContainsExactly(project.GetPythonProject().ActiveInterpreter.FindModules("bottle"), "bottle");

            app.OptionsService.DefaultInterpreter.PipUninstall("bottle");
        }
Esempio n. 4
0
        private static async Task MainAsync()
        {
            var container = Container.CreateContainer();
            var client    = container.GetService <DiscordSocketClient>();

            var commandHandler = container.GetService <IBotCommandHandler>();

            client.MessageReceived += commandHandler.OnMessage;
            client.UserJoined      += async(s, e) => {
                // TODO
            }
            client.MessageReceived += ClientOnMessageReceived;
            client.Connected       += ClientOnConnected;

            await client.LoginAsync(TokenType.Bot, container.GetService <IConfiguration>()["DiscordApiKey"]);

            await client.StartAsync();

            var fourchanWatcher = container.GetService <IFourchanWatcher>();

            new Thread(() =>
            {
                for (;;)
                {
                    fourchanWatcher.UpdateFourchan();
                    Thread.Sleep(TimeSpan.FromMinutes(5));
                }
            }).Start();

            // Prevent bot from exiting
            await Task.Delay(-1);
        }
Esempio n. 5
0
        public static Boolean BuildSolution(this Solution solution)
        {
            var dte = DteExtensions.DTE;
            SolutionConfiguration previousSolutionConfiguration = solution.SolutionBuild.ActiveConfiguration;
            var solutionConfiguration = solution.SolutionBuild.SolutionConfigurations.Cast <SolutionConfiguration>().First(configuration => configuration.Name == "EasyTest") ??
                                        solution.SolutionBuild.SolutionConfigurations.Cast <SolutionConfiguration>().First(configuration => configuration.Name == "Debug");

            solutionConfiguration.Activate();
            try {
                dte.WriteToOutput($@"Build the following configuration: ""{dte.Solution.SolutionBuild.ActiveConfiguration.Name}"".");
                dte.ExecuteCommand("Build.BuildSolution");

                while (dte.Solution.SolutionBuild.BuildState != vsBuildState.vsBuildStateDone)
                {
                    Thread.Sleep(100);
                    Application.DoEvents();
                }
            }
            finally {
                if (previousSolutionConfiguration != null)
                {
                    dte.WriteToOutput($@"Restore the previous active configuration: ""{previousSolutionConfiguration.Name}"".");

                    previousSolutionConfiguration.Activate();
                }
            }
            dte.WriteToOutput("Get build result.");
            Boolean isBuildSuccess = dte.Solution.SolutionBuild.LastBuildInfo == 0;

            dte.WriteToOutput(!isBuildSuccess ? "Solution build failed." : "BuildSuccess.");
            return(isBuildSuccess);
        }
Esempio n. 6
0
 public static Project ReloadProject(this DTE dte, Project project)
 {
     var projectUniqueName = project.UniqueName;
     var projectName = project.Name;
     SelectProject(dte, project);
     try
     {
         dte.ExecuteCommand("Project.UnloadProject");
         Thread.Sleep(200);
         dte.ExecuteCommand("Project.ReloadProject");
         Thread.Sleep(200);
         return GetProjectByName(dte, projectName);
     }
     catch
     {
         try
         {
             SleepAndCycleMessagePump(dte);
             dte.ExecuteCommand("Project.UnloadProject");
             SleepAndCycleMessagePump(dte);
             dte.ExecuteCommand("Project.ReloadProject");
             SleepAndCycleMessagePump(dte);
             return GetProjectByUniqueName(dte, projectUniqueName)
                    ?? GetProjectByName(dte, projectName);
         }
         catch
         {
             return ReloadSolutionAndReturnProject(dte, project);
         }
     }
 }
Esempio n. 7
0
        public static void EnsureOpened(string filePath, TimeSpan delay = default)
        {
            if (Environment.OSVersion.Platform != PlatformID.Win32NT)
            {
                return;
            }

            if (delay != default)
            {
                Thread.Sleep(delay);
            }

            try
            {
                var dte = GetDTE();
                if (dte == null)
                {
                    return;
                }

                if (!string.IsNullOrEmpty(filePath))
                {
                    dte.ExecuteCommand("File.OpenFile", filePath);
                }
            }
            catch (Exception e)
            {
                Debug.Fail($"Failed to open {filePath}: " + e);
            }
        }
Esempio n. 8
0
        /// <inheritdoc />
        public IVisualStudio LaunchVisualStudio(VisualStudioVersion version, ILogger logger)
        {
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            Pair <string, VisualStudioVersion>?installDirAndVersion = GetVisualStudioInstallDirAndVersion(version);

            if (!installDirAndVersion.HasValue)
            {
                logger.Log(LogSeverity.Debug, string.Format("Could not find Visual Studio version '{0}'.", version));
                return(null);
            }

            string      devenvPath        = Path.Combine(installDirAndVersion.Value.First, "devenv.exe");
            ProcessTask devenvProcessTask = new ProcessTask(devenvPath, "", Environment.CurrentDirectory);

            logger.Log(LogSeverity.Debug, string.Format("Launching Visual Studio using path: '{0}'.", devenvProcessTask.ExecutablePath));
            devenvProcessTask.Start();

            System.Diagnostics.Process devenvProcess = devenvProcessTask.Process;
            if (devenvProcess != null)
            {
                int processId = devenvProcess.Id;

                Stopwatch stopwatch = Stopwatch.StartNew();
                for (;;)
                {
                    IVisualStudio visualStudio = GetVisualStudioFromProcess(processId, installDirAndVersion.Value.Second, true, logger);
                    if (visualStudio != null)
                    {
                        return(visualStudio);
                    }

                    if (stopwatch.ElapsedMilliseconds > VisualStudioAttachTimeoutMilliseconds)
                    {
                        logger.Log(LogSeverity.Debug, string.Format("Stopped waiting for Visual Studio to launch after {0} milliseconds.", VisualStudioAttachTimeoutMilliseconds));
                        break;
                    }

                    if (!devenvProcessTask.IsRunning)
                    {
                        break;
                    }

                    Thread.Sleep(500);
                }
            }

            if (devenvProcessTask.IsTerminated && devenvProcessTask.Result != null)
            {
                if (!devenvProcessTask.Result.HasValue)
                {
                    logger.Log(LogSeverity.Debug, "Failed to launch Visual Studio.", devenvProcessTask.Result.Exception);
                }
            }

            return(null);
        }
Esempio n. 9
0
        /// <summary>
        /// Tests the given timer. Must have not been started.
        /// </summary>
        private void TestTimer(Timer timer)
        {
            long elapsed1, elapsed2;

            int halfWait = (int)(timer.Timeout / 2);

            Assert.AreEqual(timer.TotalMilliseconds, 0);
            Assert.IsFalse(timer.IsUp);


            timer.Unpause();

            SystemThread.Sleep(halfWait);
            Assert.IsFalse(timer.IsUp);
            SystemThread.Sleep(halfWait);
            Assert.IsTrue(timer.IsUp);
            Assert.IsTrue(timer.TotalMilliseconds >= timer.Timeout);


            timer.Reset();
            Assert.IsFalse(timer.IsUp);
            SystemThread.Sleep(halfWait);
            Assert.IsFalse(timer.IsUp);
            SystemThread.Sleep(halfWait);
            Assert.IsTrue(timer.IsUp);


            timer.Reset(false);
            Assert.AreEqual(timer.TotalMilliseconds, 0);
        }
Esempio n. 10
0
 public void AddNonExistingPatient(int patientid)
 {
     flag = false;
     Console.WriteLine("------------Searching for the patient  " + patientid + " ------------");
     search.SearchPatient("duplicatepatients.csv", patientid);
     Thread.Sleep(5000);
     if (!search.IsSearchEmpty())
     {
         Console.WriteLine("Patient Found in PSC!!");
         tabs.Dashboard();
         flag = true;
         Console.WriteLine("---------------------------------------------------------------------------\n");
         Assert.Ignore("Result:  Ignoring this patient as this already exist in PSC");
     }
     if (flag == false)
     {
         Console.WriteLine("Patient doesn't exist on PSC, So adding the patient");
         flag = bip.AddPatient(filename, patientid);
         Thread.Sleep(2000);
         if (!standard.Save())
         {
             Console.WriteLine("Result:  Not able to add new patient as patient information is not correct in one or more basic info fields");
             Console.WriteLine(" INFO:  Please check the screenshot for more information");
             bip.GoToDashBoard();
             Console.WriteLine("---------------------------------------------------------------------------\n");
             Assert.Ignore();
         }
         Thread.Sleep(4000);
         flag = bip.VerifyPatientAdded();
         Thread.Sleep(2000);
         bip.GoToDashBoard();
         Assert.Pass();
     }
 }
            protected override void Run()
            {
                while (true)
                {
                    Load();                      // #1
                    Thread.Sleep(1000);

                    boardQueue.Release(capacity);                       // (--> Passenger) to get on the car
                    Thread.Sleep(1000);

                    allAboard.Acquire();                                        // (<-- Passenger) everyone is ready!
                    Thread.Sleep(1000);

                    Depart();                      // #3
                    Thread.Sleep(1000);

                    Unload();                      // #4
                    Thread.Sleep(1000);


                    unboardQueue.Release(5);                                    // (--> Passenger) to get off the car


                    allAshore.Acquire();                                        // (<-- Passenger) everyone is off the car
                    Thread.Sleep(1000);
                }
            }
        /// <summary>
        /// Test one, proves the utility correct by showing that the other thread cannot write to the
        ///     output while while the first thread is executing.
        /// </summary>
        public static void Main()
        {
            new Thread(OtherThread).Start();


            Console.WriteLine("Inside MutexTest");


            writeMtx.Acquire();
            {
                Console.WriteLine("Inside Main");
                Thread.Sleep(1000);

                Console.WriteLine("1 - Main");
                Thread.Sleep(1000);

                Console.WriteLine("2 - Main");
                Thread.Sleep(1000);

                Console.WriteLine("3 - Main");
                Thread.Sleep(1000);
            }
            Console.WriteLine("Attempting to release Main writeMtx");
            writeMtx.Release();


            return;
        }
Esempio n. 13
0
        //Provide Gender Information
        public bool ProvideGender(string filename, int key)
        {
            bool flag = false;

            GetBasicInformation(filename, key);
            try
            {
                Thread.Sleep(2000);
                string gender = basicinfo["Gender"];
                gender = gender.ToUpper();
                if (gender.Equals("M"))
                {
                    Input.ClickOnSpecificItemByName(basicinfowindow, rj.GetElementValue("Male"));
                }
                else if (gender.Equals("F"))
                {
                    Input.ClickOnSpecificItemByName(basicinfowindow, rj.GetElementValue("Female"));
                }
                else
                {
                    Console.WriteLine(">>>>>>>>>>>>>Not able to find the element of Gender");
                    flag = true;
                }
                return(flag);
            }

            catch (Exception)
            {
                Console.WriteLine(">>>>>>>>>>>>>>>>>>>>>>> Not able to provide Gender <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
                return(false);
            }
        }
Esempio n. 14
0
 private static void AddReference(Project Project, int Wait, int TryIndex)
 {
     if (TryIndex > 5)
     {
         try
         {
             AddOfflineReferece(Project);
         }
         catch
         {
             // Sorry, I'm powerless)
         }
     }
     else
     {
         new Thread(() =>
         {
             Thread.Sleep(Wait);
             try
             {
                 AddOnlineReferece(Project);
             }
             catch
             {
                 AddReference(Project, Wait, ++TryIndex);
             }
         }).Start();
     }
 }
        /// <summary>
        /// The display and show icon.
        /// </summary>
        /// <param name="message">
        /// The message.
        /// </param>
        public void DisplayAndShowIcon(string message)
        {
            var b =
                new Bitmap(
                    @"E:\Development\SonarQube\VssonarExtension\VSSonarQubeExtension\VSSonarExtension\PackageImplementation\Resources\sonariconsource.bmp");
            IntPtr hdc = IntPtr.Zero;

            hdc = b.GetHbitmap();

            object hdcObject = hdc;

            vssStatusBar.Bar.Animation(1, ref hdcObject);

            Thread.Sleep(10000);

            vssStatusBar.Bar.Animation(0, ref hdcObject);
            DeleteObject(hdc);

            return;

            object icon = Constants.SBAI_Build;

            vssStatusBar.dte.StatusBar.Animate(true, icon);

            // this.Bar.Animation(1, ref icon);
            vssStatusBar.dte.StatusBar.Text = message;

            // this.Bar.SetText(message);
            vssStatusBar.dte.StatusBar.Animate(false, icon);

            // this.Bar.Animation(0, ref icon);
            vssStatusBar.dte.StatusBar.Text = "Build Succeeded";
        }
Esempio n. 16
0
 private void AtualizaPeso()
 {
     try
     {
         while (true)
         {
             Thread.Sleep(1000);
             RunOnUiThread(() => TxtPeso1.Text = Convert.ToString(Validacoes.Peso1));
             RunOnUiThread(() => TxtPeso2.Text = Convert.ToString(Validacoes.Peso2));
             RunOnUiThread(() => TxtPeso3.Text = Convert.ToString(Validacoes.Peso3));
             RunOnUiThread(() => TxtPeso4.Text = Convert.ToString(Validacoes.Peso4));
             RunOnUiThread(() => TxtPeso5.Text = Convert.ToString(Validacoes.Peso5));
             RunOnUiThread(() => TxtPeso6.Text = Convert.ToString(Validacoes.Peso6));
             Pesototal = Validacoes.Peso1 +
                         Validacoes.Peso2 +
                         Validacoes.Peso3 +
                         Validacoes.Peso4 +
                         Validacoes.Peso5 +
                         Validacoes.Peso6;
             RunOnUiThread(() => TxtPeso7.Text = Convert.ToString(Pesototal));
         }
     }
     catch (System.Exception ex)
     {
     }
 }
        private async Task ExecFetchAsync()
        {
            try
            {
                while (!DisposeGit)
                {
                    DTE dte = await package.GetServiceAsync(typeof(DTE)).ConfigureAwait(false) as DTE;

                    if (dte != null && dte.Solution.IsOpen)
                    {
                        try
                        {
                            dte.ExecuteCommand("Team.Git.Fetch");
                        }
                        catch (Exception)
                        {
                            break;
                        }
                    }
                    Thread.Sleep(TimeSpan.FromMinutes(Config.Instance.TimeValue()));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 18
0
        private void ZerarPlataforma1()
        {
            ZeraBalanca = true;
            Thread.Sleep(1000);
            int Contador = 0;

            // Thread.Sleep(10000);
            Contador = Contador + 1;
            //=================================+
            //  PRIMEIRO 05 CARACTERES FIXO   //
            //================================//
            //           >00A1                //
            //================================//
            byte[] buffer = new byte[7];
            buffer[0] = 0x3E;
            buffer[1] = 0x30;
            buffer[2] = 0x31;
            buffer[3] = 0x31;
            buffer[4] = 0x31;
            buffer[5] = 0x30;
            buffer[6] = 0x30;
            var output  = Validacoes.BSocket[0].OutputStream;
            var readput = Validacoes.BSocket[0].InputStream;

            output.Write(buffer, 0, 7);
            output.Write(buffer, 0, 7);
            Thread.Sleep(1000);
            ZeraBalanca = false;
            Desbloquearbotoes();
        }
        private static void AttachDebuggerRetrying(IVsDebugger4 debugger, VsDebugTargetInfo4 debugTarget)
        {
            bool attachedSuccesfully = false;
            int  tries = 0;

            while (!attachedSuccesfully)
            {
                try
                {
                    debugger.LaunchDebugTargets4(1, new[] { debugTarget }, new VsDebugTargetProcessInfo[1]);
                    attachedSuccesfully = true;
                }
                catch (Exception)
                {
                    // workaround for exceptions: System.Runtime.InteropServices.COMException (0x80010001): Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))
                    tries++;
                    if (tries == MaxAttachTries)
                    {
                        throw;
                    }

                    Thread.Sleep(AttachRetryWaitingTimeInMs);
                }
            }
        }
        // return true if package exists, but retry logic is based on what value is expected so there is enough time for assets file to be updated.
        private static bool PackageExistsInLockFile(string pathToAssetsFile, string packageName, string packageVersion, bool expected)
        {
            var             numAttempts     = 0;
            LockFileLibrary lockFileLibrary = null;

            while (numAttempts++ < 3)
            {
                var version  = NuGetVersion.Parse(packageVersion);
                var lockFile = GetAssetsFileWithRetry(pathToAssetsFile);
                lockFileLibrary = lockFile.Libraries
                                  .SingleOrDefault(p => StringComparer.OrdinalIgnoreCase.Equals(p.Name, packageName) &&
                                                   p.Version.Equals(version));
                if (expected && lockFileLibrary != null)
                {
                    return(true);
                }
                if (!expected && lockFileLibrary == null)
                {
                    return(false);
                }

                Thread.Sleep(2000);
            }

            return(lockFileLibrary != null);
        }
Esempio n. 21
0
        public static IServiceProvider?GetServiceProvider(TimeSpan delay = default)
        {
            if (Environment.OSVersion.Platform != PlatformID.Win32NT)
            {
                return(null);
            }

            if (delay != default)
            {
                Thread.Sleep(delay);
            }

            try
            {
                var dte = GetDTE();
                if (dte == null)
                {
                    return(null);
                }

                return(new OleServiceProvider(dte));
            }
            catch
            {
                //Debug.Fail("Failed to get IDE service provider.");
                return(null);
            }
        }
        private static LockFile GetAssetsFileWithRetry(string path)
        {
            var    timeout = TimeSpan.FromSeconds(20);
            var    timer   = Stopwatch.StartNew();
            string content = null;

            do
            {
                Thread.Sleep(100);
                if (File.Exists(path))
                {
                    try
                    {
                        content = File.ReadAllText(path);
                        var format = new LockFileFormat();
                        return(format.Parse(content, path));
                    }
                    catch
                    {
                        // Ignore errors from conflicting writes.
                    }
                }
            }while (timer.Elapsed < timeout);

            // File cannot be read
            if (File.Exists(path))
            {
                throw new InvalidOperationException("Unable to read: " + path);
            }
            else
            {
                throw new FileNotFoundException("Not found: " + path);
            }
        }
        public void TestConnect()
        {
            var scl = new ServerPlayerListener(new NetworkConnectorServer(15005, 15006), npf);

            // Done setup
            scl.UpdateConnectedPlayers();

            Assert.AreEqual(0, gameState.Players.Count());
            Assert.AreEqual(0, scl.Players.Count());

            var client1 = new NetworkConnectorClient();

            client1.Connect("127.0.0.1", 15005);
            Thread.Sleep(100);

            scl.UpdateConnectedPlayers();

            Assert.AreEqual(1, gameState.Players.Count());
            Assert.AreEqual(1, scl.Players.Count());

            var client2 = new NetworkConnectorClient();

            client2.Connect("127.0.0.1", 15005);
            Thread.Sleep(100);

            scl.UpdateConnectedPlayers();

            Assert.AreEqual(2, gameState.Players.Count());
            Assert.AreEqual(2, scl.Players.Count());
        }
Esempio n. 24
0
        public static void HideSplash()
        {
            if (splashWindow == null)
            {
                return;
            }

            if (BusinessDomain.AppConfiguration == null)
            {
                return;
            }

            if (!BusinessDomain.AppConfiguration.ShowSplashScreen)
            {
                return;
            }

            SetProgressBar(1.0d);
            PresentationDomain.ProcessUIEvents();

            if (PresentationDomain.MainFormCreated)
            {
                Thread.Sleep(2000);
            }
            else
            {
                Thread.Sleep(400);
            }

            splashWindow.Dispose();
            splashWindow            = null;
            AutoStartupNotification = true;
        }
Esempio n. 25
0
            // Tests the funcionality of Poll & Put
            public static void TestOne()
            {
                // Consumers - POLL
                for (int i = 0; i < 2; ++i)
                {
                    int    threadId   = i;
                    string tempString = "";

                    new Thread(() => {
                        while (true)
                        {
                            if (testChannel.Poll(out tempString, 1000))
                            {
                                Console.WriteLine(threadId + ": Got {0} off of the queue", tempString);
                            }
                            else
                            {
                                Console.WriteLine(threadId + ": Gave up waiting on the queue!");
                            }
                        }
                    }).Start();
                }

                // Producer - OFFER
                new Thread(() => {
                    for (int i = 0; i < 1000; ++i)
                    {
                        testChannel.Offer("" + i);
                        Thread.Sleep(3000);
                    }
                }).Start();
            }
        public void KillSession(TimeSpan timeout)
        {
            if (!IsConnected)
            {
                return;
            }
            var connectionString = Curator.getZookeeperClient().getCurrentConnectionString();
            var zooKeeper        = new ZooKeeper(connectionString, 5000, null, SessionId, SessionPassword);

            try
            {
                var watch = Stopwatch.StartNew();
                while (watch.Elapsed < timeout)
                {
                    if (zooKeeper.getState().Equals(ZooKeeper.States.CONNECTED))
                    {
                        return;
                    }
                    Thread.Sleep(100);
                }

                throw new TimeoutException($"Expected to kill session within {timeout}, but failed to do so.");
            }
            finally
            {
                zooKeeper.close();
            }
        }
Esempio n. 27
0
        public void WebProjectEnvironment(PythonVisualStudioApp app)
        {
            var project = app.OpenProject(@"TestData\CheckEnvironment.sln");

            var proj = project.GetCommonProject() as IPythonProject;

            Assert.IsNotNull(proj);

            var outFile = Path.Combine(Path.GetDirectoryName(project.FullName), "output.txt");

            if (File.Exists(outFile))
            {
                File.Delete(outFile);
            }

            app.ServiceProvider.GetUIThread().Invoke(() => {
                proj.SetProperty("CommandLineArguments", '"' + outFile + '"');
                proj.SetProperty("Environment", "FOB=123\nOAR=456\r\nBAZ=789");
            });

            app.ExecuteCommand("Debug.StartWithoutDebugging");

            for (int retries = 10; retries > 0 && !File.Exists(outFile); --retries)
            {
                Thread.Sleep(300);
            }

            Assert.AreEqual("FOB=123\r\nOAR=456\r\nBAZ=789", File.ReadAllText(outFile).Trim());
        }
Esempio n. 28
0
 //Provide information of Insurance
 public bool AddInsurance(int key)
 {
     try
     {
         SelectInsurance();
         GetInsuranceInformation(key);
         Thread.Sleep(1000);
         Input.ClickOnSpecificItemByName(additionalinfowindow, rj.GetElementValue("ScanInsuranceBack"));
         Thread.Sleep(1000);
         for (int i = 0; i < 3; i++)
         {
             Input.SwitchTextBox();
         }
         Input.ClearAll();
         Input.TypeKeyword(additionalinfo["FirstName"]);
         Input.TabAndInputText(additionalinfo["LastName"]);
         GetPlanType();
         Input.ReverseTabAndInputText(additionalinfo["GroupNumber"]);
         Thread.Sleep(1000);
         Input.ReverseTabAndInputText(additionalinfo["PolicyNumber"]);
         Thread.Sleep(1000);
         Input.ReverseTabAndInputText(additionalinfo["InsuranceProvider"]);
         Thread.Sleep(2000);
         standard.Save();
         Thread.Sleep(2000);
         return(true);
     }
     catch (Exception)
     {
         Console.WriteLine("Not able to add the guardian");
         return(false);
     }
 }
Esempio n. 29
0
        private static void CheckCommandLineArgs(PythonVisualStudioApp app, string setValue, string expectedValue = null)
        {
            var project = app.OpenProject(@"TestData\CheckCommandLineArgs.sln");

            var proj = project.GetCommonProject() as IPythonProject;

            Assert.IsNotNull(proj);

            var outFile = Path.Combine(Path.GetDirectoryName(project.FullName), "output.txt");

            foreach (var cmdName in new[] { "PythonRunWebServerCommand", "PythonDebugWebServerCommand" })
            {
                Console.WriteLine("Testing {0}, writing to {1}", cmdName, outFile);

                if (File.Exists(outFile))
                {
                    File.Delete(outFile);
                }

                app.ServiceProvider.GetUIThread().Invoke(() => {
                    proj.SetProperty("CommandLineArguments", string.Format("\"{0}\" \"{1}\"", setValue, outFile));
                    proj.FindCommand(cmdName).Execute(proj);
                });

                for (int retries = 10; retries > 0 && !File.Exists(outFile); --retries)
                {
                    Thread.Sleep(100);
                }

                Assert.AreEqual(expectedValue ?? setValue, File.ReadAllText(outFile).Trim());
            }
        }
Esempio n. 30
0
        static MalockMessage()
        {
            timeoutmaintaining = EventWaitHandle.Run(() =>
            {
                while (true)
                {
                    foreach (KeyValuePair <int, Mappable> kv in msgmap)
                    {
                        Mappable map = kv.Value;
                        if (map == null || map.Timeout == -1)
                        {
                            continue;
                        }
                        Stopwatch sw = map.Stopwatch;
                        if (sw.ElapsedMilliseconds > map.Timeout)
                        {
                            sw.Stop();

                            Mappable value;
                            msgmap.TryRemove(kv.Key, out value);

                            var state = map.State;
                            if (state != null)
                            {
                                state(Mappable.ERROR_TIMEOUT, null, null);
                            }
                        }
                    }
                    Thread.Sleep(100);
                }
            });
        }