예제 #1
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/WebControl;component/MainPage.xaml", System.UriKind.Relative));
     this.LayoutRoot               = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.dockManager              = ((DevExpress.Xpf.Docking.DockLayoutManager)(this.FindName("dockManager")));
     this.mainPanel                = ((DevExpress.Xpf.Docking.LayoutPanel)(this.FindName("mainPanel")));
     this.navBarGroup1             = ((DevExpress.Xpf.NavBar.NavBarGroup)(this.FindName("navBarGroup1")));
     this.navAngidritCommon        = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navAngidritCommon")));
     this.navAngidritZVGU2Ag1      = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navAngidritZVGU2Ag1")));
     this.navAngidritZVGU2Ag2      = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navAngidritZVGU2Ag2")));
     this.navAngidritHeater        = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navAngidritHeater")));
     this.navAngidritNPS1Hot       = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navAngidritNPS1Hot")));
     this.navAngidritNPS1Cold      = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navAngidritNPS1Cold")));
     this.navAngidritNPS2Hot       = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navAngidritNPS2Hot")));
     this.navAngidritNPS2Cold      = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navAngidritNPS2Cold")));
     this.navAngidritPumping       = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navAngidritPumping")));
     this.navAngidritVVU2Motor     = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navAngidritVVU2Motor")));
     this.navAngidritVVU2Heater    = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navAngidritVVU2Heater")));
     this.navAngidritASOP          = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navAngidritASOP")));
     this.navAngidritRP552         = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navAngidritRP552")));
     this.navAngidritRP553         = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navAngidritRP553")));
     this.navAngidritRP554         = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navAngidritRP554")));
     this.navAngidritMTB           = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navAngidritMTB")));
     this.navServiceInfo           = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navServiceInfo")));
     this.navNetwork               = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navNetwork")));
     this.navAngidritASUTPNetwork  = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navAngidritASUTPNetwork")));
     this.navAdministrationNetwork = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navAdministrationNetwork")));
     this.navAngidritNetwork       = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navAngidritNetwork")));
     this.navKayerkanskiyNetwork   = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navKayerkanskiyNetwork")));
     this.navKURNetwork            = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navKURNetwork")));
     this.navRockyNetwork          = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navRockyNetwork")));
     this.navLimeNetwork           = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navLimeNetwork")));
     this.navBarGroup2             = ((DevExpress.Xpf.NavBar.NavBarGroup)(this.FindName("navBarGroup2")));
     this.navDevelop               = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navDevelop")));
     this.navTest           = ((DevExpress.Xpf.NavBar.NavBarItem)(this.FindName("navTest")));
     this.documentContainer = ((DevExpress.Xpf.Docking.DocumentGroup)(this.FindName("documentContainer")));
 }
