/// <summary> /// Démarre une action /// </summary> /// <param name="process"></param> /// <param name="nIdSession"></param> /// <returns></returns> public static CResultAErreur StartProcess(CProcess process, CReferenceObjetDonnee refCible, int nIdSession, int?nIdVersion, bool bHideProgress) { CFormExecuteProcess form = new CFormExecuteProcess(); form.Top = 0; form.Left = Screen.PrimaryScreen.WorkingArea.Width / 2 - form.Width / 2; if (bHideProgress) { return(CProcessEnExecutionInDb.StartProcess( process, new CInfoDeclencheurProcess(TypeEvenement.Manuel), refCible, nIdSession, nIdVersion, null)); } else { IAsyncResult res = form.m_startProcess.BeginInvoke(process, refCible, nIdSession, nIdVersion, new AsyncCallback(form.OnEndProcess), null); form.ShowDialog(); //Bloque le code ici ! CResultAErreur result = form.m_startProcess.EndInvoke(res); return(result); } }
/// <summary> /// Démarre une action /// </summary> /// <param name="process"></param> /// <param name="nIdSession"></param> /// <returns></returns> public static CResultAErreur RunEvent(IDeclencheurAction declencheur, CObjetDonneeAIdNumerique objetCible, bool bHideProgress) { CFormExecuteProcess form = new CFormExecuteProcess(); form.Top = 0; form.Left = Screen.PrimaryScreen.WorkingArea.Width / 2 - form.Width / 2; if (declencheur is IDeclencheurActionManuelle) { bHideProgress |= ((IDeclencheurActionManuelle)declencheur).HideProgress; } if (bHideProgress) { CInfoDeclencheurProcess infoDeclencheur = new CInfoDeclencheurProcess(TypeEvenement.Manuel); CAppelleurFonctionAsynchrone appeleur = new CAppelleurFonctionAsynchrone(); CResultAErreur resultDefault = CResultAErreur.True; resultDefault.EmpileErreur(I.T("Asynchronous call error @1|20149", "RunEvent")); return(appeleur.StartFonctionAndWaitAvecCallback(declencheur.GetType(), declencheur, "RunEvent", "", resultDefault, objetCible, infoDeclencheur, null) as CResultAErreur); //return declencheur.RunEvent(objetCible, infoDeclencheur, null); } else { IAsyncResult res = form.m_runEvent.BeginInvoke(declencheur, objetCible, new AsyncCallback(form.OnEndProcess), null); form.ShowDialog(); //Bloque le code ici ! CResultAErreur result = form.m_runEvent.EndInvoke(res); return(result); } }
/// ///////////////////////////////////////////////////////////////////////// /// <summary> /// Relance une action /// </summary> /// <param name="processEnExec"></param> /// <param name="nIdAction"></param> /// <returns></returns> public static CResultAErreur RepriseAction(CProcessEnExecutionInDb processEnExec, int nIdAction) { CFormExecuteProcess form = new CFormExecuteProcess(); form.Top = 0; form.Left = Screen.PrimaryScreen.WorkingArea.Width / 2 - form.Width / 2; IAsyncResult res = form.m_repriseAction.BeginInvoke(processEnExec, nIdAction, new AsyncCallback(form.OnEndProcess), null); form.ShowDialog(); //Bloque le code ici ! CResultAErreur result = form.m_repriseAction.EndInvoke(res); return(result); }
/// <summary> /// Démarre une action /// </summary> /// <param name="process"></param> /// <param name="nIdSession"></param> /// <returns></returns> public static CResultAErreur RunEventMultiple(IDeclencheurAction declencheur, CObjetDonneeAIdNumerique[] objetsCibles, bool bHideProgress) { CFormExecuteProcess form = new CFormExecuteProcess(); form.Top = 0; form.Left = Screen.PrimaryScreen.WorkingArea.Width / 2 - form.Width / 2; if (declencheur is IDeclencheurActionManuelle) { bHideProgress |= ((IDeclencheurActionManuelle)declencheur).HideProgress; } if (bHideProgress) { CInfoDeclencheurProcess infoDeclencheur = new CInfoDeclencheurProcess(TypeEvenement.Manuel); return(declencheur.RunEventMultiple(objetsCibles, infoDeclencheur, null)); } else { IAsyncResult res = form.m_runEventMultiples.BeginInvoke(declencheur, objetsCibles, new AsyncCallback(form.OnEndProcess), null); form.ShowDialog(); //Bloque le code ici ! CResultAErreur result = form.m_runEventMultiples.EndInvoke(res); return(result); } }