logo
Tags down

shadow

How to make the console wait but then continue without pressing a Key?


By : Syl-00101001
Date : September 29 2020, 10:00 AM
I wish this help you you can use a Simple if statement and and while bucle to execute the same all time.
code :
while(true) {
    System.Threading.Thread.Sleep(3000); // to waiting 3 seconds
    Console.WriteLine("Would you like to proceed ? (Y/N)");
    var option = Console.ReadKey();

    if (option.ToString().ToUpper() == "N"){
           Environment.Exit(0);
    }
}


Share : facebook icon twitter icon

how to make delphi wait 30sec then continue


By : JAY D.
Date : March 29 2020, 07:55 AM
wish of those help If you have code that blocks the GUI, you can use a background thread and an event to provide a non blocking timer.
Create a new Forms application and put a TMemo component on your form. This example will add a new line with the current time to your TMemo.
code :
unit u_frm_main;

interface

uses
  u_workthread,
  SysUtils,
  Windows,
  Forms,
  SyncObjs, Classes, Controls, StdCtrls;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
    Worker : TWorkThread;
    procedure ShowData;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.ShowData;
begin
 // do whatever you need to do here... 
 // show current time in memo
 Memo1.Lines.Add(FormatDateTime('HH:NN:SS', Now));
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
 // create our worker thread and start it
 Worker := TWorkThread.Create(3, ShowData);
 Worker.Start;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
 // signal our worker thread that we are done here
 Worker.ThreadEvent.SetEvent;
 // terminate and wait
 Worker.Terminate;
 Worker.WaitFor;
end;

end.
unit u_workthread;

interface

uses
  SysUtils,
  SyncObjs,
  Classes;

type
  TWorkProc = procedure of object;

  TWorkThread = class(TThread)
  private
    { Private declarations }
    Counter   : Integer;
    FTimeout  : Integer;
    FEventProc: TWorkProc;
    procedure DoWork;
  protected
    procedure Execute; override;
  public
    ThreadEvent : TEvent;
    constructor Create(TimeoutSeconds : Integer; EventProc: TWorkProc ); // timeout in seconds
    destructor Destroy; override;
  end;

implementation

procedure TWorkThread.DoWork;
begin
 // put your GUI blocking code in here. Make sure you never call GUI elements from this procedure
 //DoSomeLongCalculation();
end;

procedure TWorkThread.Execute;
begin
 Counter := 0;
 while not Terminated do
  begin
   if ThreadEvent.WaitFor(FTimeout) = wrTimeout then
    begin 
     DoWork;
     // now inform our main Thread that we have data
     Synchronize(FEventProc);
    end;
   else
    // ThreadEvent has been signaled, exit our loop
    Break;
  end;
end;

constructor TWorkThread.Create(TimeoutSeconds : Integer; EventProc: TWorkProc);
begin
 ThreadEvent := TEvent.Create(nil, True, False, '');
 // Convert to milliseconds
 FTimeout := TimeoutSeconds * 1000;
 FEventProc:= EventProc;
 // call inherited constructor with CreateSuspended as True
 inherited Create(True);
end;

destructor TWorkThread.Destroy;
begin
 ThreadEvent.Free;
 inherited;
end;


end.

Java, how to make program wait for video to end and then continue and wait() makes program stop


By : Keith Joshua Madelo
Date : March 29 2020, 07:55 AM
This might help you Can you get the videos length? Because Java is able to read the meta data of some files... You can try to use a timer instead to wait for the video to finish. Maybe you can get the length of the video and set a timer to call the same function (recursion) with a different parameter and play the other video. So basically make the function take the path as parameter, and play the video of that parameter. If you don't know already, Java has a Timer class where a timer instance takes an amount of seconds and a function to call in its constructor, and it has a .play() method.

How to make navigation bar search box wait until pressing enter in MS Access?


By : Marisa Davis
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further If you are using the inbuilt search facility located down by the record selectors, you are out of luck. Its behavior is hard coded into the Access exe program.
If you build your own search function then you can control exactly how it behaves. A great example is available here; http://allenbrowne.com/ser-62.html

