public MainWindow() { InitializeComponent(); Filials.Add(new ItemFilial("Сретенка") { InfoscreenSettingsFolder = @"\\mspo-fs-02\Infoscreen", LoyaltyViewerAdvertisementsFolder = @"\\mspo-infomon-2\Advertisements", Prefix = "mspo" }); Filials.Add(new ItemFilial("Сущевка") { InfoscreenSettingsFolder = @"\\mssu-fs-01\Infoscreen", LoyaltyViewerAdvertisementsFolder = @"\\mssu-plaz-r1\Advertisements", Prefix = "mssu" }); Filials.Add(new ItemFilial("Сущевка детство") { InfoscreenSettingsFolder = @"\\mssu-fs-01\Infoscreen", LoyaltyViewerAdvertisementsFolder = @"\\mssu-plaz-r2\Advertisements", Prefix = "mssu" }); Filials.Add(new ItemFilial("Фрунзенская") { InfoscreenSettingsFolder = @"\\mskm-fs-01\Infoscreen", LoyaltyViewerAdvertisementsFolder = @"\\mskm-infomon-2\Advertisements", Prefix = "mskm" }); Filials.Add(new ItemFilial("Краснодар") { InfoscreenSettingsFolder = @"\\kdtt-fs-01\Infoscreen", LoyaltyViewerAdvertisementsFolder = @"\\kdtt-infomon-02\Advertisements", Prefix = "kdtt" }); Filials.Add(new ItemFilial("Казань") { InfoscreenSettingsFolder = @"\\kzkk-fs-01\Infoscreen", LoyaltyViewerAdvertisementsFolder = @"\\kzkk-infomon-2\Advertisements", Prefix = "kzkk" }); Filials.Add(new ItemFilial("Каменск-Уральский") { InfoscreenSettingsFolder = @"\\yekuk-fs-01\Infoscreen", Prefix = "yekuk" }); Filials.Add(new ItemFilial("Санкт-Петербург") { InfoscreenSettingsFolder = @"\\splp-fs-01\Infoscreen", LoyaltyViewerAdvertisementsFolder = @"\\splp-infomon-2\Advertisements", Prefix = "splp" }); Filials.Add(new ItemFilial("Сочи") { InfoscreenSettingsFolder = @"\\sctrk-fs-01\Infoscreen", LoyaltyViewerAdvertisementsFolder = @"\\sctrk-loyal-mon\Advertisements", Prefix = "sctrk" }); Filials.Add(new ItemFilial("Уфа") { InfoscreenSettingsFolder = @"\\ufkk-fs-01\Infoscreen", LoyaltyViewerAdvertisementsFolder = @"\\ufkk-infomon-2\Advertisements", Prefix = "ufkk" }); foreach (ItemFilial filial in Filials) { if (Environment.MachineName.ToLower().Contains(filial.Prefix.ToLower())) { SelectedFilial = filial; break; } } if (SelectedFilial == null) { SelectedFilial = Filials[selectedIndex++]; } DataContext = this; Infoscreen.Logging.ToLog(new string('-', 40)); Infoscreen.Logging.ToLog("Запуск приложения Advertisement Manager, пользователь: " + Environment.UserName); Loaded += MainWindow_Loaded; Closing += MainWindow_Closing; if (Debugger.IsAttached) { DispatcherTimer timer = new DispatcherTimer(); timer.Interval = new TimeSpan(0, 0, 6); timer.Tick += (s, a) => { Console.WriteLine(DateTime.Now.ToLongTimeString() + ": " + selectedIndex); if (selectedIndex == Filials.Count) { selectedIndex = 0; } SelectedFilial = Filials[selectedIndex++]; }; timer.Start(); } }
private void AddFilials(object obj) { Filials.Add(new FilialClass(Firmnames, FirmAddress, int.Parse(CountSotrs))); }