示例#1
0
        private void StartButton_Click(object sender, EventArgs e)
        {
            var progDelegate = new StartProcessDelegate(StartProcess);

            progDelegate.BeginInvoke(100, null, null);
            Console.WriteLine("Done With operation");
        }
        private void StartButton_Click(object sender, System.EventArgs e)
        {
            StartProcessDelegate progDel = new StartProcessDelegate(StartProcess);

            progDel.BeginInvoke(100, null, null);
            MessageBox.Show("Done with operation!!");
        }
示例#3
0
        private void Btn_Start_Click(object sender, EventArgs e)
        {
            //var progDelBad = new StartProcessDelegate(StartProcessBad);
            var progDelGood = new StartProcessDelegate(StartProcessGood);

            //progDelBad.BeginInvoke( 100, null, null );
            progDelGood.BeginInvoke(100, null, null);
        }
        private void StartButton_Click(object sender, EventArgs e)
        {
            // Call long running process
            StartProcessDelegate startDel = new StartProcessDelegate(StartProcess);

            // startDel.BeginInvoke executes delegate on new thread
            startDel.BeginInvoke(100, null, null);

            // Show message box to demonstrate that StartProcess()
            // is running asynchronously
            MessageBox.Show("Called after async process started.");
        }
示例#5
0
        public void ServerSync(string fields, string serverId, string url)
        {
            fields += " " + LOCATIONS_PCS_PATH;

            // sends server pre-existing servers' urls as part of the arguments
            IAsyncResult result;

            lock (ServerUrls)
            {
                // sends server pre-existing servers' urls as part of the arguments
                result = _startProcessDelegate.BeginInvoke(url,
                                                           fields + " " + Servers.Count.ToString() + " " + ServerUrls,
                                                           @"..\..\..\Server\bin\Debug\Server.exe", serverId, null, null);
                Servers.TryAdd(serverId, (IServer)Activator.GetObject(typeof(IServer), url));
                ServerUrls += " " + url;
            }
            ServerIdsToUrls.TryAdd(serverId, url);
            result.AsyncWaitHandle.WaitOne();

            Console.WriteLine("Server {0} created!", serverId);
        }
        private void StartButton_Click(object sender, RoutedEventArgs e)
        {
            //Call long running process
            StartProcessDelegate startDel = new StartProcessDelegate(StartProcess);

            //startDel.BeginInvoke executes delegate on new thread
            startDel.BeginInvoke(100, null, null);

            //Show message box to demonstrate that StartProcess()
            //is running asynchronously
            MessageBox.Show("Called after async process started.");
        }
        private void btnStart_Click(object sender, System.EventArgs e)
        {
            int max = 100;

            this.pbStatus.Maximum = max;
            //Call long running process
            StartProcessDelegate startDel = new StartProcessDelegate(StartProcess);

            //startDel.BeginInvoke executes delegate on new thread
            startDel.BeginInvoke(max, null, null);
            //Show message box to demonstrate that StartProcess()
            //is running asynchronously
            MessageBox.Show("Called after async process started.");
        }
        private void StartButton_Click(object sender, EventArgs e)
        {
            var progDel = new StartProcessDelegate(StartProcess);

            progDel.BeginInvoke(10, null, null);  ///invoce asyncronously
        }