How to make a console application wait for the "Enter" key, but automatically continue after time?


By : Ahmed Rakib Imran
Date : March 29 2020, 07:55 AM
I wish this helpful for you You may try this code (adapted from our SynCommons.pas unit, within our mORMot framework):

In Mainframe COBOL, How Can I Send a Message to the Console Operator, Wait for a Response, Then Continue?


By : user5625057
Date : March 29 2020, 07:55 AM
around this issue I have a very long running COBOL program that runs randomly at various times during the day. The Console operator wants to be notified when it starts up and have the program wait so they can go get coffee before letting the job go ahead. How can I do this with COBOL? , Use the COBOL 'STOP' statement, like this:
Related Posts Related Posts :
  • NullReferenceException with Ckeditor 5 and ASP.NET MVC bundle error?
  • How to refresh unc path cache?
  • dllexport Struct pointers and returning uint8_t
  • Is it a good practice to have setter in the get instance property of a singleton class
  • How to sort the coordinates of a hash set in C#
  • Multiply 64-bit integers using .NET Core's hardware intrinsics
  • How to parse string data to string and long?
  • Submit Button is not working In Razor asp.net mvc
  • While loop multiple condition check with single variable
  • Inside a catch clause, how can I see an exception without a name
  • How I can use Certificate.pfx for windows exe build
  • I'm trying to detect that SQL Server Compact Edition is installed in a system or not
  • UWP Replace MainView with FullScreen Frame
  • How do I display the data of the "current user"?
  • AVX2 SIMD XOR not yielding performance improvements in .NET
  • Algorithm to find the closest time
  • Xamarin Form - How To store an image in PDF or JPEG Format in UWP
  • ModelState error: The value 'null' is not valid for nullable field
  • Pre Increment of an operator
  • MSTest Asserts fail with null reference
  • Getting random numbers after a simple math problem. Might be a local variable thing
  • Convert HTML to PDF using HTML Renderer using C# and XML to Pdf
  • Conversion failed when converting varchar value to datatype bit
  • How to edit an XML file in Streamingassets from my hololens
  • Naming a DispatcherTimer based on a string from another method?
  • How to call the default browser in the Hololens app
  • How do I close an IF statement if there is no more code to be executed with 'else'?
  • Unity3D: Is there a easy way to give a min/max to a value in the inspector?
  • The type or namespace name 'ICloudRecoEventHandler' could not be found
  • When compiling C# expression trees into methods, is it possible to access "this"?
  • Sort an array of strings in ascending order in C#
  • How detect is a method in a C# class is implementing a method from an interface?
  • How to parse a timespan in order to add it to a datetime?
  • Changing code from if-statement to switch-statement in C#
  • Linq GroupBy Clause not including items with zero count
  • How to determine the highest value in a list of properties
  • C# Custom Json.NET List serialization
  • Session Variable is null after using RedirectToAction
  • How to manipulate c# code programatically In .Net Core?
  • Modifying Windows System sounds
  • Is there a way to convert this powershell script to C#
  • Lists will show null even though assigned in constructor
  • Any way to have a `using` block that doesn't define a scope block?
  • How do I get a result from this mocked service?
  • async await losing response in c#
  • How can I pause an execution without using Thread.Sleep()
  • How to Stop In Azure Ad Authentication Sign Out ask for Which account do you want to sign out of?
  • Use operators with and without space in c#
  • Remove duplicates from comma separated list
  • Use a String variable as argument from if sentence
  • unity how to avoid scaling heritage when parenting?
  • Is there a way to do nested model binding with the [FromBody] attribute?
  • How to insert dynamic query into table using c#
  • Why Unit Testing Assert.AreEqual() method does NOT pick up my own Equals() method in the customized class
  • Unity Error: Feature 'out variable declaration'
  • What happens if my C# switch expression is non-exhaustive?
  • How Can I Select an ItemTemplate Based on a Value?
  • EF Class table name and column have same name
  • Substring issues - input string was not in a correct format
  • C# Asynchronously read data from a redirected StandardOutput
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk