private void StartForm(FormFetchEventArgs e) { currentFormId = e.Info.RequestInfo.CompilationRequestId; FieldFactory.Types = e.Types; WorkflowManager wm = null; try { wm = new WorkflowManager(e.Info, e.WorkflowNodes, e.WorkflowEdges, e.Types, e.Presentation, e.Data); formScreen = new FormScreen(wm, configuration.Configuration.SaveOnLowBattery); formScreen.FillingFinished += OnFormFillingFinished; formScreen.BatteryLevelNotification += OnBatteryLevelNotification; formScreen.Closed += OnFormScreenClosed; if (recentScreen != null) { recentScreen.Hide(); } if (loginScreen != null) { loginScreen.Hide(); } formScreen.Text = e.Info.Name; //formScreen.ChangeOrientation(SystemSettings.ScreenOrientation); formScreen.Show(); } catch (WorkflowException w) { NotificationHelper.ShowNotification(ExceptionManager.Error, w.Message); } }
private void OnFormFillingFinished(object sender, FillingEventArgs e) { if (!e.Completed) { communicationManager.SaveForm(currentFormId, e.Result); NotificationHelper.ShowNotification(ExceptionManager.Warning, ExceptionManager.FormSaved); } else { Cursor.Current = Cursors.WaitCursor; communicationManager.SubmitForm(currentFormId, e.Result); } }
private bool CheckContraints(FieldController controller) { try { controller.CheckConstraints(); } catch (FieldException exc) { NotificationHelper.ShowNotification("Error", exc.CustomMessage); return(false); } return(true); }
private void OnDataSubmitted(object sender, FormEventArgs e) { Invoke(new Action(delegate() { Cursor.Current = Cursors.Default; if (e.Result == CommunicationResult.Success) { communicationManager.RemoveForm(e.Info.RequestInfo.CompilationRequestId); UpdateRecentForms(); NotificationHelper.ShowNotification(ExceptionManager.Success, ExceptionManager.FormSubmitted, 10, OnNotificationMessageChanged); } else { NotificationHelper.ShowNotification(ExceptionManager.Error, ExceptionManager.FormNotSubmitted); } formScreen.EnableButtons(true); })); }
private bool CheckData() { try { int idInt = Int32.Parse(id.Text); } catch (FormatException) { NotificationHelper.ShowNotification(ExceptionManager.Error, ExceptionManager.CompilationRequestIdInteger); return(false); } if (!Public) { if (username.Text == "" || token.Text == "") { NotificationHelper.ShowNotification(ExceptionManager.Error, ExceptionManager.InformationSpecified); return(false); } } return(true); }
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); }
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; })); }
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; } }