private void InitializeSets(Dictionary <GrafType, GrafSet> grafSets) { grafSets.Clear(); var allGrafTypes = Assembly.GetAssembly(typeof(GrafSet)).GetTypes() .Where(t => typeof(GrafSet).IsAssignableFrom(t) && t.IsAbstract == false); foreach (var type in allGrafTypes) { GrafSet grafSet = Activator.CreateInstance(type) as GrafSet; grafSets.Add(grafSet.GrafType, grafSet); } }
public GrafViewModel(GrafSet grafSet, string cSvPath) { this.grafSet = grafSet; this.cSvPath = cSvPath; arSeries = this.grafSet.GetSettings(); SeriesCollection = new SeriesCollection(); Labels = new[] { System.DateTime.Now.ToString() }; YFormatter = value => value.ToString() + this.grafSet.unit; dataTable.Columns.Add("FirstValue"); dataTable.Columns.Add("SecondValue"); YaxesName = grafSet.yAxesName; YaxesMaxValue = grafSet.maxValue; XaxesName = grafSet.xAxesName; SeriesName = grafSet.seriesName; for (int i = 0; i < arSeries.Length; i++) { SeriesCollection.Add(arSeries[i].LineSeries); } ButtonChooseFile_1 = new RelayCommand(o => OpenFile_1("ReportsButton")); ButtonBuidGraf_1 = new RelayCommand(o => ShowFromCSV_1("ReportsButton")); ButtonChooseFile_2 = new RelayCommand(o => OpenFile_2("ReportsButton")); ButtonBuidGraf_2 = new RelayCommand(o => ShowFromCSV_2("ReportsButton")); ButtonBuildBack = new RelayCommand(o => BuildBack("ReportsButton")); var mapper = Mappers.Xy <MeasureModel>() .X(model => model.ValueX) .Y(model => model.ValueY); Charting.For <MeasureModel>(mapper); ChartValues = new ChartValues <MeasureModel>(); ListOfItemsOPC listOfItemsOPC = new ListOfItemsOPC(); OPC_UA = new OPC_UA_Client("192.168.1.17", 2000d, listOfItemsOPC.GetOPCitems()); //OPC_UA.ItemsChanged += OPC_UA_ItemsChanged; Messenger.Default.Register <GenerateReportsMessage>(this, GenerateReports); Messenger.Default.Register <SentModelName>(this, SetFileNameEnding); _ = Task(); }
public GrafViewModel(GrafSet grafSet, string cSvPath) { this.grafSet = grafSet; this.cSvPath = cSvPath; arSeries = this.grafSet.GetSettings(); SeriesCollection = new SeriesCollection(); Labels = new[] { System.DateTime.Now.ToString() }; YFormatter = value => value.ToString() + this.grafSet.unit; dataTable.Columns.Add("FirstValue"); dataTable.Columns.Add("SecondValue"); YaxesName = grafSet.yAxesName; YaxesMaxValue = grafSet.maxValue; XaxesName = grafSet.xAxesName; for (int i = 0; i < arSeries.Length; i++) { SeriesCollection.Add(arSeries[i].LineSeries); } ListOfItemsOPC listOfItemsOPC = new ListOfItemsOPC(); OPC_UA = new OPC_UA_Client("192.168.1.17", 2000d, listOfItemsOPC.GetOPCitems()); //OPC_UA.ItemsChanged += OPC_UA_ItemsChanged; Messenger.Default.Register <GenerateReportsMessage>(this, GenerateReports); _ = Task(); }
public ConturViewModel_1(GrafSet grafSet, string cSvPath) : base(grafSet, cSvPath) { }
public GrafPage(GrafSet grafSet /*, string yAxesName, string unit, double maxValue*/) { InitializeComponent(); SetSeries(grafSet); Chart_P.ZoomingSpeed = 0.7; Chart_P.DisableAnimations = true; csvDataTable = new DataTable(); dataset.Tables.Add(csvDataTable); SeriesCollection = new SeriesCollection(); Labels = new[] { System.DateTime.Now.ToString() }; YFormatter = value => value.ToString() + grafSet.unit; SetCheckBoxes(); for (int i = 0; i < arSeries.Length; i++) { textBoxes.Add(i, new TextBox()); textBoxes[i].HorizontalAlignment = HorizontalAlignment.Right; textBoxes[i].VerticalAlignment = VerticalAlignment.Top; } foreach (KeyValuePair <int, TextBox> keyValuePair in textBoxes) { this.grid.Children.Add(keyValuePair.Value); } for (int i = 0; i < arSeries.Length; i++) { labels.Add(i, new Label()); labels[i].HorizontalAlignment = HorizontalAlignment.Right; labels[i].VerticalAlignment = VerticalAlignment.Top; labels[i].Content = arSeries[i].Name; } foreach (KeyValuePair <int, Label> keyValuePair in labels) { this.grid.Children.Add(keyValuePair.Value); } double chartBottomMargin = Chart_P.Margin.Bottom; double lebelHight = 0d; for (int i = 0; i < arSeries.Length; i++) { labelsMin.Add(i, new Label()); labelsMin[i].HorizontalAlignment = HorizontalAlignment.Right; labelsMin[i].VerticalAlignment = VerticalAlignment.Bottom; labelsMin[i].Content = arSeries[i].Name; lebelHight = labelsMin[i].ActualHeight; textBoxesMin.Add(i, new TextBox()); textBoxesMin[i].HorizontalAlignment = HorizontalAlignment.Right; textBoxesMin[i].VerticalAlignment = VerticalAlignment.Bottom; } foreach (KeyValuePair <int, TextBox> keyValuePair in textBoxesMin) { this.grid.Children.Add(keyValuePair.Value); } foreach (KeyValuePair <int, Label> keyValuePair in labelsMin) { this.grid.Children.Add(keyValuePair.Value); } SetArrays(); comboBoxHourStart.ItemsSource = hours; comboBoxHourEnd.ItemsSource = hours; comboBoxMinuteStart.ItemsSource = minutes; comboBoxMinuteEnd.ItemsSource = minutes; Chart_P.Zoom = ZoomingOptions.Y; DataContext = this; PickerDataStop.SelectedDateChanged += PickerDataStop_SelectedDateChanged; pickedData.SelectedDateChanged += PickedData_SelectedDateChanged; this.grid.PreviewMouseRightButtonDown += Grid_PreviewMouseRightButtonDown; this.grid.PreviewMouseRightButtonUp += Grid_PreviewMouseRightButtonUp; this.Loaded += GrafPage_Loaded; GrafPage.SelectedDateStartChanged += GrafPage_SelectedDateStartChanged; GrafPage.SelectedDateStopChanged += GrafPage_SelectedDateStopChanged; comboBoxHourStart.SelectionChanged += ComboBoxHourStart_SelectionChanged; comboBoxHourEnd.SelectionChanged += ComboBoxHourEnd_SelectionChanged; comboBoxMinuteStart.SelectionChanged += ComboBoxMinuteStart_SelectionChanged; comboBoxMinuteEnd.SelectionChanged += ComboBoxMinuteEnd_SelectionChanged; GrafPage.SelectedHourStartChanged += GrafPage_SelectedHourStartChanged; GrafPage.SelectedHourEndChanged += GrafPage_SelectedHourEndChanged; GrafPage.SelectedMinuteStartChanged += GrafPage_SelectedMinuteStartChanged; GrafPage.SelectedMinuteEndChanged += GrafPage_SelectedMinuteEndChanged; }
protected virtual void SetSeries(GrafSet grafSet) { arSeries = grafSet.GetSettings();//new GrafSeries[] { }; chartAxisY.Title = grafSet.yAxesName; chartAxisY.MaxValue = grafSet.maxValue; }
//OPC_UA_Client OPC_UA; public CycleForceGrafViewModel(GrafSet grafSet, string cSvPath) : base(grafSet, cSvPath) { }
public LineForceGrafViewModel_1(GrafSet grafSet, string cSvPath, ushort procNomber) : base(grafSet, cSvPath) { this.procNomber = procNomber; }
public LineForceGrafViewModel_2(GrafSet grafSet, string cSvPath) : base(grafSet, cSvPath) { }