public MainWindow() { InitializeComponent(); Settings.init(System.AppDomain.CurrentDomain.BaseDirectory + "/Data/settings.xml"); Logger.InitFileLogger(System.AppDomain.CurrentDomain.BaseDirectory + "/logs/", "nprch"); SettingsNPRCH.init(System.AppDomain.CurrentDomain.BaseDirectory + "/Data/SettingsNPRCH.xml"); grdStatus.DataContext = EDSClass.Single; init(); Logger.Info("start"); txtDiffHour.Text = "3"; //chart.init(); clndDate.SelectedDate = DateTime.Now.Date.AddDays(-1); statusBar.DataContext = this; }
private void btnLoadFiles_Click(object sender, RoutedEventArgs e) { StatusText = "Загрузка"; string FN = chbReserv.IsChecked.Value ? "/Data/settingsNPRCHReserv.xml" : "/Data/settingsNPRCH.xml"; SettingsNPRCH.init(System.AppDomain.CurrentDomain.BaseDirectory + FN); btnLoadFiles.IsEnabled = false; Application.Current.Dispatcher.Invoke( DispatcherPriority.Background, new ThreadStart( delegate { LoadFiles(); } ) ); btnLoadFiles.IsEnabled = true; // btnLoadFiles.Visibility = Visibility.Visible; }
public static void init(string filename) { try { SettingsNPRCH single = XMLSer <SettingsNPRCH> .fromXML(filename); Single = single; string blocks = single.BlocksString; string[] blocksArr = blocks.Split(new char[] { ';' }); BlocksDict = new Dictionary <string, BlockData>(); foreach (string blockStr in blocksArr) { try { string[] arr = blockStr.Split(new char[] { '~' }); BlockData bd = new BlockData(arr[0], Int32.Parse(arr[1]), Int32.Parse(arr[2]), Int32.Parse(arr[3]), 60.0 / Int32.Parse(arr[4]) * 50.0); BlocksDict.Add(bd.BlockNumber, bd); } catch { } } } catch (Exception e) { //Logger.Error("Ошибка при чтении файла настроек " + e, Logger.LoggerSource.server); } }