Exemplo n.º 1
0
        public MainWindow()
        {
            string filesWithErrors = "";

            if (!bl.IsProgramCanRun(ref filesWithErrors))
            {
                {
                    MessageBox.Show(filesWithErrors, "שגיאה חמורה", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.None, MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading);
                    Close();
                    Environment.Exit(Environment.ExitCode);
                }
            }
            else
            {
                if (filesWithErrors != "")
                {
                    MessageBox.Show(filesWithErrors + "המערכת תפעל, אך שים לב שלא כל הנתונים הוטענו, וייתכנו שגיאות במהלך הריצה.", "שגיאה בקריאת נתונים", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.None, MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading);
                }
            }
            App.SetPasswords();
            this.MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight;
            App.numOfActivatedMainWindow++;
            this.FlowDirection    = FlowDirection.RightToLeft;
            WindowStartupLocation = WindowStartupLocation.CenterScreen;
            InitializeComponent();
            bl.AddEventIfConfigChanged(IsNeedToUpdateConfigThreadFunc);
            StatisticsGrid.DataContext = new BO.SystemStatistics();
            bl.UpdateStatistics();
            bl.AddStatisticsChangedObserve(IsNeedToUpdateStatisticsThreadFunc);

            string   cityPath   = @"..\..\..\Cities and Streets xml\CitiesList.xml";
            XElement citiesRoot = XElement.Load(cityPath);

            cities = (from item in citiesRoot.Elements() select item.Value).ToList();
            string   streetPath  = @"..\..\..\Cities and Streets xml\StreetsList.xml";
            XElement streetsRoot = XElement.Load(streetPath);

            streetsGroupedByCity = (from item in streetsRoot.Elements() group item.Element("Street").Value by item.Element("City").Value).ToList();
            SystemCommands.MaximizeWindow(this);
        }