Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
More VFP nostalgia : wait nowait
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 8.0
OS:
Vista
Network:
Windows XP
Database:
Jet/Access Engine
Application:
Desktop
Divers
Thread ID:
01525944
Message ID:
01525957
Vues:
63
Thanks. I'll try to figure it out :)


>FWIW your simplest approach to multi-threading would be to use the BackgroundWorker class. Simple example (assuming the form has a button1 button and a progressBar1 ProgressBar:
    public partial class Form1 : Form
>    {
>        public Form1()
>        {
>            InitializeComponent();
>         }
>
>        private void button1_Click(object sender, EventArgs e)
>        {
>            BackgroundWorker bgw = new BackgroundWorker();
>            bgw.DoWork += new DoWorkEventHandler(bgw_DoWork);
>            bgw.ProgressChanged += new ProgressChangedEventHandler(bgw_ProgressChanged);
>            bgw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgw_RunWorkerCompleted);
>            bgw.WorkerReportsProgress = true;
>            bgw.RunWorkerAsync();
>         }
>
>        void bgw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
>        {
>            progressBar1.Value = 0;
>        }
>
>        void bgw_ProgressChanged(object sender, ProgressChangedEventArgs e)
>        {
>            progressBar1.Value = e.ProgressPercentage;
>        }
>
>        void bgw_DoWork(object sender, DoWorkEventArgs e)
>        {
>            BackgroundWorker bgw = sender as BackgroundWorker;
>            //Simulate long task.....
>            for (int i = 0; i < 10; i++)
>            {
>                System.Threading.Thread.Sleep(i * 250);
>                bgw.ReportProgress(i * 10);
>            }
> 
>        }
>    }
>
>
>>Let me reassure you, there is nothing "anal" about my attachment to the WAIT WINDOW NOWAIT behaviour in vfp, other than that it was so damn easy to use :)
>>
>>I'm looking for a way to display some "monitoring", keeping my users from becoming impatient, during a process that takes more than say a few seconds (yes, my users are high-strung :) )
>>
>>You figure multi-threading (something I kept away from all those years) is worth exploring in this context?
>>
>>Thanks for all your help (even when you think you're not, (and that's the only time you can be caught for being wrong) (I guess in C# you don't mind all those parentheses) you are helping dear :) ).
>>
>>Kind regards,
>>
>>Marc
>>
>>
>>
>>
>>>I don't have anything :-{
>>>
>>>I'm also a bit rusty on the actual VFP implementation but I assume you would most likely want WAIT WINDOW NOWAIT behaviour.
>>>IAC it wouldn't be trivial. AFAICS you'd need a form subclass using .Show() or ShowDialog() depending on the NOWAIT flag, a timer to implement TIMEOUT and also have to monitor keyboard and mouse activity to determine when to hide/close the window.
>>>
>>>My gut feeling is that this is a VFP specific piece of behaviour which wouldn't normally be seen in a Winforms app anyway and, unless there is a very compelling reason, it would be better to rething the interface.
>>>
>>>Won't say HTH because I'm sure it doesn't :-{
>>>
>>>>Winforms. ... and I guess I can read C#, so if you have something, do not bother to translate it... (or to be more realistic, if there is something I don't understand, I'll ask. :) )
>>>>
>>>>
>>>>>Is this WinForms, WPF or ASP.NET ?
>>>>>
>>>>>>Anybody coded a simple replacement of the "wait nowait" statement in vb.net.
>>>>>>
>>>>>>Thanks and kind regards,
>>>>>>
>>>>>>Marc

If things have the tendency to go your way, do not worry. It won't last. Jules Renard.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform