Esempio n. 1
0
        bool CheckForOpenRequestDetails()
        {
            if (_openRequestDetails.Count > 0)
            {
                DialogResult dia = MessageBox.Show(this, "There are open request details, closing the request list window will close all other windows.\r\nDo you wish to continue?", "Close Open Requests", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (dia == DialogResult.Yes)
                {
                    log.Debug(_openRequestDetails.Count + " open request detail windows, attempting to close.");
                    RequestDetailForm frm = null;
                    for (int i = _openRequestDetails.Count - 1; i >= 0; i--)
                    {
                        frm = _openRequestDetails[i];
                        _openRequestDetails.Remove(frm);

                        log.Debug("Closing request detail window: " + frm.Request.Source.MSRequestID);

                        frm.Close();
                    }
                }
                else
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 2
0
        private void DetailForm_Closed_EventHandler(object sender, EventArgs e)
        {
            RequestDetailForm frm = (RequestDetailForm)sender;

            RequestDetailForm openDetailsForm = _openRequestDetails.Where(rdf => rdf.Request.Source.ID == frm.Request.Source.ID && rdf.Request.DataMartId == frm.Request.DataMartId).FirstOrDefault();

            if (openDetailsForm != null)
            {
                _openRequestDetails.Remove(openDetailsForm);
            }

            frm.Dispose();
        }
Esempio n. 3
0
        private void ShowRequestDetailDialog(NetWorkSetting ns, Guid id, Guid dataMartId)
        {
            RequestDetailForm openDetailsForm = _openRequestDetails.Where(rdf => rdf.Request.Source.ID == id && rdf.Request.DataMartId == dataMartId).FirstOrDefault();

            if (openDetailsForm != null)
            {
                openDetailsForm.BringToFront();
                openDetailsForm.Focus();
                return;
            }


            var progress = new ProgressForm("Loading Request Information", "Loading full Request information from the Network...");

            RequestCache.ForNetwork(ns)
            .LoadRequest(id, dataMartId)
            .TakeUntil(progress.ShowAndWaitForCancel(this))
            .ObserveOn(this)
            .Finally(progress.Dispose)
            .Do(request =>
            {
                var f         = new RequestDetailForm(request);
                f.FormClosed += Refresh_EventHandler;
                f.Shown      += (_, __) =>
                {
                    progress.Dispose();
                    f.BringToFront();
                    f.Activate();
                };
                f.FormClosed += DetailForm_Closed_EventHandler;

                _openRequestDetails.Add(f);

                //open the form just below and left of the parent form location.
                f.Location = new Point(this.Location.X + 14, this.Location.Y + 14);

                f.Show();
                //not setting the owner to allow bringing the parent form to the foreground on top of the request details.

                f.BringToFront();
                f.Focus();
            })
            .LogExceptions(log.Error)
            .Catch(( IncompatibleProcessorException e ) => MessageBox.Show(e.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information))
            .Catch(( CannotLoadProcessorException e ) => MessageBox.Show(e.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information))
            .Catch((Exception e) => MessageBox.Show(string.Join(Environment.NewLine, OpResult.FromException(e).ErrorMessages), "Unexpected error", MessageBoxButtons.OK, MessageBoxIcon.Error))
            .Subscribe();
        }
Esempio n. 4
0
        private void ShowRequestDetailDialog(NetWorkSetting ns, Guid id, Guid dataMartId)
        {
            var progress = new ProgressForm("Loading Request Information", "Loading full Request information from the Network...");

            RequestCache.ForNetwork(ns)
            .LoadRequest(id, dataMartId)
            .TakeUntil(progress.ShowAndWaitForCancel(this))
            .ObserveOn(this)
            .Finally(progress.Dispose)
            .Do(request =>
            {
                using (var f = new RequestDetailForm(request))
                {
                    f.FormClosed += Refresh_EventHandler;
                    f.Shown      += (_, __) => progress.Dispose();
                    f.ShowDialog(this);
                }
            })
            .LogExceptions(log.Error)
            .Catch(( IncompatibleProcessorException e ) => MessageBox.Show(e.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information))
            .Catch(( CannotLoadProcessorException e ) => MessageBox.Show(e.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information))
            .Catch((Exception e) => MessageBox.Show(string.Join(Environment.NewLine, OpResult.FromException(e).ErrorMessages), "Unexpected error", MessageBoxButtons.OK, MessageBoxIcon.Error))
            .Subscribe();
        }