Example #1
0
        private bool CheckContraints()
        {
            for (int i = 0; i < pages.Count; i++)
            {
                try
                {
                    foreach (Control container in pages[i])
                    {
                        ((container.Controls[0]) as FieldController).CheckConstraints();
                    }
                }
                catch (FieldException exc)
                {
                    currentPageIndex = i;
                    ShowPage(currentPageIndex);

                    NotificationHelper.ShowNotification("Error", exc.CustomMessage);

                    return(false);
                }
            }
            return(true);
        }
Example #2
0
        private void OnDataSetFetched(object sender, FormFetchEventArgs e)
        {
            Invoke(new Action(delegate()
            {
                Cursor.Current = Cursors.Default;
                if (formScreen != null)
                {
                    formScreen.EnableButtons(true);
                }

                if (e.Result == CommunicationResult.Success)
                {
                    if (UpdateRecentForms())
                    {
                        warningButton.Visible = true;
                    }
                    else
                    {
                        warningButton.Visible = false;
                    }
                    StartForm(e);

                    if (loginScreen != null)
                    {
                        loginScreen.DataSubmitted    -= OnLoginDataSubmitted;
                        loginScreen.CancelConnection -= OnConnectionCanceled;
                        loginScreen.Close();
                    }
                }
                else
                {
                    NotificationHelper.ShowNotification(ExceptionManager.Error, e.Message, 10, OnNotificationMessageChanged);
                }

                communicationManager.IsFetching = false;
            }));
        }
Example #3
0
        private void OnNextButtonClick(object sender, EventArgs e)
        {
            if (rightbutton == (int)rightActionButtons.Next)
            {
                if (currentPageIndex == pages.Count - 1)
                {
                    if (CheckContraints())
                    {
                        NodeController node = workflowManager.Next();

                        if (node != null)
                        {
                            if (node.ID == currentNodeID)
                            {
                                NotificationHelper.ShowNotification(ExceptionManager.Error, ExceptionManager.InformationSubmitted);
                            }
                            else
                            {
                                currentNodeID    = node.ID;
                                currentNodeTitle = node.Name;

                                BuildPages(node);

                                if (pages.Count >= 0)
                                {
                                    ShowPage(0);
                                }

                                progressBar.NumCircles = workflowManager.EstimatedRemainingNodesCount + workflowManager.CurrentNodeCount - 1;
                                progressBar.Status     = workflowManager.CurrentNodeCount;
                                progressBar.Title      = currentNodeTitle;
                            }
                        }
                        else
                        {
                            ShowSummary();
                            //imposta submit come tasto destro
                            rightbutton       = (int)rightActionButtons.Submit;
                            nextMenuItem.Text = submitButton;
                        }
                    }
                }
                else
                {
                    currentPageIndex++;
                    ShowPage(currentPageIndex);
                }
            }
            else if (rightbutton == (int)rightActionButtons.Done)
            {
                bool checkedContraints = true;
                for (int i = separatedPanels.Peek().Controls.Count - 1; i >= 0; i--)
                {
                    checkedContraints = checkedContraints && CheckContraints(separatedPanels.Peek().Controls[i].Controls[0] as FieldController);
                }

                if (checkedContraints)
                {
                    progressBar.Title = currentNodeTitle;

                    containerPanel.Controls.Remove(separatedPanels.Pop());
                    if (separatedPanels.Count == 0)
                    {
                        backgroundPanel.BackgroundImage = Mobile.Properties.Resources.DefaultBackground;
                        mainPanel.Show();
                        containerPanel.Height = mainPanel.Height + (2 * mainPanel.Top);

                        if (currentNodeID != workflowManager.FirstNodeID || currentPageIndex > 0)
                        {
                            leftbutton            = (int)leftActionButtons.Back;
                            previousMenuItem.Text = backButton;
                        }
                        else
                        {
                            leftbutton            = (int)leftActionButtons.Exit;
                            previousMenuItem.Text = exitButton;
                        }
                        if (currentNodeTitle.Equals("Summary"))
                        {
                            rightbutton       = (int)rightActionButtons.Submit;
                            nextMenuItem.Text = submitButton;
                        }
                        else
                        {
                            rightbutton       = (int)rightActionButtons.Next;
                            nextMenuItem.Text = nextButton;
                        }
                    }
                    else
                    {
                        containerPanel.Height = separatedPanels.Peek().Height + (2 * separatedPanels.Peek().Top);
                    }

                    containerPanel.Invalidate();
                }
                return;
            }
            else if (rightbutton == (int)rightActionButtons.Submit)
            {
                nextMenuItem.Enabled = false;
                SendFillingFinishMessage(true);
            }

            if (currentPageIndex != 0 || currentNodeID != workflowManager.FirstNodeID)
            {
                leftbutton            = (int)leftActionButtons.Back;
                previousMenuItem.Text = backButton;
            }
        }