private void AppliqueParametre(CParametreVisuModuleParametrage parametre) { if (parametre.Size.Width > 5) { Size = parametre.Size; } if (parametre.Position.X != -1 && parametre.Position.Y != -1) { Location = parametre.Position; } if (CFormMain.GetInstance() != null) { if (parametre.TimosSize.Width > 5) { CFormMain.GetInstance().Size = parametre.TimosSize; } if (parametre.TimosPosition.X != -1 && parametre.TimosPosition.Y != -1) { CFormMain.GetInstance().Location = parametre.TimosPosition; } if (parametre.TimosAgrandi) { CFormMain.GetInstance().WindowState = FormWindowState.Maximized; } else { CFormMain.GetInstance().WindowState = FormWindowState.Normal; } } m_panelModulesParametrage.SetParametreAffichage(parametre); }
//--------------------------------------------------- private void EditeIntervention(CIntervention intervention) { if (intervention != null) { CReferenceTypeForm refTypeForm = CFormFinder.GetRefFormToEdit(typeof(CIntervention)); if (refTypeForm != null) { CFormEditionStandard frm = refTypeForm.GetForm(intervention) as CFormEditionStandard; if (frm != null) { if (m_gestionnaireModeEdition.ModeEdition) { CFormNavigateurPopup.Show(frm, FormWindowState.Maximized); } else { sc2i.win32.navigation.IFormNavigable thisFrm = FindForm() as sc2i.win32.navigation.IFormNavigable; if (thisFrm != null && thisFrm.Navigateur != null) { thisFrm.Navigateur.AffichePage(frm); } else { CFormMain.GetInstance().AffichePage(frm); } } } } FillListeInterventionsAPlanifier(); m_controlePlanning.Refresh(); } }
//-------------------------------------------------------------------------- private void m_lblHeader_Click(object sender, EventArgs e) { if (m_releve != null && m_releve.Site != null) { CFormMain.GetInstance().EditeElement(m_releve.Site, false, ""); } }
//----------------------------------------------------- private void AfficheMessages() { if (!IsHandleCreated) { CreateControl(); } int nHeight = m_panelTop.Height + m_lblBas.Height * 2; List <CCustomizableListItem> lstItems = new List <CCustomizableListItem>(); foreach (CMessageNotification m in m_listeMessages) { CCustomizableListItem i = new CCustomizableListItem(); i.Tag = m; lstItems.Add(i); } m_panelContenu.CurrentItemIndex = null; m_panelContenu.Items = lstItems.ToArray(); m_panelContenu.Refill(); for (int n = 0; n < m_panelContenu.Items.Count(); n++) { nHeight += m_panelContenu.ItemControl.Height; } nHeight = Math.Min(nHeight, 200); Point pt = CFormMain.GetInstance().GetPointBasDroitNotification(); this.Location = new Point( pt.X - Width, pt.Y - nHeight); Size = new Size(Width, nHeight); ShowInactiveTopmost(this); }
public PresenterMain() { MaterialForm = new CFormMain(); View = (CFormMain)MaterialForm; FormControl = View.FormControl; // Initialize MaterialSkinManager MaterialSkinManager = MaterialSkinManager.Instance; MaterialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT; View.PropertyChanged += view_PropertyChanged; View.ViewClosed += view_Closed; try { PresenterConnectToServer pConnectToServer = new PresenterConnectToServer(true); pConnectToServer.MaterialSkinManager = MaterialSkinManager; pConnectToServer.MaterialForm.Parent = View.FormControl; pConnectToServer.ConnectedSuccessfully += LoggedToServer; View.AddMaterialPanelTab(pConnectToServer.MaterialForm, false); pConnectToServer.ViewClosed += OnTabClosed; } catch (Exception ex) { Console.WriteLine(ex.Message); } }
//------------------------------------------------------------------- private void m_btnSuperviser_Click(object sender, EventArgs e) { CSchemaReseau schema = ElementSelectionne as CSchemaReseau; if (schema != null) { CFormSupervisionSchema.Superviser(schema, CFormMain.GetInstance()); } }
private void m_wndListeUsers_MouseDoubleClick(object sender, MouseEventArgs e) { ListViewHitTestInfo info = m_wndListeUsers.HitTest(new Point(e.X, e.Y)); if (info != null && info.Item != null && info.Item.Tag is CDbKey) { CFormMain.GetInstance().ShowChatUser((CDbKey)info.Item.Tag); Close(); } }
private void m_imageFromBase_Click(object sender, EventArgs e) { CItemInventaire iv = CurrentItem as CItemInventaire; if (iv != null) { CEquipement eqpt = iv.TraitementReleve.ReleveEquipement.Equipement; if (eqpt != null) { CFormMain.GetInstance().EditeElement(eqpt, false, ""); } } }
//--------------------------------------------------------- void itemElementACout_MouseUp(object sender, MouseEventArgs e) { ToolStripMenuItem item = sender as ToolStripMenuItem; if (item != null && (e.Button == MouseButtons.Right || item.DropDownItems.Count == 0)) { IElementACout elt = item != null ? item.Tag as IElementACout : null; if (elt != null) { CFormMain.GetInstance().EditeElement(elt.ObjetPourEditionElementACout, false, ""); } } }
void m_panelModulesParametrage_OnAutoArrangeWindow(object sender, EventArgs e) { Form formPrincipale = CFormMain.GetInstance(); int unQuart = (int)Screen.PrimaryScreen.WorkingArea.Width / 4; int troisQuart = (int)Screen.PrimaryScreen.WorkingArea.Width - unQuart; this.Location = new Point(0, 0); this.Size = new Size(unQuart, Screen.PrimaryScreen.WorkingArea.Height); formPrincipale.WindowState = FormWindowState.Normal; formPrincipale.Location = new Point(this.Width, 0); formPrincipale.Size = new Size(troisQuart, Screen.PrimaryScreen.WorkingArea.Height); }
private void SaveParametreAffichage() { CParametreVisuModuleParametrage parametre = new CParametreVisuModuleParametrage(); m_panelModulesParametrage.FillParametreAffichage(parametre); parametre.Size = Size; parametre.Position = Location; if (CFormMain.GetInstance() != null) { parametre.TimosPosition = CFormMain.GetInstance().Location; parametre.TimosSize = CFormMain.GetInstance().Size; parametre.TimosAgrandi = CFormMain.GetInstance().WindowState == FormWindowState.Maximized; CTimosAppRegistre.SaveParametreVisuModulesParametrage(parametre); } }
//----------------------------------------------------------------------------- private static void OnChangePageActive(object sender, EventArgs args) { CFormEditionStandard frm = sender as CFormEditionStandard; if (frm != null) { CEtapeWorkflow etape = null; if (Instance.m_dicFormToEtape.TryGetValue(frm, out etape)) { CFormMain.GetInstance().SetEtapeActive(etape, frm); return; } } CFormMain.GetInstance().SetEtapeActive(null, sender as CFormEditionStandard); }
private void AppliqueEtape(CEtapeWorkflow etape, CFormEditionStandard formStandard) { formStandard.BoutonAjouterVisible = false; formStandard.BoutonSupprimerVisible = false; CBlocWorkflowFormulaire bloc = etape.TypeEtape.Bloc as CBlocWorkflowFormulaire; if (bloc != null) { formStandard.AddRestrictionComplementaire("WORKFLOW_FORMULAIRE", bloc.Restrictions, false); } m_dicFormToEtape[formStandard] = etape; formStandard.AfterGetContexte += m_eventAfterGetContexte; formStandard.Disposed += new EventHandler(formStandard_Disposed); CFormMain.GetInstance().SetEtapeActive(etape, formStandard); }
public PresenterMain() { MaterialForm = new CFormMain(); View = (CFormMain)MaterialForm; FormControl = View.FormControl; // Initialize MaterialSkinManager MaterialSkinManager = MaterialSkinManager.Instance; MaterialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT; View.PropertyChanged += view_PropertyChanged; View.ViewClosed += view_Closed; try { PresenterManage pManage = new PresenterManage(); pManage.MaterialSkinManager = MaterialSkinManager; pManage.MaterialForm.Parent = View.FormControl; View.AddMaterialPanelTab(pManage.MaterialForm, true); pManage.ViewClosed += OnTabClosed; }catch (Exception) { } try { PresenterChat pChat = new PresenterChat(); pChat.MaterialSkinManager = MaterialSkinManager; pChat.MaterialForm.Parent = View.FormControl; View.AddMaterialPanelTab(pChat.MaterialForm, false); pChat.ViewClosed += OnTabClosed; } catch (Exception ex) { Console.WriteLine(ex.Message); } try { PresenterLinie pLinie = new PresenterLinie(); pLinie.FormText = "Linie"; pLinie.MaterialSkinManager = MaterialSkinManager; pLinie.MaterialForm.Parent = View.FormControl; View.AddMaterialPanelTab(pLinie.MaterialForm, false); pLinie.ViewClosed += OnTabClosed; pLinie.DisplayWariant += pLinie_DisplayWariant; } catch (Exception) { } }
//------------------------------------------------------------------- protected override void InitPanel() { CFormMain.GetInstance().CancelEtapePermanente(); CFiltreData filtre = null; CDonneesActeurUtilisateur user = CUtilSession.GetUserForSession(m_listeObjets.ContexteDonnee); if (user != null) { CListeObjetsDonnees lstPourActeur = user.Acteur.GetEtapeWorkflowsEnCours(); filtre = lstPourActeur.FiltrePrincipal; } else { filtre = new CFiltreData(CEtapeWorkflow.c_champEtat + "=@1", (int)EEtatEtapeWorkflow.Démarrée); } /* * string[] strCodes = CUtilSession.GetCodesAffectationsEtapeConcernant(m_listeObjets.ContexteDonnee); * CFiltreData filtreAss = new CFiltreData( ); * foreach (string strCode in strCodes) * { * filtreAss.Filtre += CEtapeWorkflow.c_champAffectations + " like @" + * (filtreAss.Parametres.Count + 1) + " or "; * filtreAss.Parametres.Add("%~" + strCode + "~%"); * } * if (filtreAss.Filtre.Length > 0) * { * filtreAss.Filtre = filtreAss.Filtre.Remove(filtreAss.Filtre.Length - 4, 4); * filtre = CFiltreData.GetAndFiltre(filtre, filtreAss); * } */ //m_listeObjets.Filtre = filtre; m_panelListe.FiltreDeBase = filtre; m_panelListe.InitFromListeObjets( m_listeObjets, typeof(CEtapeWorkflow), null, ""); m_panelListe.BoutonAjouterVisible = false; m_panelListe.BoutonSupprimerVisible = false; m_panelListe.BoutonModifierVisible = false; m_panelListe.RemplirGrille(); }
//----------------------------------------------------------------------------- private void AfterInitFromContexteOnForm(IFormNavigable form, CContexteFormNavigable contexte) { CFormEditionStandard frmStd = form as CFormEditionStandard; if (frmStd != null) { int?nIdEtape = contexte[c_cleContexteEtape] as int?; if (nIdEtape != null) { CEtapeWorkflow etape = new CEtapeWorkflow(CSc2iWin32DataClient.ContexteCourant); if (etape.ReadIfExists(nIdEtape.Value)) { m_dicFormToEtape[frmStd] = etape; CFormMain.GetInstance().SetEtapeActive(etape, form as CFormEditionStandard); AppliqueEtape(etape, frmStd); } } } }
/// /////////////////////////////////////////// public override CResultAErreur RunService(object parametre) { CResultAErreur result = CResultAErreur.True; if (!(parametre is CActionAfficheEtapeWorkflow.CParametreAffichageEtapeWorkflow)) { result.EmpileErreur(I.T("Parameter type imcompatible with 'Display workflow' service|20589")); return(result); } CActionAfficheEtapeWorkflow.CParametreAffichageEtapeWorkflow parametreEdition = (CActionAfficheEtapeWorkflow.CParametreAffichageEtapeWorkflow)parametre; CEtapeWorkflow etape = new CEtapeWorkflow(CSc2iWin32DataClient.ContexteCourant); if (etape.ReadIfExists(parametreEdition.IdEtapeWorkflow)) { CFormMain.GetInstance().DisplayEtapeFromOtherThread(etape, parametreEdition.DansNouvelOnglet); } return(result); }
private void m_btnAnnuler_Click(object sender, EventArgs e) { SetEtapeEnCours(null, null); CFormMain.GetInstance().CancelEtapePermanente(); }
//----------------------------------------------------------------------------- private CResultAErreur AfficheEtapeFormulaire(CEtapeWorkflow etape, bool bDansNouvelOnglet) { CResultAErreur result = CResultAErreur.True; CBlocWorkflowFormulaire blocFormulaire = etape.TypeEtape != null ? etape.TypeEtape.Bloc as CBlocWorkflowFormulaire : null; if (blocFormulaire == null) { result.EmpileErreur(I.T("Error while initializing workflow step|20557")); return(result); } //trouve l'élément à éditer CContexteEvaluationExpression ctxEval = new CContexteEvaluationExpression(etape); if (blocFormulaire.FormuleElementEditePrincipal == null) { result.EmpileErreur(I.T("Step @1 doesn't define element to edit|20558", etape.TypeEtape.Libelle)); return(result); } result = blocFormulaire.FormuleElementEditePrincipal.Eval(ctxEval); if (!result) { return(result); } CObjetDonneeAIdNumeriqueAuto objet = result.Data as CObjetDonneeAIdNumeriqueAuto; if (objet == null) { result.EmpileErreur(I.T("Element to edit for step @1 is invalid|20559"), etape.TypeEtape.Libelle); return(result); } CFormEditionStandard formStandard; if (blocFormulaire.IsStandardForm) { CReferenceTypeForm refType = CFormFinder.GetRefFormToEdit(objet.GetType()); formStandard = null; try { if (refType != null) { formStandard = refType.GetForm(objet) as CFormEditionStandard; } } catch (Exception e) { } if (formStandard == null) { result.EmpileErreur(I.T("System can not edit @1|20560", DynamicClassAttribute.GetNomConvivial(objet.GetType()))); return(result); } } else { //CFormulaire formulaire = new CFormulaire(etape.ContexteDonnee); //if (!formulaire.ReadIfExists( // blocFormulaire.IdFormulairePrincipal == null ? -1 : blocFormulaire.IdFormulairePrincipal.Value)) //{ // result.EmpileErreur(I.T("Form for step @1 is invalid|20561", // etape.TypeEtape.Libelle)); // return result; //} CFormEditionStdPourFormulaire frm = new CFormEditionStdPourFormulaire(objet); //frm.IdFormulaireAffiche = formulaire.Id; frm.IdsFormulairesAffiches = blocFormulaire.ListeDbKeysFormulaires; formStandard = frm; } CFormMain.GetInstance().SetEtapeActive(null, null); if (formStandard != null && blocFormulaire.RestrictionExceptionContext.Length > 0) { formStandard.ContexteModification = blocFormulaire.RestrictionExceptionContext; } if (bDansNouvelOnglet) { CFormMain.GetInstance().AffichePageDansNouvelOnglet(formStandard); } else { CFormMain.GetInstance().AffichePage(formStandard); } AppliqueEtape(etape, formStandard); return(result); }
/*/// ////////////////////////////////////////////////////////////////// * private static void CCreateur2iFormulaire_AfterCreateControl ( Control ctrl, C2iWnd wnd, object elementEdite ) * { * if ( wnd is C2iWndLink && ctrl is LinkLabel ) * { * ctrl.Tag = new CInfoLinkLabel((C2iWndLink)wnd, elementEdite); * ((LinkLabel)ctrl).LinkClicked += new LinkLabelLinkClickedEventHandler(CExecuteurActionSur2iLink_Click); * } * } * * static void CCreateur2iFormulaire_AfterChangeElementEdite(Control ctrl, C2iWnd wnd, object elementEdite) * { * if (wnd is C2iWndLink && ctrl is LinkLabel) * { * ctrl.Tag = new CInfoLinkLabel((C2iWndLink)wnd, elementEdite); * } * }*/ /*/// ////////////////////////////////////////////////////////////////// * private static void CExecuteurActionSur2iLink_Click ( object sender, LinkLabelLinkClickedEventArgs args ) * { * if (sender is LinkLabel && ((LinkLabel)sender).Tag is CInfoLinkLabel) * { * CInfoLinkLabel info = (CInfoLinkLabel)((LinkLabel)sender).Tag; * C2iWndLink link = info.WndLink; * object cible = info.Cible; * CResultAErreur result = CResultAErreur.True; * if ( link.ActionAssociee != null ) * { * Form frm = ((Control)sender).FindForm(); * if (cible == null) * { * if (frm != null && frm is IFormEditObjetDonnee) * cible = ((IFormEditObjetDonnee)frm).GetObjetEdite(); * } * if (frm != null && frm is CFormEditionStandard) * { * if (((CFormEditionStandard)frm).EtatEdition) * { * if (CFormAlerte.Afficher(I.T("This action will save your data. Continue ?|1253"), * EFormAlerteType.Question) == DialogResult.No) * return; * if (!((CFormEditionStandard)frm).OnClickValider()) * return; * ((CFormEditionStandard)frm).OnClickModifier(); * } * * } * if ( frm != null && frm is CFormListeStandard ) * { * if ( link.ActionAssociee.GetType() == typeof ( CActionSur2iLinkAfficheFormulaireCustom ) || * link.ActionAssociee.GetType() == typeof ( CActionSur2iLinkAfficherFormulaire ) || * link.ActionAssociee.GetType() == typeof ( CActionSur2iLinkAfficherListe )) * cible = ((CFormListeStandard)frm).ElementSelectionne; * else if ( link.ActionAssociee.GetType() == typeof ( CActionSur2iLinkExecuterProcess ) ) * cible = ((CFormListeStandard)frm).ElementsCoches; * } * result = ExecuteAction(link.ActionAssociee, cible); * if ( !result ) * CFormAlerte.Afficher ( result.Erreur ); * } * } * }*/ /// <summary> /// ////////////////////////////////////////////////////////////////// /// </summary> /// <param name="action"></param> /// <returns></returns> public static CResultAErreur ExecuteAction(object sender, CActionSur2iLink action, object objetCible) { CResultAErreur result = CResultAErreur.True; Form frm = null; if (!action.AutoriserEnEdition && sender != null && sender is Control) { frm = ((Control)sender).FindForm(); object cible = objetCible; if (cible == null) { if (frm != null && frm is IFormEditObjetDonnee) { cible = ((IFormEditObjetDonnee)frm).GetObjetEdite(); } } if (frm != null && frm is IFormEditObjetDonnee) { if (((IFormEditObjetDonnee)frm).EtatEdition) { if (CFormAlerte.Afficher(I.T("This action will save your data. Continue ?|1253"), EFormAlerteType.Question) == DialogResult.No) { return(result); } if (!((IFormEditObjetDonnee)frm).ValiderModifications()) { return(result); } CObjetDonnee obj = ((IFormEditObjetDonnee)frm).GetObjetEdite(); if (obj != null) { if (cible is CObjetDonnee) { cible = ((CObjetDonnee)cible).GetObjetInContexte(obj.ContexteDonnee); } } //((CFormEditionStandard)frm).OnClickModifier(); } } if (frm != null && frm is CFormListeStandard) { if ( action.GetType() == typeof(CActionSur2iLinkAfficherFormulaire) || action.GetType() == typeof(CActionSur2iLinkAfficherListe)) { cible = ((CFormListeStandard)frm).ElementSelectionne; } else { CActionSur2iLinkAfficheFormulaireCustom actionForm = action as CActionSur2iLinkAfficheFormulaireCustom; if (actionForm != null) { cible = ((CFormListeStandard)frm).ElementSelectionne; CFormulaire formulaire = new CFormulaire(CContexteDonneeSysteme.GetInstance()); if (formulaire.ReadIfExists(actionForm.IdFormulaireInDb)) { if (formulaire.ElementEditeIsArray) { cible = ((CFormListeStandard)frm).ElementsCoches; } } } else if (action.GetType() == typeof(CActionSur2iLinkExecuterProcess)) { cible = ((CFormListeStandard)frm).ElementsCoches; } } } objetCible = cible; } if (action is CActionSur2iLinkAfficherFormulaire) { return(ExecuteActionFormulaire((CActionSur2iLinkAfficherFormulaire)action, objetCible)); } else if (action is CActionSur2iLinkAfficherListe) { return(ExecuteActionListe((CActionSur2iLinkAfficherListe)action, objetCible)); } else if (action is CActionSur2iLinkExecuterProcess) { result = ExecuteActionProcess((CActionSur2iLinkExecuterProcess)action, objetCible); CFormEditionStandard frmStd = frm as CFormEditionStandard; if (frmStd != null) { try//La fenêtre peut être fermée par le process, donc ça peut faire des erreurs { frmStd.RefillDialog(); } catch { } } else if (frm == CFormMain.GetInstance()) { CFormMain.GetInstance().RefreshPanelEtapeWorkflow(); } return(result); } else if (action is CActionSur2iLinkAfficheFormulaireCustom) { return(ExecuteActionFormulaireCustom((CActionSur2iLinkAfficheFormulaireCustom)action, objetCible)); } else if (action is CActionSur2iLinkAfficherEntite) { return(ExecuteActionAfficherEntite((CActionSur2iLinkAfficherEntite)action, objetCible)); } else if (action is CActionSur2iLinkMenuDeroulant) { return(ExecuteActionMenuDeroulant((CActionSur2iLinkMenuDeroulant)action, sender, objetCible)); } else if (action is CActionSur2iLinkFormulairePopup) { return(ExecuteActionFormulairePopup((CActionSur2iLinkFormulairePopup)action, sender, objetCible)); } result = CResultAErreur.True; result.EmpileErreur(I.T("Action not managed|30076")); return(result); }
private void m_pictureWorkflow_Click(object sender, EventArgs e) { m_nNbClignotementsWorkflowsRestant = 0; CFormMain.GetInstance().AffichePage(new CFormListeEtapesWorkflowEnCours()); }