Пример #1
0
 public Tableau(String WilayaName)
 {
     try
     {
         config = App.Config;
         config.import("config.json");
         inputSynthese = new InputSynthese(DateTime.Today, DateTime.Today, config.getWilaya(WilayaName).path);
         InitializeComponent();
         date1.SelectedDate = date2.SelectedDate = DateTime.Today;
         this.WilayaName    = WilayaName;
         done = true;
     }
     catch (FileNotFoundException error)
     {
         MessageBoxWindow mb = new MessageBoxWindow("Le chemmin de la wilaya " + WilayaName + "\n n'existe pas ", false);
         mb.messageErreur.Visibility = Visibility.Hidden;
         mb.casSpecial.Content       = "Ajouter Dataset";
         mb.casSpecial.Visibility    = Visibility.Visible;
         mb.casSpecial.Click        += (object Sender, RoutedEventArgs a) =>
         {
             MainWindow mw = App.Current.MainWindow as MainWindow;
             if (mw.isLoggedIn)
             {
                 DataSet d = new DataSet();
                 d.ComboWilaya.Text = WilayaName;
                 d.ShowDialog();
                 mb.Close();
             }
             else
             {
                 mb.messageErreur.Visibility = Visibility.Visible;
                 mb.messageErreur.Text       = "Vous n'etes pas un admin";
             }
         };
         mb.ShowDialog();
     }
     if (File.Exists(config.getWilaya(WilayaName).path))
     {
         InitializeComponent();
         date1.SelectedDate = date2.SelectedDate = DateTime.Today;
         this.WilayaName    = WilayaName;
         inputSynthese      = new InputSynthese(DateTime.Today, DateTime.Today, config.getWilaya(WilayaName).path);
         done = true;
     }
     else
     {
         Synthese synth = (App.Current.MainWindow as MainWindow).main.Content as Synthese;
         //synth.pageouverte = 0;
         //synth.Tableau.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#556060"));
         synth.ErreurMessage.Text       = "Le chemin de la wilaya " + WilayaName + "\n n'existe pas ";
         synth.contenuErreur.Visibility = Visibility.Visible;
     }
 }