duheng
2024-10-14 3b08b5c772ffc0c10644c1aaa9f7b2447582c858
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
using DevExpress.CodeParser;
using HStation.WinFrmUI.PhartRelation;
using System;
using Yw.WinFrmUI.Phart;
 
namespace HStation.WinFrmUI
{
    public partial class PumpFullInfoCtrl : DevExpress.XtraEditors.XtraUserControl
    {
        #region 构造函数和加载函数
 
        public PumpFullInfoCtrl()
        {
            InitializeComponent();
            System.Windows.Forms.Form.CheckForIllegalCrossThreadCalls = false;
            this.navBarControlPara.GroupExpanded += new DevExpress.XtraNavBar.NavBarGroupEventHandler(this.NavBarControlPara_GroupExpanded);
            this.navBarControlPara.GroupCollapsed += new DevExpress.XtraNavBar.NavBarGroupEventHandler(this.NavBarControlPara_GroupCollapsed);
            this.navBarControlPara.ClientSizeChanged += new System.EventHandler(this.NavBarControlPara_ClientSizeChanged);
        }
 
        private PumpMatchingViewModel _pump_mathing_vm = null;
        public void SetBindingData(PumpMatchingViewModel pumpMatchingViewModel)
        {
            _pump_mathing_vm = pumpMatchingViewModel;
            pumpPropViewCtrl1.SetBindingData(pumpMatchingViewModel.DbId);
 
            if (long.TryParse(_pump_mathing_vm.DbId,out long pump_mian_id))
            { 
                Init(pump_mian_id);
            } 
        }
 
 
        private async void Init(long pump_main_id)
        {
            var pump_main = await new BLL.AssetsPumpMain().GetByID(pump_main_id);
            if (pump_main == null)
            {
                return;
            }
 
            var phart_list = await new BLL.XhsPumpMainPhartMappingExtensions().GetByPumpMainID(pump_main_id);
            if (phart_list == null || !phart_list.Any())
            {
                return;
            }
            var phart = phart_list.OrderBy(x => x.Importance).First();
 
 
            var diagram = phart.Diagram;
            if (diagram == null)
            {
                return;
            }
            var graph_list = diagram.GraphList;
            if (graph_list == null || !graph_list.Any())
            {
                return;
            }
 
            var graph_qh = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQH);
            var graph_qe = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQE);
            var graph_qp = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQP);
 
            if (graph_qh == null)
            {
                return;
            }
 
            List<Yw.Geometry.Point2d> points_qh = null, points_qe = null, points_qp = null;
            points_qh = PhartPerformCurveHelper.GetFeatPointList(graph_qh.GraphType, graph_qh.GeometryInfo, 12, null);
            if (graph_qe != null)
                points_qe = PhartPerformCurveHelper.GetFeatPointList(graph_qe.GraphType, graph_qe.GeometryInfo, 12, null);
            if (graph_qp != null)
                points_qp = PhartPerformCurveHelper.GetFeatPointList(graph_qp.GraphType, graph_qp.GeometryInfo, 12, null);
 
            var cubic_spline_qh = new Yw.Geometry.CubicSpline2d(points_qh);
            var cubic_spline_qe = new Yw.Geometry.CubicSpline2d(points_qe);
            var cubic_spline_qp = new Yw.Geometry.CubicSpline2d(points_qp);
             
 
            var design_pt = new Yw.Geometry.Point2d();
            design_pt.X = Math.Round(cubic_spline_qh.MaxX / 2);
            design_pt.Y = Math.Round(cubic_spline_qh.GetPointY(design_pt.X), 1);
             
 
            var disp_paras = diagram.DispParas;
            var is_calc_disp_paras = string.IsNullOrWhiteSpace(disp_paras);
            this.pumpPerformChart1.SetBindingData(cubic_spline_qh, cubic_spline_qe, cubic_spline_qp, disp_paras, is_calc_disp_paras);
            this.pumpPerformInfoCtrl1.SetDesignPoint(design_pt);
 
            var vm_vs = new Yw.WinFrmUI.Phart.PumpVariableSpeedViewModel();
            vm_vs.Id = phart.ID.ToString();
            vm_vs.Name = $"{pump_main.RatedSpeed}";
            //vm.IsBp = pump_mian.;
            vm_vs.RatedSpeed = pump_main.RatedSpeed;
            vm_vs.CurrentSpeed = pump_main.RatedSpeed;
            vm_vs.CurrentHz = 50;
            vm_vs.Qh = cubic_spline_qh;
            vm_vs.Qe = cubic_spline_qe;
            vm_vs.Qp = cubic_spline_qp; 
 
            var vm_vs_info = new Yw.WinFrmUI.Phart.PumpVariableSpeedInfoViewModel(vm_vs);
            vm_vs_info.Color = Color.Black;
            vm_vs_info.IsDefault = true;
            this.pumpVariableSpeedInfoCtrl1.SetBindingData(vm_vs_info, design_pt);
            this.pumpVariableSpeedChart1.Add(vm_vs_info, design_pt);
 
 
            var vm_sp = new Yw.WinFrmUI.Phart.PumpSerialParallelViewModel();
            vm_sp.Id = phart.ID.ToString();
            vm_sp.Name = $"{pump_main.RatedSpeed}";
            //vm.IsBp = pump_mian.;
            vm_sp.RatedSpeed = pump_main.RatedSpeed;
            vm_sp.CurrentSpeed = pump_main.RatedSpeed;
            vm_sp.CurrentHz = 50;
            vm_sp.Qh = cubic_spline_qh;
            vm_sp.Qe = cubic_spline_qe;
            vm_sp.Qp = cubic_spline_qp;
 
            var vm_sp_info = new Yw.WinFrmUI.Phart.PumpSerialParallelInfoViewModel(vm_sp);
            vm_sp_info.Color = GetRandomColor(0);
            this.pumpSingleSerialParallelInfoCtrl1.SetBindingData(vm_sp_info, design_pt);
            this.pumpSerialParallelChart1.Add(vm_sp_info, design_pt);
        }
 
  
 
        private void OnFrmLoad(object sender, EventArgs e)
        {
            //
            InitialPropPanelWidth();
 
            this.splitContainerControl1.SplitterPositionChanged += new System.EventHandler(this.splitContainerControl1_SplitterPositionChanged);
 
            //
            SetCtrlStyle();
 
            //detailInfoTreeTab2Ctrl1.Initial();
 
            this.xtraTabCtrlMain.SelectedTabPageIndex = 0;
            this.xtraTabCtrlMain.SelectedTabPage = this._tabPage性能曲线图1;
 
            CalcBarHeight();
 
            //if (this._m3dDispCtrlType == Model.e3dDispCtrlType.BIM_EvTreeJs)
            //{
            //    if (this._bimWebBrowerContainter != null)
            //    {
            //        //this.xtraTabCtrlMain.SelectedTabPage = this._tabPage三维模型;
            //        this._bimWebBrowerContainter.Dock = DockStyle.Fill;
            //        this._bimWebBrowerContainter.IsActiveBrower();
            //        this._tabPage三维模型.Controls.Add(_bimWebBrowerContainter);
            //    }
            //}
            //else if (this._m3dDispCtrlType == Model.e3dDispCtrlType.CAD_3DShowShow)
            //{
            //}
            //else if (this._m3dDispCtrlType == Model.e3dDispCtrlType.CAD_51JM)
            //{
            //}
            InitChart();
        }
 
        private void SetChart(PumpMatchingViewModel vm)
        {
            if (vm == null)
            {
                return;
            } 
 
        }
 
        private void InitChart()
        {
            #region 曲线
 
            this.pumpPerformInfoCtrl1.SetDesignPointEvent += (q, h) =>
            {
                this.pumpPerformChart1.CalcDesignPointByQ(q, h);
            };
            this.pumpPerformChart1.OnCalcQueryPoint += (gropu_pt) =>
            {
                var vm_list = new List<Yw.WinFrmUI.Phart.PumpPointItmeViewModel>();
                vm_list.Add(new Yw.WinFrmUI.Phart.PumpPointItmeViewModel()
                {
                    Group = "查询点",
                    Name = "流量",
                    Value = $"{gropu_pt.Q:N1}",
                    Unit = "m³/h"
                });
 
                vm_list.Add(new Yw.WinFrmUI.Phart.PumpPointItmeViewModel()
                {
                    Group = "查询点",
                    Name = "扬程",
                    Value = $"{gropu_pt.H:N1}",
                    Unit = "m"
                });
 
                vm_list.Add(new Yw.WinFrmUI.Phart.PumpPointItmeViewModel()
                {
                    Group = "查询点",
                    Name = "效率",
                    Value = $"{gropu_pt.E:N1}",
                    Unit = "%"
                });
 
                vm_list.Add(new Yw.WinFrmUI.Phart.PumpPointItmeViewModel()
                {
                    Group = "查询点",
                    Name = "功率",
                    Value = $"{gropu_pt.P:N1}",
                    Unit = "kW"
                });
 
                this.pumpPerformInfoCtrl1.SetBindingData(vm_list);
            };
 
            #endregion
 
            #region 变速曲线
 
            this.pumpVariableSpeedInfoCtrl1.SetEvent += (id, qh, qe, qp) =>
            {
                this.pumpVariableSpeedChart1.Set(id, qh, qe, qp);
                ResetSectPointGrid();
            };
 
            this.pumpVariableSpeedInfoCtrl1.SetInfoEvent += (id, name, color) =>
            {
                this.pumpVariableSpeedChart1.SetInfo(id, name, color);
                ResetSectPointGrid();
            };
 
            this.pumpVariableSpeedChart1.AddBySpeedEvent += () =>
            {
                AddBySpeed();
                ResetSectPointGrid();
            };
 
            this.pumpVariableSpeedChart1.AddByHzEvent += () =>
            {
                AddByHz();
                ResetSectPointGrid();
            };
 
            this.pumpVariableSpeedChart1.AddByPointEvent += () =>
            {
                AddByPoint();
                ResetSectPointGrid();
            };
 
            this.pumpVariableSpeedInfoCtrl1.SetDesignPointEvent += (q, h) =>
            {
                this.pumpVariableSpeedChart1.SetDesignPt(new Yw.Geometry.Point2d(q, h));
                ResetSectPointGrid();
            };
 
            this.pumpVariableSpeedChart1.OnCalcQueryPoint += (id, pt) =>
            {
                this.pumpVariableSpeedInfoCtrl1.SetQueryInfo(id, pt);
            };
 
 
            void ResetSectPointGrid()
            {
                var vm_list = this.pumpVariableSpeedChart1.GetList();
                this.pumpVariableSpeedInfoCtrl1.SetSectPoint(vm_list);
            }
 
            void AddBySpeed()
            {
 
                var list = this.pumpVariableSpeedInfoCtrl1.GetList();
                if (list == null || list.Count < 1)
                {
                    return;
                }
                var design_pt = this.pumpVariableSpeedInfoCtrl1.GetDesignPoint();
                var index = list.Count;
                var vm_def = list.First();
                var dlg = new SetValueDlg();
                dlg.SetBindingData(vm_def.RatedSpeed);
                dlg.VerifyValueChanged += (speed) =>
                {
                    var hz = Math.Round(speed / vm_def.RatedSpeed * 50, 1);
                    if (hz > 50 || hz < 10)
                    {
                        return false;
                    }
                    var vm = new PumpVariableSpeedInfoViewModel(vm_def);
                    vm.Id = Guid.NewGuid().ToString();
                    vm.Name = this.pumpVariableSpeedChart1.LineNameShowHz ? hz.ToString() : speed.ToString();
                    vm.Color = GetRandomColor(index);
                    vm.CurrentHz = hz;
                    vm.CurrentSpeed = speed;
                    vm.Calc();
 
                    this.pumpVariableSpeedInfoCtrl1.Add(vm);
                    this.pumpVariableSpeedChart1.Add(vm, design_pt);
 
                    return true;
                };
                dlg.ShowDialog();
 
            }
 
            void AddByHz()
            {
 
                var list = this.pumpVariableSpeedInfoCtrl1.GetList();
                if (list == null || list.Count < 1)
                {
                    return;
                }
 
                var design_pt = this.pumpVariableSpeedInfoCtrl1.GetDesignPoint();
                var index = list.Count;
                var vm_def = list.First();
                var dlg = new SetValueDlg();
                dlg.VerifyValueChanged += (hz) =>
                {
                    if (hz > 50 || hz < 10)
                    {
                        return false;
                    }
                    var speed = Math.Round(hz / 50 * vm_def.RatedSpeed);
                    var vm = new PumpVariableSpeedInfoViewModel(vm_def);
                    vm.Id = Guid.NewGuid().ToString();
                    vm.Name = this.pumpVariableSpeedChart1.LineNameShowHz ? hz.ToString() : speed.ToString();
                    vm.Color = GetRandomColor(index);
                    vm.CurrentHz = hz;
                    vm.CurrentSpeed = speed;
                    vm.Calc();
 
                    this.pumpVariableSpeedInfoCtrl1.Add(vm);
                    this.pumpVariableSpeedChart1.Add(vm, design_pt);
 
                    return true;
                };
                dlg.ShowDialog();
            }
 
            void AddByPoint()
            {
                var list = this.pumpVariableSpeedInfoCtrl1.GetList();
                if (list == null || list.Count < 1)
                {
                    return;
                }
                var index = list.Count;
                var vm_def = list.First();
                var design_pt = this.pumpVariableSpeedInfoCtrl1.GetDesignPoint();
                var dlg = new SetPointDlg();
                dlg.SetBindingData();
                dlg.VerifyValueChanged += (x, y) =>
                {
                    var pt = new Yw.Geometry.Point2d(x, y);
                    var speed = PumpCalcHelper.GetSimuValue(vm_def.Qh, pt, vm_def.RatedSpeed);
                    var hz = Math.Round(speed / vm_def.RatedSpeed * 50, 1);
                    if (hz > 50 || hz < 20)
                    {
                        return false;
                    }
                    var vm = new PumpVariableSpeedInfoViewModel(vm_def);
                    vm.Id = Guid.NewGuid().ToString();
                    vm.Name = this.pumpVariableSpeedChart1.LineNameShowHz ? hz.ToString() : speed.ToString();
                    vm.Color = GetRandomColor(index);
                    vm.CurrentHz = hz;
                    vm.CurrentSpeed = speed;
                    vm.Calc();
 
                    this.pumpVariableSpeedInfoCtrl1.Add(vm);
                    this.pumpVariableSpeedChart1.Add(vm, design_pt);
                    return true;
                };
                dlg.ShowDialog();
            }
 
 
            #endregion
 
            #region 串并联曲线
 
            string _serial_parallel_id = "serial_parallel";
 
            this.pumpSingleSerialParallelInfoCtrl1.SetEvent += (id, design_pt, is_parallel, qh, qe, qp) =>
            {
                this.pumpSerialParallelChart1.Set(id, qh, qe, qp);
                var list = this.pumpSingleSerialParallelInfoCtrl1.GetList();
                SetSerialParallel(list, design_pt, is_parallel);
            };
 
            this.pumpSingleSerialParallelInfoCtrl1.SetInfoEvent += (id, name, color) =>
            {
                this.pumpSerialParallelChart1.SetInfo(id, name, color);
            };
 
            this.pumpSingleSerialParallelInfoCtrl1.SetDesignPointEvent += (q, h) =>
            {
                this.pumpSerialParallelChart1.SetDesignPt(new Yw.Geometry.Point2d(q, h));
            };
            this.pumpSingleSerialParallelInfoCtrl1.ResetEvent += (type, count) =>
            {
                if (count<1)
                {
                    return;
                }
                var is_parallel = type == 0;
                var list = this.pumpSingleSerialParallelInfoCtrl1.GetList();
                var first = list.First();
                var new_list = new List<Yw.WinFrmUI.Phart.PumpSerialParallelInfoViewModel>();
                for (int i = 0; i <count; i++)
                {
                    var vm = new Yw.WinFrmUI.Phart.PumpSerialParallelInfoViewModel(first);
                    vm.Id = Guid.NewGuid().ToString();
                    vm.Color = GetRandomColor(i);
                    vm.CurrentSpeed = vm.RatedSpeed;
                    vm.CurrentHz = 50;
                    vm.Calc();
                    new_list.Add(vm); 
                }
                var design_pt = this.pumpSingleSerialParallelInfoCtrl1.GetDesignPoint();
                this.pumpSingleSerialParallelInfoCtrl1.SetBindingData(new_list,design_pt);
                this.pumpSerialParallelChart1.Add(new_list, design_pt);
                SetSerialParallel(new_list, design_pt, is_parallel); 
            };
 
            this.pumpSerialParallelChart1.OnCalcQueryPoint += (id, pt) =>
            {
                this.pumpSingleSerialParallelInfoCtrl1.SetQueryInfo(id, pt);
            };
 
            string SetSerialParallel(List<Yw.WinFrmUI.Phart.PumpSerialParallelInfoViewModel> list, Yw.Geometry.Point2d design_pt, bool is_parallel)
            {
                this.pumpSerialParallelChart1.Delete(_serial_parallel_id);
                if (list == null || !list.Any())
                {
                    return "无数据!";
                }
                if (list.Count<2)
                {
                    return "数据过少!";
                }
                var vm_serial_parallel = CalcSerialParallel(list, is_parallel);
                if (vm_serial_parallel == null)
                {
                    return "无法计算串并联曲线!";
                }
 
                var qh = vm_serial_parallel.Qh;
                var min_h = qh.GetPointY(qh.MinX);
                var max_h = qh.GetPointY(qh.MaxX);
                //if (design_pt != null)
                //{
                //    //if (design_pt.X > qh.MaxX || design_pt.X < qh.MinX)
                //    //{
                //    //    return "设计流量无效!";
                //    //}
 
                //    //if (design_pt.Y > max_h * 2 || design_pt.Y < min_h * 0.5)
                //    //{
                //    //    return "设计扬程无效!";
                //    //}
                //}
                //else
                //{
                //    var design_q = qh.MaxX / 2;
                //    var design_h = qh.GetPointY(design_q);
                //    design_q = Math.Round(design_q, 1);
                //    design_h = Math.Round(design_h, 1);
                //    design_pt = new Yw.Geometry.Point2d(design_q, design_h);
                //    this.pumpSingleSerialParallelInfoCtrl1.SetDesignPoint(design_pt);
                //}
 
                this.pumpSerialParallelChart1.Add(vm_serial_parallel, design_pt);
                return string.Empty;
            }
 
            Yw.WinFrmUI.Phart.PumpSerialParallelInfoViewModel CalcSerialParallel(List<Yw.WinFrmUI.Phart.PumpSerialParallelInfoViewModel> list, bool is_parallel)
            {
                if (list == null || !list.Any())
                {
                    return default;
                }
 
                var calc_bol = false;
                var line_name = "";
                List<Yw.Geometry.Point2d> calc_pt_qh_list;
                List<Yw.Geometry.Point2d> calc_pt_qe_list;
                List<Yw.Geometry.Point2d> calc_pt_qp_list;
 
                var helper = new Yw.WinFrmUI.Phart.PumpParallelConnectionHelper();
                list.ForEach(x => helper.Add(x.QhCalc, x.QpCalc));
                if (is_parallel)
                {
                    line_name = "并联曲线";
                    calc_bol = helper.CalculateParallel(out calc_pt_qh_list, out calc_pt_qe_list, out calc_pt_qp_list);
                }
                else
                {
                    line_name = "串联曲线";
                    calc_bol = helper.CalculateSeries(out calc_pt_qh_list, out calc_pt_qe_list, out calc_pt_qp_list);
                }
 
                if (!calc_bol)
                {
                    return default;
                }
 
                var vm_sp = new Yw.WinFrmUI.Phart.PumpSerialParallelInfoViewModel();
                vm_sp.Id = _serial_parallel_id;
                vm_sp.Name = line_name;
                vm_sp.Qh = new Yw.Geometry.CubicSpline2d(calc_pt_qh_list);
                vm_sp.Qe = new Yw.Geometry.CubicSpline2d(calc_pt_qe_list);
                vm_sp.Qp = new Yw.Geometry.CubicSpline2d(calc_pt_qp_list);
                vm_sp.QhCalc = vm_sp.Qh;
                vm_sp.QeCalc = vm_sp.Qe;
                vm_sp.QpCalc = vm_sp.Qp;
                vm_sp.Color = Color.Black;
                vm_sp.IsBp = true;
                vm_sp.IsDefault = true;
                return vm_sp;
            }
 
            #endregion
 
        }
 
        #region Color
 
        private List<Color> _color_array = new List<Color>()
        {
            Color.Red, Color.Blue, Color.Green,Color.DodgerBlue,
            Color.Fuchsia, Color.MidnightBlue,  Color.Maroon, Color.Aquamarine,
            Color.Bisque,Color.BurlyWood
        };
 
        /// <summary>
        /// 获取随机颜色
        /// </summary>
        /// <returns></returns>
        private Color GetRandomColor(int count)
        {
            if (count < _color_array.Count)
            {
                return _color_array[count];
            }
 
            var _random = new Random();
            int r = _random.Next(1, 256);
            int g = _random.Next(1, 256);
            int b = _random.Next(1, 256);
            return Color.FromArgb(r, g, b);
        }
 
        #endregion
 
        #region 走马灯提示
 
        private bool _isShowRollTipText = false;
        private Thread tRollTipText = null;
        private DevExpress.XtraEditors.LabelControl labelControlTip;
 
        /// <summary>
        /// 开始走马灯提示
        /// </summary>
        protected void StartRollTipText(string info)
        {
            if (string.IsNullOrEmpty(info))
                return;
 
            if (this.labelControlTip == null)
            {
                this.labelControlTip = new DevExpress.XtraEditors.LabelControl();
 
                this.labelControlTip.Appearance.BackColor = System.Drawing.Color.White;
                this.labelControlTip.Appearance.ForeColor = System.Drawing.Color.Red;
                this.labelControlTip.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.None;
                this.labelControlTip.Dock = System.Windows.Forms.DockStyle.Top;
                this.labelControlTip.Location = new System.Drawing.Point(0, 0);
                this.labelControlTip.Name = "labelControlTip";
                this.labelControlTip.Padding = new System.Windows.Forms.Padding(30, 0, 0, 0);
                this.labelControlTip.Size = new System.Drawing.Size(1069, 26);
                this.labelControlTip.TabIndex = 12;
                this.labelControlTip.Text = "labelControlTip";
                this.Controls.Add(this.labelControlTip);
            }
            else
            {
                labelControlTip.Visible = true;
            }
            this.labelControlTip.Text = string.Format("    {0}            {0}     ", info);
            if (tRollTipText != null)
            {
                // tRollTipText.Abort();
            }
            _isShowRollTipText = true;
            labelControlTip.Visible = true;
            tRollTipText = new Thread(new ThreadStart(ShowRollTipText));
            tRollTipText.Start();
        }
 
        /// <summary>
        /// 开始走马灯提示
        /// </summary>
        protected void HideRollTipText()
        {
            if (_isShowRollTipText == false)
                return;
            labelControlTip.Visible = false;
            _isShowRollTipText = false;
            if (tRollTipText != null)
            {
                // tRollTipText.Abort();
                tRollTipText = null;
            }
        }
 
        private void ShowRollTipText()
        {
            if (labelControlTip == null)
                return;
 
            Action fun = () =>
            {
                labelControlTip.Text = labelControlTip.Text.Substring(labelControlTip.Text.Length - 1) + labelControlTip.Text.Substring(0, labelControlTip.Text.Length - 1);
            };
            while (true)
            {
                if (labelControlTip.InvokeRequired)
                {
                    labelControlTip.Invoke(fun);
                }
                Thread.Sleep(300);
            }
        }
 
        #endregion 走马灯提示
 
 
 
        public void CloseFrm()
        {
            if (tRollTipText != null)
            {
                // tRollTipText.Abort();
                tRollTipText = null;
            }
        }
 
        private void SetCtrlStyle()
        {
            //this.xtraTabCtrlMain.AppearancePage.HeaderActive.ForeColor = CorpSkinStyleHelper.SkinMainColor;
            //this.xtraTabCtrlMain.AppearancePage.Header.ForeColor = Color.Gray;
            //this.xtraTabCtrlMain.AppearancePage.HeaderActive.Options.UseForeColor = true;
            //this.xtraTabCtrlMain.AppearancePage.Header.Options.UseForeColor = true;
            //if (SPump.WinFrmUI.Localization.IsCN)
            //{
            //    this.xtraTabCtrlMain.AppearancePage.Header.Font = new System.Drawing.Font("楷体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            //    this.xtraTabCtrlMain.AppearancePage.Header.Options.UseFont = true;
            //    this.xtraTabCtrlMain.AppearancePage.HeaderActive.Font = new System.Drawing.Font("黑体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            //    //System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
            //    this.xtraTabCtrlMain.AppearancePage.HeaderActive.Options.UseFont = true;
            //}
 
            //this.xtraTabCtrlMain.AppearancePage.Header.Font = new System.Drawing.Font("Tahoma", 12F);
            //this.xtraTabCtrlMain.AppearancePage.Header.ForeColor = System.Drawing.Color.Gray;
            //this.xtraTabCtrlMain.AppearancePage.Header.Options.UseFont = true;
            //this.xtraTabCtrlMain.AppearancePage.Header.Options.UseForeColor = true;
            //this.xtraTabCtrlMain.AppearancePage.Header.Options.UseTextOptions = true;
            //this.xtraTabCtrlMain.AppearancePage.Header.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //this.xtraTabCtrlMain.AppearancePage.HeaderActive.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            //this.xtraTabCtrlMain.AppearancePage.HeaderActive.ForeColor = System.Drawing.Color.Navy;
            //this.xtraTabCtrlMain.AppearancePage.HeaderActive.Options.UseFont = true;
            //this.xtraTabCtrlMain.AppearancePage.HeaderActive.Options.UseForeColor = true;
            //this.xtraTabCtrlMain.AppearancePage.HeaderActive.Options.UseTextOptions = true;
            //this.xtraTabCtrlMain.AppearancePage.HeaderActive.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
        }
 
        #endregion 构造函数和加载函数
 
        private void tabPage默认安装图2d_VisibleChanged(object sender, EventArgs e)
        {
        }
 
        private void tabPage系统安装图2d_VisibleChanged(object sender, EventArgs e)
        {
        }
 
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void xtraTabControlRight_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e)
        {
            if (e.Page == this._tabPage多速度曲线参数)
            {
                xtraTabCtrlMain.SelectedTabPage = this._tabPage多速度曲线;
            }
        }
 
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void xtraTabCtrlMain_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e)
        {
            this._tabPage串并联曲线参数.PageVisible = false;
 
            //
            if (e.Page == this._tabPage三维模型)
            {
            }
            if (e.Page == this._tabPage默认安装图3d)
            {
                //if (this.tabPageAssem3D.Tag == null)
                //{
                //    ShowProductDrawing3d();
                //    this.tabPageAssem3D.Tag = "IsLoad";
                //}
            }
            if (e.Page == this._tabPage多速度曲线)
            {
                this.xtraTabControlRight.SelectedTabPage = this._tabPage多速度曲线参数;
            }
            if (e.Page == this._tabPage串并联曲线)
            {
                this._tabPage串并联曲线参数.PageVisible = true;
                this.xtraTabControlRight.SelectedTabPage = this._tabPage串并联曲线参数;
            }
            if (e.Page == this._tabPage性能曲线图1)
            {
                this.xtraTabControlRight.SelectedTabPage = this.tabPage基本参数;
            }
        }
 
        #region 计算展示面板高度
 
        private void NavBarControlPara_GroupExpanded(object sender, DevExpress.XtraNavBar.NavBarGroupEventArgs e)
        {
            CalcBarHeight();
        }
 
        private void NavBarControlPara_GroupCollapsed(object sender, DevExpress.XtraNavBar.NavBarGroupEventArgs e)
        {
            CalcBarHeight();
        }
 
        private void NavBarControlPara_ClientSizeChanged(object sender, EventArgs e)
        {
            CalcBarHeight();
        }
 
        private int CalcGroupParaHeight()
        {
            //if (this._selectMainParasCtrl == null)
            //{
            //    return 4 * 35 + 20;
            //}
            var row_count = 4;// this._selectMainParasCtrl.GetDispRowCount();
            if (row_count <= 4)//切割型
                return row_count * 35 + 20;
            else
                return row_count * 35 + 20;
        }
 
        private void CalcBarHeight()
        {
            //if (!navBarGroupPoint.Expanded)
            //    return;
 
            //int GroupTitleHeight = 55;//头部高度
 
            //var height = this.Size.Height - 18;//18 : TAB 头部高度
 
            //if (navBarGroupPara.Expanded)
            //{
            //    var grp_height = CalcGroupParaHeight();
            //    //if (row_count == 7)
            //    //{
            //    //    grp_height = 280;
            //    //}
            //    this.navBarGroupControlXPumpParas.Height = grp_height;
            //    this.navBarGroupPara.Expanded = true;
            //    this.navBarGroupPara.GroupClientHeight = grp_height;
            //    height = height - GroupTitleHeight - grp_height - 3;
            //}
            //else
            //{
            //    height = height - GroupTitleHeight;
            //}
 
            //if (navBarGroupJieZhi.Expanded)
            //{
            //    height = height - 150;
            //}
            //else
            //{
            //    height = height - GroupTitleHeight;
            //}
 
            //if (height > 100)
            //{//294, 393
            //    height = height - GroupTitleHeight;
            //    navBarGroupPoint.GroupClientHeight = height;
            //}
        }
 
        #endregion 计算展示面板高度
 
        #region 右侧面板宽度
 
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void splitContainerControl1_SplitterPositionChanged(object sender, EventArgs e)
        {
        }
 
        /// <summary>
        ///
        /// </summary>
        private void InitialPropPanelWidth()
        {
            ////宽度
            //if (SPump.WinFrmUI.XPump.Properties.Settings.Default.EbookPropPanelWidth > 0)
            //{
            //    splitContainerControl1.SplitterPosition = SPump.WinFrmUI.XPump.Properties.Settings.Default.EbookPropPanelWidth;
            //    return;
            //}
 
            //////设置面板宽度//当前是1150 -> 430
            //int iActulaWidth = this.Width;
            //if (SPump.WinFrmUI.GlobeParas.MainForm != null)
            //{
            //    iActulaWidth = SPump.WinFrmUI.GlobeParas.MainForm.Width;
            //}
 
            //splitContainerControl1.SplitterPosition = (int)(iActulaWidth * 0.35);
        }
 
        #endregion 右侧面板宽度
    }
}