コード例 #1
0
        private void FindingApm(object sender, WidgetIdEventArgs e)
        {
            BeginEventHandler beginAsync = (sa, ea, cb, state) => BeginFind(e.Id, sa, ea, cb, state);

            AsyncManager.RegisterAsyncTask(beginAsync, EndFind, null);
            AsyncManager.ExecuteRegisteredAsyncTasks();
        }
コード例 #2
0
        void Finding(object sender, FindingWidgetEventArgs e)
        {
            if ((!e.Id.HasValue || e.Id <= 0) && String.IsNullOrEmpty(e.Name))
            {
                return;
            }

            if (e.Id.HasValue && e.Id > 0)
            {
                AsyncManager.RegisterAsyncTask(
                    (asyncSender, ea, callback, state) => // Begin
                    widgetRepository.BeginFind(e.Id.Value, callback, state),
                    result =>                             // End
                {
                    var widget = widgetRepository.EndFind(result);
                    if (widget != null)
                    {
                        View.Model.Widgets.Add(widget);
                    }
                },
                    result => { }, // Timeout
                    null, false);
            }
            else
            {
                AsyncManager.RegisterAsyncTask(
                    (asyncSender, ea, callback, state) => // Begin
                    widgetRepository.BeginFindByName(e.Name, callback, state),
                    result =>                             // End
                {
                    var widget = widgetRepository.EndFindByName(result);
                    if (widget != null)
                    {
                        View.Model.Widgets.Add(widget);
                    }
                },
                    result => { }, // Timeout
                    null, false);
            }
            AsyncManager.ExecuteRegisteredAsyncTasks();
            View.Model.ShowResults = true;
        }
コード例 #3
0
        void Load(object sender, EventArgs e)
        {
            View.Model.Messages.Add(ThreadMessage("View.Load event handled"));

            AsyncManager.RegisterAsyncTask(
                (asyncSender, ea, callback, state) => // Begin
            {
                View.Model.Messages.Add(ThreadMessage("Async task doStuff1 begin handler"));
                return(doStuff1.BeginInvoke(callback, state));
            },
                result => // End
            {
                var msg = doStuff1.EndInvoke(result);
                View.Model.Messages.Add(msg);
                View.Model.Messages.Add(ThreadMessage("Async task doStuff1 end handler"));
            },
                result => // Timeout
                View.Model.Messages.Add(ThreadMessage("Async task doStuff1 timeout handler")),
                null,
                true
                );

            AsyncManager.RegisterAsyncTask(
                (asyncSender, ea, callback, state) => // Begin
            {
                View.Model.Messages.Add(ThreadMessage("Async task doStuff2 begin handler"));
                return(doStuff2.BeginInvoke(callback, state));
            },
                result => // End
            {
                var msg = doStuff2.EndInvoke(result);
                View.Model.Messages.Add(msg);
                View.Model.Messages.Add(ThreadMessage("Async task doStuff2 end handler"));
            },
                result => // Timeout
                View.Model.Messages.Add(ThreadMessage("Async task doStuff2 timeout handler")),
                null,
                true
                );
        }
コード例 #4
0
        private void Load(object sender, EventArgs e)
        {
            View.Model.RecordViewLoad();

            AsyncManager.RegisterAsyncTask(InvokeAsync);
        }
コード例 #5
0
        private void Load(object sender, EventArgs e)
        {
            View.Model.Append("View Load");

            AsyncManager.RegisterAsyncTask(RunTasks);
        }
コード例 #6
0
        private void Load(object sender, EventArgs e)
        {
            View.Model.RecordViewLoad();

            AsyncManager.RegisterAsyncTask(BeginInvoke, EndInvoke, null);
        }
コード例 #7
0
 private void FindingTap(object sender, WidgetIdEventArgs e)
 {
     AsyncManager.RegisterAsyncTask(() => FindingAsync(e.Id));
     AsyncManager.ExecuteRegisteredAsyncTasks();
 }