コード例 #1
0
        /// <summary>
        /// Ouvre la facture séléctionnée en lecture seule à l'aide d'une nouvelle fenêtre
        /// </summary>
        public Facture_Libre Look()
        {
            if (this._DataGridMain.SelectedItem != null)
            {
                if (this._DataGridMain.SelectedItems.Count == 1)
                {
                    //Affichage du message "affichage en cours"
                    ((App)App.Current)._theMainWindow.progressBarMainWindow.IsIndeterminate = true;
                    ((App)App.Current)._theMainWindow.changementTexteStatusBar("Affichage d'une facture en cours ...");

                    //Création de la fenêtre
                    FactureLibreWindow factureWindow = new FactureLibreWindow();

                    //Initialisation du Datacontext en Commande_Fournisseur et association à la Commande_Fournisseur sélectionnée
                    factureWindow.DataContext = new Facture_Libre();
                    factureWindow.DataContext = (Facture_Libre)this._DataGridMain.SelectedItem;

                    //Je positionne la lecture seule sur la fenêtre
                    factureWindow.lectureSeule();
                    factureWindow.soloLecture = true;

                    //J'affiche la fenêtre
                    bool? dialogResult = factureWindow.ShowDialog();

                    //Affichage du message "affichage en cours"
                    ((App)App.Current)._theMainWindow.progressBarMainWindow.IsIndeterminate = false;
                    ((App)App.Current)._theMainWindow.changementTexteStatusBar("Affichage d'une facture terminé : " + this.listFacture.Count() + " / " + this.max);

                    //Renvoi null
                    return null;
                }
                else
                {
                    MessageBox.Show("Vous ne devez sélectionner qu'une seule facture.", "Attention", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    return null;
                }
            }
            else
            {
                MessageBox.Show("Vous devez sélectionner une facture.", "Attention", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return null;
            }
        }