Exemplo n.º 1
0
        public void SetLogElementAsDone(object obj, bool error, string errorMessage)
        {
            Guid logElementGUID;

            if (!Guid.TryParse(obj.ToString(), out logElementGUID))
            {
                throw new Exception($"SetLogElementAsDone called with invalid arguments ({obj})");
            }

            //MessageBox.Show($"Player.OnDone {error} : {errorMessage ?? "null"}");

            OnJobCompleted?.Invoke(logElementGUID, new JobStatus()
            {
                Success = !error, Message = errorMessage
            });

            //if (error)
            //{
            //    MessageBox.Show("fejl!");
            //}
            //else
            //{
            //    MessageBox.Show("ok!");
            //}
            //MessageBox.Show(errorMessage ?? "null");
            ////MessageBox.Show($"error = {error}");
            //return;

            ////MessageBox.Show("XXXXX");

            //OnJobCompleted?.Invoke(logElementGUID);
        }
Exemplo n.º 2
0
 private void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
 {
     IsNavigating = false;
     OnJobCompleted?.Invoke(this, null, new JobStatus()
     {
         Success = true
     });
     //webBrowser.Url = new Uri("javascript:$('input').val('hest');alert('1');");
 }
Exemplo n.º 3
0
            public Task StartAsync()
            {
                Status = WorkerStatus.WaitingForJob;
                var args = new JobInfoEventArgs(new JobInfoModel());

                OnJobStarted?.Invoke(this, args);
                Status = WorkerStatus.ProcessingJob;
                Task.Delay(10);
                OnJobCompleted?.Invoke(this, args);
                return(Task.Delay(1));
            }
        private async Task DoWork()
        {
            var jobCompletedWithResults = false;

            try
            {
                // gets deliveries for current address
                var deliveriesResponse = await barboraApiClient.GetDeliveriesAsync();

                foreach (var delivery in deliveriesResponse.deliveries)
                {
                    foreach (var deliveryDay in [email protected])
                    {
                        foreach (var hour in deliveryDay.hours)
                        {
                            if (hour.available)
                            {
                                var info = new AvailableTimeInfo
                                {
                                    DayId = deliveryDay.id,
                                    Day   = deliveryDay.day,

                                    HourId = hour.id,
                                    Hour   = hour.hour,

                                    IsExpressDelivery = deliveryDay.isExpressDelivery,

                                    Price = hour.price
                                };

                                OnAvailableTimeFound?.Invoke(this, info);

                                jobCompletedWithResults = true;
                            }
                        }
                    }
                }

                OnJobCompleted?.Invoke(this, jobCompletedWithResults);
            }
            catch (Exception exc)
            {
                if (OnException != null)
                {
                    OnException.Invoke(this, exc);
                }
                else
                {
                    throw exc;
                }
            }
        }
Exemplo n.º 5
0
        public void ResizeBrowser(BrowserResize browserResize, Guid logElementGUID)
        {
            //browser.ResizeBrowser(browserResize);
            //webBrowser.Url = new Uri("javascript:$('input').val('hest');alert('1');");

            var diffWidth  = browserResize.width - webBrowser.Size.Width;
            var diffHeight = browserResize.height - webBrowser.Size.Height;

            this.Width  += diffWidth;
            this.Height += diffHeight;

            OnJobCompleted?.Invoke(this, logElementGUID, new JobStatus()
            {
                Success = true
            });
        }
Exemplo n.º 6
0
        public void CallJobCompleted()
        {
            Completed = true;

            OnJobCompleted?.Invoke(this, new JobCompletedEventArgs(this));
        }
Exemplo n.º 7
0
 private void ScriptManager_OnJobCompleted(Guid?logElementGUID, JobStatus jobStatus)
 {
     OnJobCompleted?.Invoke(this, logElementGUID, jobStatus);
 }