예제 #2
0
        public Graphs(DevExpress.Xpf.NavBar.NavBarGroup inputData)
        {
            PointsCollectionForGraphs = new ObservableCollection <ObservableCollection <myPoint> >();
            //PointsCollectionForGraphs.Add(new ObservableCollection<myPoint>());

            //MKIO_visual.Graphs.Graphs myGraph = new Graphs.Graphs(filteredData[(o as MKIO_visual.Graphs.GraphOptions).ChooseFilter.SelectedIndex], (o as MKIO_visual.Graphs.GraphOptions).numberSD.SelectedIndex);
            //((sender as GridControl).View as TableView).GetSelectedCells().Count
            int mask = 0;

            int[] byteWord = new int[16];

            int    numBits   = 0;
            double CHSR      = 0;
            double tempValue = 0;
            int    sdvig     = 0;

            //if (((inputData.Items[0] as GraphOptions).MKIO_word_table.View as DevExpress.Xpf.Grid.TableView).GetSelectedCells().Count != 0)
            //{
            //    for (int j = 0; j < ((inputData.Items[0] as GraphOptions).MKIO_word_table.View as DevExpress.Xpf.Grid.TableView).GetSelectedCells().Count; j++)
            //    {
            //        byteWord[15 - int.Parse(((inputData.Items[0] as GraphOptions).MKIO_word_table.View as DevExpress.Xpf.Grid.TableView).GetSelectedCells()[j].Column.FieldName)] = 1;
            //        sdvig = 15 - int.Parse(((inputData.Items[0] as GraphOptions).MKIO_word_table.View as DevExpress.Xpf.Grid.TableView).GetSelectedCells()[j].Column.FieldName);
            //    }
            //    for (int i = 0; i < 16; i++)
            //    {
            //        mask += byteWord[i] * (int)Math.Pow(2, i);
            //    }
            //    //CHSR = (double.Parse((inputData.Items[0] as GraphOptions).cena_mlad.Text) / Math.Pow(2, 15 - (inputData.Items[0] as GraphOptions).number_razr - 4)) * Math.Pow(2,((inputData.Items[0] as GraphOptions).MKIO_word_table.View as DevExpress.Xpf.Grid.TableView).GetSelectedCells().Count - 1);
            //    numBits = ((inputData.Items[0] as GraphOptions).MKIO_word_table.View as DevExpress.Xpf.Grid.TableView).GetSelectedCells().Count;
            //}
            //else
            //{
            //    mask = 0xFFFF;
            //    //CHSR = (double.Parse((inputData.Items[0] as GraphOptions).cena_mlad.Text) / Math.Pow(2, 15 - (inputData.Items[0] as GraphOptions).number_razr - 4)) * Math.Pow(2, 15);
            //    numBits = 16;
            //}
            ////MessageBox.Show(mask.ToString());
            ////((inputData.Items[0] as GraphOptions).MKIO_word_table.View as DevExpress.Xpf.Grid.TableView).GetSelectedCells();
            //if ((inputData.Items[0] as GraphOptions).checked_1_word.IsChecked == true)
            //{
            //    CHSR = (double.Parse((inputData.Items[0] as GraphOptions).cena_mlad.Text) / Math.Pow(2, 15 - ((inputData.Items[0] as GraphOptions).number_razr - 4 + sdvig))) * Math.Pow(2, numBits - 1);
            //    foreach (MKIO_visual.MKIO.MKIO_PACK_CLI_EXT o in MKIO_visual.Table.myTable.filteredData[(inputData.Items[0] as GraphOptions).ChooseFilter.SelectedIndex].MKIO_REG)
            //    {
            //        if ((inputData.Items[0] as GraphOptions).znak.Content.ToString() == "Беззнаковое")
            //            tempValue = MKIO_visual.ConvertExt.LibConvert.UnpackUINT32toDouble((UInt32)((o.MKIO_PACK.Data[(inputData.Items[0] as GraphOptions).numberSD.SelectedIndex] & mask) >> sdvig), CHSR, (UInt16)(numBits));
            //        else
            //        {
            //            if (numBits == 0 || numBits == 16)
            //                tempValue = MKIO_visual.ConvertExt.LibConvert.UnpackINT32toDouble(ConvertExt.LibConvert.UInt16TOInt16((UInt16)(o.MKIO_PACK.Data[(inputData.Items[0] as GraphOptions).numberSD.SelectedIndex])), CHSR, (UInt16)(numBits));
            //            else
            //                tempValue = MKIO_visual.ConvertExt.LibConvert.UnpackINT32toDouble(ConvertExt.LibConvert.UInt32ToInt32((UInt32)((o.MKIO_PACK.Data[(inputData.Items[0] as GraphOptions).numberSD.SelectedIndex] & mask) >> sdvig)), CHSR, (UInt16)(numBits));
            //        }
            //        PointsCollectionForGraphs[0].Add(new myPoint((o.MKIO_PACK.time_IRQ - Table.myTable.monitorData.MKIO_REG[0].MKIO_PACK.time_IRQ) / 1000.0, tempValue));

            //    }
            //}
            //else if ((inputData.Items[0] as GraphOptions).checked_2_word.IsChecked == true)
            //{
            //    CHSR = (double.Parse((inputData.Items[0] as GraphOptions).cena_mlad.Text) / Math.Pow(2, 15 - ((inputData.Items[0] as GraphOptions).number_razr - 4))) * Math.Pow(2, 16 - 1);
            //    foreach (MKIO_visual.MKIO.MKIO_PACK_CLI_EXT o in MKIO_visual.Table.myTable.filteredData[(inputData.Items[0] as GraphOptions).ChooseFilter.SelectedIndex].MKIO_REG)
            //    {
            //        if ((inputData.Items[0] as GraphOptions).znak.Content.ToString() == "Беззнаковое")
            //            tempValue = MKIO_visual.ConvertExt.LibConvert.UnpackUINT32toDouble((UInt32)((o.MKIO_PACK.Data[(inputData.Items[0] as GraphOptions).numberSD.SelectedIndex] << numBits) + ((o.MKIO_PACK.Data[(inputData.Items[0] as GraphOptions).numberSD.SelectedIndex + 1] & mask) >> sdvig)), CHSR, (UInt16)(numBits+16));
            //        else
            //            tempValue = MKIO_visual.ConvertExt.LibConvert.UnpackINT32toDouble(ConvertExt.LibConvert.UInt32ToInt32((UInt32)((o.MKIO_PACK.Data[(inputData.Items[0] as GraphOptions).numberSD.SelectedIndex] << numBits) + ((o.MKIO_PACK.Data[(inputData.Items[0] as GraphOptions).numberSD.SelectedIndex + 1] & mask) >> sdvig))), CHSR, (UInt16)(numBits + 16));
            //        PointsCollectionForGraphs[0].Add(new myPoint((o.MKIO_PACK.time_IRQ - Table.myTable.monitorData.MKIO_REG[0].MKIO_PACK.time_IRQ) / 1000.0, tempValue));

            //    }
            //}
            InitializeComponent();
            if (Properties.Settings.Default.GraphsPosition != Rect.Empty)
            {
                this.SetBounds(Properties.Settings.Default.GraphsPosition);
            }
            if (Properties.Settings.Default.GraphsMaximized == true)
            {
                WindowState = WindowState.Maximized;
            }
            //Graph1Lines.DisplayName = (inputData.Items[0] as GraphOptions).NameOfGraph.Text.ToString();//"Название линии";
            //Graph1Name.Content = (inputData.Items[0] as GraphOptions).NameOfGraph.Text.ToString();
            //Graph1Lines.DataSource = PointsCollectionForGraphs[0];
            string xaml = @"<ItemsPanelTemplate   xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
                            <Grid>                            
                                <Grid.RowDefinitions>
                                   <RowDefinition Height='1*'/>";

            //             <RowDefinition Height='1*'/>
            //             <RowDefinition Height='1.2*'/>
            //         </Grid.RowDefinitions >
            //      </Grid >
            //</ItemsPanelTemplate > ";


            for (int i = 0; i < inputData.Items.Count - 1; i++)
            {
                mask      = 0;
                sdvig     = 0;
                numBits   = 0;
                tempValue = 0;
                byteWord  = new int[16];
                if (((inputData.Items[i] as GraphOptions).MKIO_word_table.View as DevExpress.Xpf.Grid.TableView).GetSelectedCells().Count != 0)
                {
                    for (int j = 0; j < ((inputData.Items[i] as GraphOptions).MKIO_word_table.View as DevExpress.Xpf.Grid.TableView).GetSelectedCells().Count; j++)
                    {
                        byteWord[15 - int.Parse(((inputData.Items[i] as GraphOptions).MKIO_word_table.View as DevExpress.Xpf.Grid.TableView).GetSelectedCells()[j].Column.FieldName)] = 1;
                        sdvig = 15 - int.Parse(((inputData.Items[i] as GraphOptions).MKIO_word_table.View as DevExpress.Xpf.Grid.TableView).GetSelectedCells()[j].Column.FieldName);
                    }
                    for (int k = 0; k < 16; k++)
                    {
                        mask += byteWord[k] * (int)Math.Pow(2, k);
                    }
                    numBits = ((inputData.Items[i] as GraphOptions).MKIO_word_table.View as DevExpress.Xpf.Grid.TableView).GetSelectedCells().Count;
                }
                else
                {
                    mask    = 0xFFFF;
                    numBits = 16;
                }
                PointsCollectionForGraphs.Add(new ObservableCollection <myPoint>());
                if ((inputData.Items[i] as GraphOptions).cena_mlad.Text.Contains("."))
                {
                    (inputData.Items[i] as GraphOptions).cena_mlad.Text = (inputData.Items[i] as GraphOptions).cena_mlad.Text.Replace(".", ",");
                }
                if ((inputData.Items[i] as GraphOptions).checked_1_word.IsChecked == true)
                {
                    CHSR = (double.Parse((inputData.Items[i] as GraphOptions).cena_mlad.Text) / Math.Pow(2, 15 - ((inputData.Items[i] as GraphOptions).number_razr - 4 + sdvig))) * Math.Pow(2, numBits - 1);
                    foreach (MKIO_visual.MKIO.MKIO_PACK_CLI_EXT o in MKIO_visual.Table.myTable.filteredData[(inputData.Items[i] as GraphOptions).ChooseFilter.SelectedIndex].MKIO_REG)
                    {
                        if ((inputData.Items[i] as GraphOptions).znak.Content.ToString() == "Беззнаковое")
                        {
                            tempValue = MKIO_visual.ConvertExt.LibConvert.UnpackUINT32toDouble((UInt32)((o.MKIO_PACK.Data[(inputData.Items[i] as GraphOptions).numberSD.SelectedIndex] & mask) >> sdvig), CHSR, (UInt16)(numBits));
                        }
                        else
                        {
                            if (numBits == 0 || numBits == 16)
                            {
                                tempValue = MKIO_visual.ConvertExt.LibConvert.UnpackINT32toDouble(ConvertExt.LibConvert.UInt16TOInt16((UInt16)(o.MKIO_PACK.Data[(inputData.Items[i] as GraphOptions).numberSD.SelectedIndex])), CHSR, (UInt16)(numBits));
                            }
                            else
                            {
                                tempValue = MKIO_visual.ConvertExt.LibConvert.UnpackINT32toDouble(ConvertExt.LibConvert.UInt32ToInt32((UInt32)((o.MKIO_PACK.Data[(inputData.Items[i] as GraphOptions).numberSD.SelectedIndex] & mask) >> sdvig)), CHSR, (UInt16)(numBits));
                            }
                        }
                        PointsCollectionForGraphs[i].Add(new myPoint((o.MKIO_PACK.time_IRQ - Table.myTable.monitorData.MKIO_REG[0].MKIO_PACK.time_IRQ) / 1000000.0, tempValue));
                    }
                }
                else if ((inputData.Items[i] as GraphOptions).checked_2_word.IsChecked == true)
                {
                    CHSR = (double.Parse((inputData.Items[i] as GraphOptions).cena_mlad.Text) / Math.Pow(2, 15 - ((inputData.Items[i] as GraphOptions).number_razr - 4))) * Math.Pow(2, 16 - 1);
                    foreach (MKIO_visual.MKIO.MKIO_PACK_CLI_EXT o in MKIO_visual.Table.myTable.filteredData[(inputData.Items[i] as GraphOptions).ChooseFilter.SelectedIndex].MKIO_REG)
                    {
                        if ((inputData.Items[i] as GraphOptions).znak.Content.ToString() == "Беззнаковое")
                        {
                            tempValue = MKIO_visual.ConvertExt.LibConvert.UnpackUINT32toDouble((UInt32)((o.MKIO_PACK.Data[(inputData.Items[i] as GraphOptions).numberSD.SelectedIndex] << numBits) + ((o.MKIO_PACK.Data[(inputData.Items[i] as GraphOptions).numberSD.SelectedIndex + 1] & mask) >> sdvig)), CHSR, (UInt16)(numBits + 16));
                        }
                        else
                        {
                            tempValue = MKIO_visual.ConvertExt.LibConvert.UnpackINT32toDouble(((Int32)(ConvertExt.LibConvert.UInt16TOInt16((UInt16)(o.MKIO_PACK.Data[(inputData.Items[i] as GraphOptions).numberSD.SelectedIndex])) << numBits) | ((o.MKIO_PACK.Data[(inputData.Items[i] as GraphOptions).numberSD.SelectedIndex + 1] & mask) >> sdvig)), CHSR, (UInt16)(numBits + 16));
                        }
                        PointsCollectionForGraphs[i].Add(new myPoint((o.MKIO_PACK.time_IRQ - Table.myTable.monitorData.MKIO_REG[0].MKIO_PACK.time_IRQ) / 1000000.0, tempValue));
                    }
                }
                if (i == 0)
                {
                    Graph1Lines.DisplayName = (inputData.Items[0] as GraphOptions).NameOfGraph.Text.ToString();//"Название линии";
                    Graph1Name.Content      = (inputData.Items[0] as GraphOptions).NameOfGraph.Text.ToString();
                    Graph1Lines.DataSource  = PointsCollectionForGraphs[0];
                    if (GraphicsCollection.AxisY.ActualWholeRange.ActualMinValueInternal == 0)
                    {
                        GraphicsCollection.AxisY.ActualWholeRange.SetMinMaxValues(0 - (GraphicsCollection.AxisY.ActualWholeRange.ActualMaxValueInternal * 0.1), GraphicsCollection.AxisY.ActualWholeRange.ActualMaxValueInternal);
                    }
                    if (inputData.Items.Count - 1 == 1)
                    {
                        VisibilityFirstGraph.Visible = true;
                    }
                }
                else
                {
                    if (i != (inputData.Items.Count - 2))
                    {
                        xaml += @"<RowDefinition Height='1*'/>";
                        GraphicsCollection.Panes.Add(new DevExpress.Xpf.Charts.Pane()
                        {
                            EnableAxisXNavigation = true, EnableAxisYNavigation = false, AxisXScrollBarOptions = new DevExpress.Xpf.Charts.ScrollBarOptions()
                            {
                                Visible = false
                            }
                        });
                        Grid.SetRow(GraphicsCollection.Panes[GraphicsCollection.Panes.Count - 1], i);
                        myAxisX.VisibilityInPanes.Add(new DevExpress.Xpf.Charts.VisibilityInPane()
                        {
                            Pane = GraphicsCollection.Panes[i - 1], Visible = false
                        });
                    }
                    else
                    {
                        xaml += @"<RowDefinition Height='1.4*'/>";
                        GraphicsCollection.Panes.Add(new DevExpress.Xpf.Charts.Pane()
                        {
                            EnableAxisXNavigation = true, EnableAxisYNavigation = false, AxisXScrollBarOptions = new DevExpress.Xpf.Charts.ScrollBarOptions()
                            {
                                Visible = true
                            }
                        });
                        Grid.SetRow(GraphicsCollection.Panes[GraphicsCollection.Panes.Count - 1], i);
                        myAxisX.VisibilityInPanes.Add(new DevExpress.Xpf.Charts.VisibilityInPane()
                        {
                            Pane = GraphicsCollection.Panes[i - 1], Visible = true
                        });
                    }
                    GraphicsCollection.SecondaryAxesY.Add(new DevExpress.Xpf.Charts.SecondaryAxisY2D()
                    {
                        Alignment = DevExpress.Xpf.Charts.AxisAlignment.Near, Title = new DevExpress.Xpf.Charts.AxisTitle()
                        {
                            Content = (inputData.Items[i] as GraphOptions).NameOfGraph.Text
                        }, GridLinesVisible = true, GridLinesMinorVisible = true
                    });
                    GraphicsCollection.Series.Add(new DevExpress.Xpf.Charts.LineStepSeries2D()
                    {
                        DisplayName = (inputData.Items[i] as GraphOptions).NameOfGraph.Text, ArgumentDataMember = "X", ValueDataMember = "Y", DataSource = PointsCollectionForGraphs[i]                                                                         /*, CrosshairLabelPattern = " {S} - Время: {A} сек - {V}"*/
                    });
                    DevExpress.Xpf.Charts.XYDiagram2D.SetSeriesPane((DevExpress.Xpf.Charts.XYSeries)GraphicsCollection.Series[i], GraphicsCollection.Panes[i - 1]);
                    DevExpress.Xpf.Charts.XYDiagram2D.SetSeriesAxisY(((DevExpress.Xpf.Charts.XYSeries)GraphicsCollection.Series[i]), GraphicsCollection.SecondaryAxesY[i - 1]);
                    if (GraphicsCollection.SecondaryAxesY[i - 1].ActualWholeRange.ActualMinValueInternal == 0)
                    {
                        GraphicsCollection.SecondaryAxesY[i - 1].ActualWholeRange.SetMinMaxValues(0 - (GraphicsCollection.SecondaryAxesY[i - 1].ActualWholeRange.ActualMaxValueInternal * 0.1), GraphicsCollection.SecondaryAxesY[i - 1].ActualWholeRange.ActualMaxValueInternal);
                    }
                }
            }

            GraphicsCollection.ShowCrosshair(new Point(0.1, 1));
            xaml += @"</Grid.RowDefinitions >
                               </Grid >
                       </ItemsPanelTemplate > ";
            GraphicsCollection.PanesPanel = (System.Windows.Markup.XamlReader.Parse(xaml) as ItemsPanelTemplate);


            //PointsCollectionForGraphs[0].Add(new MKIO_visual.Graphs.myPoint(0, 0));
        }