public void AddRowToTablePath(StrPathToExange _newStr) { Dispatcher.BeginInvoke(new ThreadStart(delegate { ArrayList _tableForm = (ArrayList)TableFilePath.Resources["teams"]; ((ArrayList)_tableForm).Add(_newStr); TableFilePath.Items.Refresh(); })); }
private void AddChartInGrid(int numRadChart, string _strNameExchange, string _strNameExchangeBack , string _strFilePath, string _strFilePathBack) { Dispatcher.BeginInvoke(new ThreadStart(delegate { string _elementName = "RadChart" + numRadChart.ToString(); RadChart _elementRadChart = FindElementRadChart(this.GridTable.Children, _elementName); Telerik.Windows.Controls.RadChart telerikChart = _elementRadChart; //добавление в Grid новой строки System.Windows.Controls.RowDefinition newRow = new System.Windows.Controls.RowDefinition(); GridLengthConverter myGridLengthConverter = new GridLengthConverter(); newRow.Height = (GridLength)myGridLengthConverter.ConvertFromString("*"); GridTable.RowDefinitions.Add(newRow); _elementRadChart.Visibility = System.Windows.Visibility.Visible; //- telerikChart.DefaultView.ChartTitle.HorizontalAlignment = HorizontalAlignment.Center; //Chart Legend telerikChart.DefaultView.ChartLegend.UseAutoGeneratedItems = true; //Line Chart telerikChart.DefaultView.ChartTitle.Content = _strNameExchange; // "Обмен " + _strNameExchange; //+" и " + _strNameExchangeBack; DataSeries lineSeries = new DataSeries(); lineSeries.LegendLabel = _strNameExchange; // "Обмен " + _strNameExchange; lineSeries.Definition = new LineSeriesDefinition(); telerikChart.DefaultView.ChartArea.DataSeries.Add(lineSeries); //Bar Chart DataSeries barSeries = new DataSeries(); barSeries.LegendLabel = _strNameExchangeBack; // "Обмен " + _strNameExchangeBack; barSeries.Definition = new LineSeriesDefinition(); telerikChart.DefaultView.ChartArea.DataSeries.Add(barSeries); })); StrPathToExange _newStr = new StrPathToExange(); _newStr._strNameExchange = _strNameExchange; _newStr._strNameExchangeBack = _strNameExchangeBack; _newStr._strFilePath = _strFilePath; _newStr._strFilePathBack = _strFilePathBack; if (FileChecker.Instance._filePathList == null) { FileChecker.Instance._filePathList = new List <StrPathToExange>(); } FileChecker.Instance._filePathList.Add(_newStr); FileChecker.Instance.CreateFileWatcher(); //CreateChart_DefaultView(); }
private void ButtonNewExcange_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.Title = "Выберите "; dlg.DefaultExt = ".zip"; dlg.Filter = "архивы|*.zip|xml-файлы|*.xml"; // Show open file dialog box Nullable <bool> result = dlg.ShowDialog(); // Открываем окно if (result != true) { return; } string _strFilePath = dlg.FileName; //присваиваем переменной путь к файлу int _lastChar = _strFilePath.LastIndexOf("\\"); string[] _ArrayPath = _strFilePath.Split(new Char[] { '\\' }); int _lastStr = _ArrayPath.Count(); String _strNameExchange = _ArrayPath[_lastStr - 1]; _strNameExchange = _strNameExchange.Substring(8, _strNameExchange.Length - 4 - 8); int _separator = _strNameExchange.LastIndexOf("_"); String _strNameExchangeBack = _strNameExchange.Substring(_separator + 1, _strNameExchange.Length - _separator - 1) + "_" + _strNameExchange.Substring(0, _separator); String _strFilePathBack = _strFilePath.Substring(0, _lastChar + 9) + _strNameExchangeBack + _strFilePath.Substring(_strFilePath.Length - 4, 4); _strNameExchange = _strNameExchange.Replace("_", "->"); _strNameExchangeBack = _strNameExchangeBack.Replace("_", "->"); ArrayList _tableForm = (ArrayList)TableFilePath.Resources["teams"]; StrPathToExange _newStr = new StrPathToExange(); _newStr._strNameExchange = _strNameExchange; _newStr._strNameExchangeBack = _strNameExchangeBack; _newStr._strFilePath = _strFilePath; _newStr._strFilePathBack = _strFilePathBack; AddRowToTablePath(_newStr); peremennye._tableFilePath.Add(_newStr); }
private void ButtonOfSettings_Click(object sender, RoutedEventArgs e) { Nullable <bool> result = new WindowSettings().ShowDialog(); if (result != true) { return; } //Максимальное количество точек //ButtonMaxCountPoint.Content = Peremennye.Instance._maxCountPoint.ToString(); foreach (UIElement _elementChildren in this.GridTable.Children) { if (_elementChildren.GetType().Name != "RadChart") { continue; } RadChart _elementRadChart = (RadChart)_elementChildren; foreach (DataSeries lineSeries in _elementRadChart.DefaultView.ChartArea.DataSeries) { DeletePointInChart(lineSeries); } } //- //Добавление-удаление графиков int _beginI = FileChecker.Instance._filePathList.Count; int _endI = Peremennye.Instance._tableFilePath.Count; for (int i = _beginI; i < _endI; i++) { int numRadChart = i; StrPathToExange _newStr = Peremennye.Instance._tableFilePath[i]; AddChartInGrid(numRadChart, _newStr._strNameExchange, _newStr._strNameExchangeBack, _newStr._strFilePath, _newStr._strFilePathBack); } }