Exemple #1
0
        /// <summary>
        /// Assigne les étiquettes de l'état d'acceptation de proposition de mission.
        /// </summary>
        /// <param name="_stp_TemporaryData">Stackpanel</param>
        /// <param name="_avaibilityID">ID disponibilité</param>
        private static void TemporaryStateMission(StackPanel _stp_TemporaryData, string _avaibilityID)
        {
            string avaibilityID             = _avaibilityID;
            string temporaryAcceptedMission = InterimDatabase.GetTemporaryAcceptedMission(avaibilityID);
            bool   isAcceptMission          = (string.IsNullOrEmpty(temporaryAcceptedMission));

            // Vérifie si la mission est déjà acceptée, refusée ou en attente de réponse.
            if (isAcceptMission)
            {
                Label lbl_acceptMission = AnswerOffer(_stp_TemporaryData, avaibilityID, SentOffer_Val.Default.AcceptMission);
                lbl_acceptMission.MouseLeftButtonUp += new MouseButtonEventHandler(lbl_acceptMission_MouseLeftButtonUp);
                lbl_acceptMission.MouseEnter        += new MouseEventHandler(lbl_labelBase_MouseEnter);
                lbl_acceptMission.MouseLeave        += new MouseEventHandler(lbl_labelBase_MouseLeave);

                Label lbl_otherActionMission = AnswerOffer(_stp_TemporaryData, avaibilityID, SentOffer_Val.Default.OtherActionMission);
                lbl_otherActionMission.MouseLeftButtonUp += new MouseButtonEventHandler(lbl_otherActionMission_MouseLeftButtonUp);
                lbl_otherActionMission.MouseEnter        += new MouseEventHandler(lbl_labelBase_MouseEnter);
                lbl_otherActionMission.MouseLeave        += new MouseEventHandler(lbl_labelBase_MouseLeave);

                // Assigne à une étiquette, un menu contextuel.
                ContextMenu lbl_otherActionMissionContextMenu = new ContextMenu();
                lbl_otherActionMission.ContextMenu = lbl_otherActionMissionContextMenu;

                // Assigne à un menu contextuel, un menu d'éléments.
                MenuItem lbl_abortMission = new MenuItem();

                lbl_abortMission.Header = SentOffer_Val.Default.AbortMission;
                lbl_abortMission.Name   = SentOffer_Code.Default.lbl_answerOffer_Name + avaibilityID;
                lbl_abortMission.Click += new RoutedEventHandler(lbl_abortMission_MouseLeftButtonUp);
                lbl_otherActionMissionContextMenu.Items.Add(lbl_abortMission);

                // Assigne à un menu contextuel, un menu d'éléments.
                MenuItem lbl_rejectMission = new MenuItem();

                lbl_rejectMission.Header = SentOffer_Val.Default.RejectMission;
                lbl_rejectMission.Name   = SentOffer_Code.Default.lbl_answerOffer_Name + avaibilityID;
                lbl_rejectMission.Click += new RoutedEventHandler(lbl_rejectMission_MouseLeftButtonUp);
                lbl_otherActionMissionContextMenu.Items.Add(lbl_rejectMission);
            }
            else
            {
                // Assigne à une étiquette, l'état acceptée ou refusée à la proposition de mission.
                AcceptedOrRejectedMission(_stp_TemporaryData, temporaryAcceptedMission);
            }
        }