tangxu
2024-05-08 02a032030f8fe8acfece20e1ddb37cdc9426e808
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
using System;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using DevExpress.LookAndFeel;
using DevExpress.Tutorials.Controls;
using DevExpress.Utils;
using DevExpress.XtraBars.Ribbon;
using DevExpress.XtraBars.Ribbon.Gallery;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using DevExpress.Utils.Taskbar;
using DevExpress.XtraSplashScreen;
using DevExpress.Skins;
using DevExpress.Utils.Colors;
using DevExpress.XtraEditors.ColorWheel;
using DevExpress.XtraEditors.Popup;
using System.Collections.Generic;
using DevExpress.Utils.Helpers;
using DevExpress.XtraPrinting;
using System.Drawing.Imaging;
using System.Drawing.Printing;
using DevExpress;
using DevExpress.XtraBars;
using DevExpress.XtraBars.Ribbon;
using Hydro.MapView;
 
 
namespace Hydro.WinfrmUI.Viewer
{
    public partial class frmMain : DevExpress.XtraBars.Ribbon.RibbonForm
    { 
        public frmMain()
        {
            InitializeComponent();
 
 
  
            UserLookAndFeel.Default.SetSkinStyle("Office 2019 Colorful");
            Icon = DevExpress.Utils.ResourceImageHelper.CreateIconFromResourcesEx("Hydro.WinfrmUI.Viewer.AppIcon.ico", typeof(frmMain).Assembly);
            this.recentLabelItem2.Caption = AssemblyInfo.AssemblyCopyright;
        }
 
        private void frmMain_Load(object sender, System.EventArgs e)
        { 
            ribbonControl1.ForceInitialize();
            //GalleryDropDown skins = new GalleryDropDown();
            //skins.Ribbon = ribbonControl1;
            //DevExpress.XtraBars.Helpers.SkinHelper.InitSkinGalleryDropDown(skins);
            //iPaintStyle.DropDownControl = skins;
            CreateNewDocument(@"D:\WorkData\YiWei\Hydro\Hydro.V1.1\out\xiaofang.inp");
        }
 
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            SplashScreenManager.CloseForm(false);
        }
 
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);
        }
 
 
 
 
        int documentIndex = 0;
 
 
        GalleryItem fCurrentFontItem, fCurrentColorItem;
 
        void CreateNewDocument()
        {
            CreateNewDocument(null);
        }
 
        public void ShowHideFormatCategory()
        {
            RibbonPageCategory selectionCategory = Ribbon.PageCategories[0] as RibbonPageCategory;
            if (selectionCategory == null) return;
 
            if (selectionCategory.Visible) Ribbon.SelectedPage = selectionCategory.Pages[0];
        }
        void CreateNewDocument(string fileName)
        {
            if (string.IsNullOrEmpty(fileName))
            {
                return;
            }
 
            documentIndex++;
            frmDoc pad = new frmDoc();
 
 
            var viewer = pad.LoadDocument(fileName);
            if (viewer == null)
            {
                return;
            }
            viewer.OnChangeMonseClickPostion += (x, y, posi) =>
            {
                label_mouse.Caption = $"X£º{x.ToString("0")} Y£º{y.ToString("0")} [Map]X£º{posi.X.ToString("0.00")} Y£º{posi.Y.ToString("0.00")}";
            };
            viewer.OnChangeViewCenter += (posi) =>
            {
                label_center.Caption = $"center£º({posi.X.ToString("0.00")} £¬{posi.Y.ToString("0.00")}£©";
            };
            viewer.OnChangeViewZoom += (zoom) =>
            {
                label_zoom.Caption = $"Zoom£º{zoom.ToString("0.000")}";
            };
            viewer.OnChangeViewOrtho += (bol) =>
            {
                label_ZZ.Checked = bol;
                //if (mapOption.IsOrtho)
                //{
                //    label_ZZ.Text = "Õý½»Ä£Ê½:¿ª";
                //}
                //else
                //{
                //    label_ZZ.Text = "Õý½»Ä£Ê½:¹Ø";
                //}
            };
            viewer.OnChangeViewRotation += (r1, r2) =>
            {
                label_rotation.Caption = $"Rotation£º({r1.ToString("0")}£¬{r2.ToString("0")})";
            };
 
 
            pad.MdiParent = this;
 
            pad.Closed += new EventHandler(Pad_Closed);
 
            pad.Show();
        }
 
        void pad_ShowMiniToolbar(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(((RichTextBox)sender).SelectedText))
                return;
            ShowSelectionMiniToolbar();
        }
 
        void Pad_Closed(object sender, EventArgs e)
        {
            CloseFind();
        }
        void Pad_ShowPopupMenu(object sender, EventArgs e)
        {
            pmMain.RibbonToolbar = selectionMiniToolbar;
            pmMain.ShowPopup(Control.MousePosition);
        }
        void CloseFind()
        {
 
        }
 
 
        #region Init
        private void frmMain_Activated(object sender, System.EventArgs e)
        {
            InitDocument();
        }
 
        void ChangeActiveForm()
        {
            CloseFind();
        }
        private void xtraTabbedMdiManager1_FloatMDIChildActivated(object sender, EventArgs e)
        {
            ChangeActiveForm();
        }
        private void xtraTabbedMdiManager1_FloatMDIChildDeactivated(object sender, EventArgs e)
        {
            BeginInvoke(new MethodInvoker(ChangeActiveForm));
        }
        private void frmMain_MdiChildActivate(object sender, System.EventArgs e)
        {
            ChangeActiveForm();
        }
 
        private void InitDocument()
        {
 
        }
 
        protected virtual void ShowSelectionMiniToolbar()
        {
            Point pt = Control.MousePosition;
            pt.Offset(0, -11);
            selectionMiniToolbar.Alignment = ContentAlignment.TopRight;
            selectionMiniToolbar.PopupMenu = null;
            selectionMiniToolbar.Show(pt);
        }
 
 
 
 
 
 
 
 
 
        void InitCurrentDocument(RichTextBox rtbControl)
        {
            bool _enabled = rtbControl != null;
            iSaveAs.Enabled = _enabled;
            iOpenByEpa.Enabled = _enabled;
 
            sbiSave.Enabled = _enabled; 
            iFind.Enabled = _enabled; 
        }
 
 
        #endregion
        #region Properties
        frmDoc CurrentForm
        {
            get
            {
                if (this.ActiveMdiChild == null) return null;
                if (xtraTabbedMdiManager1.ActiveFloatForm != null)
                    return xtraTabbedMdiManager1.ActiveFloatForm as frmDoc;
                return this.ActiveMdiChild as frmDoc;
            }
        }
 
 
 
 
        #endregion
        #region File
        void idNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            CreateNewDocument();
        }
 
        void iOpenByEpa_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            // Process.Start(@"epanetH\Epanet2wH.exe", _filePath);
        }
        private void iClear_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (CurrentForm != null) CurrentForm.Close();
        }
 
 
        public void OpenFile(string name)
        {
            CreateNewDocument(name);  
        }
 
 
        bool CheckForOverlap(RecentPinItem pinItem, RecentItemCollection recentItemCollection)
        {
            foreach (RecentItemBase item in recentItemCollection)
            {
                RecentPinItem pItem = item as RecentPinItem;
                if (pItem != null && pinItem.Caption == pItem.Caption && pinItem.Description == pItem.Description)
                    return true;
            }
            return false;
        }
 
 
        void iOpen_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.Filter = "INP Files (*.inp)|*.inp|All Files (*.*)|*.*";
            if (this.CurrentForm == null)
                return;
            this.CurrentForm.GetBrowser().OpenFile(openFileDialog.FileName);
        }
 
 
 
        void iSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Save();
        }
        void iSaveAs_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            SaveAs();
        }
        void Save()
        {
            if (CurrentForm == null)
                return;
            CurrentForm.GetBrowser().Save ( );
        }
 
        void SaveAs()
        {
            if (CurrentForm == null)
                return;
 
            SaveFileDialog saveFileDialog = new SaveFileDialog();
            saveFileDialog.Filter = "Inp Files (*.inp)|*.inp";
            saveFileDialog.InitialDirectory = Directory.GetCurrentDirectory() + $@"\template\";
 
            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                string filePath = saveFileDialog.FileName;
                CurrentForm.GetBrowser().SaveAs(filePath);
            }
 
        }
        private void bbiÒÔµ±Ç°ÊÓ½ÇÁí´æ_ItemClick(object sender, ItemClickEventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();
            saveFileDialog.Filter = "Inp Files (*.inp)|*.inp";
            saveFileDialog.InitialDirectory = Directory.GetCurrentDirectory() + $@"\template\";
            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                string filePath = saveFileDialog.FileName;
                CurrentForm.GetBrowser().SaveAsByView(filePath);
            }
        }
 
        private void iExit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Close();
        }
        private void frmMain_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
        }
        private void ribbonPageGroup1_CaptionButtonClick(object sender, DevExpress.XtraBars.Ribbon.RibbonPageGroupEventArgs e)
        {
 
        }
 
        private void ribbonPageGroup9_CaptionButtonClick(object sender, DevExpress.XtraBars.Ribbon.RibbonPageGroupEventArgs e)
        {
            SaveAs();
        }
        #endregion
 
        #region Ë¢ÐÂ, ÉÏÒ»²½, ÏÂÒ»²½
        private void iUndo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            CurrentForm.GetBrowser().Undo();
        }
 
        private void iRedo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            CurrentForm.GetBrowser().Redo();
        }
 
        private void bbiË¢ÐÂ_ItemClick(object sender, ItemClickEventArgs e)
        {
            CurrentForm.GetBrowser().Redo();
        }
 
        private void ribbonPageGroup2_CaptionButtonClick(object sender, DevExpress.XtraBars.Ribbon.RibbonPageGroupEventArgs e)
        {
            pmMain.ShowPopup(ribbonControl1.Manager, MousePosition);
        }
        #endregion
 
 
 
 
        private void iAbout_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            BarManager.About();
        }
 
 
        #region GalleryItemsChecked
 
        GalleryItem GetColorItemByColor(Color color, BaseGallery gallery)
        {
            foreach (GalleryItemGroup galleryGroup in gallery.Groups)
                foreach (GalleryItem item in galleryGroup.Items)
                    if (item.Caption == color.Name)
                        return item;
            return null;
        }
        GalleryItem GetFontItemByFont(string fontName, BaseGallery gallery)
        {
            foreach (GalleryItemGroup galleryGroup in gallery.Groups)
                foreach (GalleryItem item in galleryGroup.Items)
                    if (item.Caption == fontName)
                        return item;
            return null;
        }
        GalleryItem CurrentFontItem
        {
            get { return fCurrentFontItem; }
            set
            {
                if (fCurrentFontItem == value) return;
                if (fCurrentFontItem != null) fCurrentFontItem.Checked = false;
                fCurrentFontItem = value;
                if (fCurrentFontItem != null)
                {
                    fCurrentFontItem.Checked = true;
                    MakeFontVisible(fCurrentFontItem);
                }
            }
        }
        void MakeFontVisible(GalleryItem item)
        {
            gddFont.Gallery.MakeVisible(fCurrentFontItem);
            rgbiFont.Gallery.MakeVisible(fCurrentFontItem);
        }
        GalleryItem CurrentColorItem
        {
            get { return fCurrentColorItem; }
            set
            {
                if (fCurrentColorItem == value) return;
                if (fCurrentColorItem != null) fCurrentColorItem.Checked = false;
                fCurrentColorItem = value;
                if (fCurrentColorItem != null)
                {
                    fCurrentColorItem.Checked = true;
                    MakeColorVisible(fCurrentColorItem);
                }
            }
        }
        void MakeColorVisible(GalleryItem item)
        {
            gddFontColor.Gallery.MakeVisible(fCurrentColorItem);
            rgbiFontColor.Gallery.MakeVisible(fCurrentColorItem);
        }
        void CurrentFontChanged()
        {
 
        }
        private void gddFont_Popup(object sender, System.EventArgs e)
        {
 
        }
 
        private void gddFontColor_Popup(object sender, System.EventArgs e)
        {
            MakeColorVisible(CurrentColorItem);
        }
        #endregion
     
        
        #region MostRecentFiles
 
 
        private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
        {
 
        }
 
 
        public void InitFiles(string fileName, string defaultItem, bool isFile)
        {
            if (!System.IO.File.Exists(fileName))
            {
                StartInitFiles(isFile);
                EndInitFiles(isFile);
                //InsertElement(defaultItem, isFile);
                return;
            }
            System.IO.StreamReader sr = System.IO.File.OpenText(fileName);
            List<string> list = new List<string>();
            for (string s = sr.ReadLine(); s != null; s = sr.ReadLine())
                list.Add(s);
            for (int i = 0; i < list.Count; i++)
            {
                InsertElement(list[i], isFile);
            }
            sr.Close();
            if (!isFile) CreateButtonBrowse();
        }
 
        int FindFirstUnCheckedIntemIndex(RecentPanelBase recentPanelBase)
        {
            for (int i = 0; i < recentPanelBase.Items.Count; i++)
            {
                RecentPinItem pinItem = recentPanelBase.Items[i] as RecentPinItem;
                if (pinItem == null) continue;
                if (!pinItem.PinButtonChecked) return i;
            }
            return 0;
        }
        void InsertElement(object obj, bool isFile)
        {
            string[] names = obj.ToString().Split(',');
            string _name = names[0];
            bool checkedLabel = false;
            if (names.Length > 1) checkedLabel = names[1].ToLower().Equals("true");
            if (isFile)
            {
                RecentPinItem pinItem = new RecentPinItem() { Caption = GetFileName(_name), Description = _name, PinButtonChecked = checkedLabel };
                recentTabItem1.TabPanel.Items.Add(pinItem);
            }
            else
            {
                RecentPinItem pinItem = new RecentPinItem() { Caption = GetFileName(_name), Description = _name, PinButtonChecked = checkedLabel };
                RecentPinItem pinItem_ = new RecentPinItem() { Caption = GetFileName(_name), Description = _name, PinButtonChecked = checkedLabel };
                recentTabItem2.TabPanel.Items.Add(pinItem);
                recentTabItem3.TabPanel.Items.Add(pinItem_);
            }
        }
        void CreateButtonBrowse()
        {
            RecentHyperlinkItem hyperlinkBrowse = new RecentHyperlinkItem() { Caption = "Browse..."/*, Link = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) */};
            recentTabItem2.TabPanel.Items.Add(hyperlinkBrowse);
            hyperlinkBrowse.ItemClick += hyperlinkBrowse_ItemClick;
            RecentHyperlinkItem hyperlinkBrowse1 = new RecentHyperlinkItem() { Caption = "Browse..."/*, Link = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) */};
            recentTabItem3.TabPanel.Items.Add(hyperlinkBrowse1);
            hyperlinkBrowse1.ItemClick += hyperlinkBrowse_ItemClick;
        }
 
        void hyperlinkBrowse_ItemClick(object sender, RecentItemEventArgs e)
        {
            SaveAs();
        }
        private void EndInitFiles(bool isFile)
        {
            if (isFile) InitDefaultFiles();
            else InitDefaultFolders();
            if (!isFile) CreateButtonBrowse();
        }
        private void StartInitFiles(bool isFile)
        {
            if (!isFile) InitStartDefaultFolders();
        }
        private void InitStartDefaultFolders()
        {
            RecentPinItem desktop = new RecentPinItem() { Caption = "Desktop", Description = Environment.GetFolderPath(Environment.SpecialFolder.Desktop).ToString(), PinButtonChecked = true, ShowDescription = false };
            RecentPinItem desktop_ = new RecentPinItem() { Caption = "Desktop", Description = Environment.GetFolderPath(Environment.SpecialFolder.Desktop).ToString(), PinButtonChecked = true, ShowDescription = false };
            recentTabItem2.TabPanel.Items.Add(desktop);
            recentTabItem3.TabPanel.Items.Add(desktop_);
            RecentSeparatorItem separator = new RecentSeparatorItem();
            RecentSeparatorItem separator_ = new RecentSeparatorItem();
            recentTabItem2.TabPanel.Items.Add(separator);
            recentTabItem3.TabPanel.Items.Add(separator_);
        }
        private void InitDefaultFolders()
        {
            RecentPinItem item1 = new RecentPinItem() { Caption = "MyDocuments", Description = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).ToString() };
            RecentPinItem item1_ = new RecentPinItem() { Caption = "MyDocuments", Description = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).ToString() };
            recentTabItem2.TabPanel.Items.Add(item1);
            recentTabItem3.TabPanel.Items.Add(item1_);
 
            RecentPinItem item7 = new RecentPinItem() { Caption = "Saved HTML Articles", Description = "D:\\Personal\\Saved HTML Articles" };
            RecentPinItem item7_ = new RecentPinItem() { Caption = "Saved HTML Articles", Description = "D:\\Personal\\Saved HTML Articles" };
            recentTabItem2.TabPanel.Items.Add(item7);
            recentTabItem3.TabPanel.Items.Add(item7_);
 
            RecentPinItem item3 = new RecentPinItem() { Caption = "Tutorials", Description = "C:\\Program Files x86\\DevExpress 15.2\\Tutorials" };
            RecentPinItem item3_ = new RecentPinItem() { Caption = "Tutorials", Description = "C:\\Program Files x86\\DevExpress 15.2\\Tutorials" };
            recentTabItem2.TabPanel.Items.Add(item3);
            recentTabItem3.TabPanel.Items.Add(item3_);
 
            RecentPinItem item2 = new RecentPinItem() { Caption = "Products", Description = "C:\\DevExpress\\Products" };
            RecentPinItem item2_ = new RecentPinItem() { Caption = "Products", Description = "C:\\DevExpress\\Products" };
            recentTabItem2.TabPanel.Items.Add(item2);
            recentTabItem3.TabPanel.Items.Add(item2_);
 
            RecentPinItem item8 = new RecentPinItem() { Caption = "Win Forms", Description = "C:\\DevExpress\\Products\\Win Forms" };
            RecentPinItem item8_ = new RecentPinItem() { Caption = "Win Forms", Description = "C:\\DevExpress\\Products\\Win Forms" };
            recentTabItem2.TabPanel.Items.Add(item8);
            recentTabItem3.TabPanel.Items.Add(item8_);
 
            RecentPinItem item9 = new RecentPinItem() { Caption = "Controls", Description = "C:\\DevExpress\\Products\\Win Forms\\Controls" };
            RecentPinItem item9_ = new RecentPinItem() { Caption = "Controls", Description = "C:\\DevExpress\\Products\\Win Forms\\Controls" };
            recentTabItem2.TabPanel.Items.Add(item9);
            recentTabItem3.TabPanel.Items.Add(item9_);
        }
        private void InitDefaultFiles()
        {
            RecentPinItem item1 = new RecentPinItem() { Caption = "Windows 10 GuideLines.doc", Description = "D:\\Personal\\Saved HTML Articles" };
            recentTabItem1.TabPanel.Items.Add(item1);
            RecentPinItem item2 = new RecentPinItem() { Caption = "Web Site Usability.doc", Description = "C:\\Users\\Default\\Documents" };
            recentTabItem1.TabPanel.Items.Add(item2);
            RecentPinItem item3 = new RecentPinItem() { Caption = "Getting Started.pdf", Description = "C:\\Program Files x86\\DevExpress 15.2\\Tutorials" };
            recentTabItem1.TabPanel.Items.Add(item3);
            RecentPinItem item4 = new RecentPinItem() { Caption = "Office 2013 features.docx", Description = "C:\\DevExpress\\Products\\Win Forms" };
            recentTabItem1.TabPanel.Items.Add(item4);
            RecentPinItem item5 = new RecentPinItem() { Caption = "WinForms Webinar.pdf", Description = "C:\\DevExpress\\Webinars" };
            recentTabItem1.TabPanel.Items.Add(item5);
        }
        string GetFileName(object obj)
        {
            FileInfo fi = new FileInfo(obj.ToString());
            return fi.Name;
        }
        void recentControlOpen_ItemClick(object sender, RecentItemEventArgs e)
        {
 
        }
 
        private void recentControlSave_ItemClick(object sender, RecentItemEventArgs e)
        {
            ribbonControl1.HideApplicationButtonContentControl();
            RecentPinItem recentItem = e.Item as RecentPinItem;
            if (recentTabItem3.TabPanel.Items.Contains(e.Item))
            {
                //if (recentItem != null)
                //    SaveAs(recentItem.Description);
            }
        }
 
 
        #endregion
 
        private void ribbonControl1_ApplicationButtonDoubleClick(object sender, EventArgs e)
        {
            if (ribbonControl1.RibbonStyle == RibbonControlStyle.Office2007)
                this.Close();
        }
 
 
 
 
 
        private void sbExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }
 
 
        private void label_ZZ_CheckedChanged(object sender, ItemClickEventArgs e)
        {
            CurrentForm.GetBrowser().IsOrtho = label_ZZ.Checked;
        }
 
 
 
 
        private void bvItemSave_ItemClick(object sender, BackstageViewItemEventArgs e)
        {
            Save();
        }
 
        private void bvItemSaveAs_ItemClick(object sender, BackstageViewItemEventArgs e)
        {
            SaveAs();
        }
 
        private void bvItemOpen_ItemClick(object sender, BackstageViewItemEventArgs e)
        {
 
        }
 
        private void bvItemClose_ItemClick(object sender, BackstageViewItemEventArgs e)
        {
            if (xtraTabbedMdiManager1.SelectedPage != null)
                xtraTabbedMdiManager1.SelectedPage.MdiChild.Close();
        }
 
        private void bvItemExit_ItemClick(object sender, BackstageViewItemEventArgs e)
        {
            Close();
        }
 
        void ribbonControl1_ResetLayout(object sender, ResetLayoutEventArgs e)
        {
            ShowHideFormatCategory();
        }
        void OnNewDocThumbButtonClick(object sender, ThumbButtonClickEventArgs e)
        {
            CreateNewDocument();
        }
        void OnPrevThumbButtonClick(object sender, ThumbButtonClickEventArgs e)
        {
            Form mdiChild = GetPrevMdiChild();
            if (mdiChild != null)
                ActivateMdiChild(mdiChild);
        }
        void OnNextDocThumbButtonClick(object sender, ThumbButtonClickEventArgs e)
        {
            Form mdiChild = GetNextMdiChild();
            if (mdiChild != null)
                ActivateMdiChild(mdiChild);
        }
        void OnExitThumbButtonClick(object sender, ThumbButtonClickEventArgs e)
        {
            Close();
        }
        Form GetNextMdiChild()
        {
            if (ActiveMdiChild == null || MdiChildren.Length < 2)
                return null;
            int pos = Array.IndexOf(MdiChildren, ActiveMdiChild);
            return pos == MdiChildren.Length - 1 ? MdiChildren[0] : MdiChildren[pos + 1];
        }
        Form GetPrevMdiChild()
        {
            if (ActiveMdiChild == null || MdiChildren.Length < 2)
                return null;
            int pos = Array.IndexOf(MdiChildren, ActiveMdiChild);
            return pos == 0 ? MdiChildren[MdiChildren.Length - 1] : MdiChildren[pos - 1];
        }
        void OnTabbedMdiManagerPageCollectionChanged(object sender, DevExpress.XtraTabbedMdi.MdiTabPageEventArgs e)
        {
            UpdateThumbnailButtons();
        }
        void UpdateThumbnailButtons()
        {
            thumbButtonNext.Enabled = thumbButtonPrev.Enabled = MdiChildren.Length > 1;
        }
 
 
 
 
        private void bbiÆÕͨ״̬_ItemClick(object sender, ItemClickEventArgs e)
        {
            CurrentForm.GetBrowser().ResetOperateStatus();
        }
 
 
        private void bbiNewLink_ItemClick(object sender, ItemClickEventArgs e)
        {
            CurrentForm.GetBrowser().NewLink();
        }
 
        private void bbiÐÂÔö¹ÜÏß_ItemClick(object sender, ItemClickEventArgs e)
        {
            CurrentForm.GetBrowser().NewLink();
        }
 
        private void bbiÐÂÔöÁ¢¹Ü_ItemClick(object sender, ItemClickEventArgs e)
        {
             CurrentForm.GetBrowser().NewVerticalLink();
        }
 
        private void bbiÌí¼ÓË®³Ø_ItemClick(object sender, ItemClickEventArgs e)
        {
            CurrentForm.GetBrowser().NewPool();
        }
 
        private void bbiÌí¼ÓË®±Ã_ItemClick(object sender, ItemClickEventArgs e)
        {
            CurrentForm.GetBrowser().NewPump();
        }
 
        private void bbiÌí¼ÓË®¿â_ItemClick(object sender, ItemClickEventArgs e)
        {
            CurrentForm.GetBrowser().NewTask();
        }
 
        private void bbiÌí¼Ó·§ÃÅ_ItemClick(object sender, ItemClickEventArgs e)
        {
            CurrentForm.GetBrowser().NewValve();
        }
 
        private void bbiÌí¼ÓË®±í_ItemClick(object sender, ItemClickEventArgs e)
        {
            CurrentForm.GetBrowser().NewWaterMeter();
        }
 
        private void bbiÌí¼ÓÖØ¸´Æ÷_ItemClick(object sender, ItemClickEventArgs e)
        {
            CurrentForm.GetBrowser().NewRepeater();
        }
 
        private void bbiÇå¿Õ¾Ö²¿Ëðʧ_ItemClick(object sender, ItemClickEventArgs e)
        {
            CurrentForm.GetBrowser().ClearMinorLoss();
        }
 
        private void bbi¼ÆËã_ItemClick(object sender, ItemClickEventArgs e)
        {
             CurrentForm.GetBrowser().Calc();
        }
 
        private void bbiCalcMiniLoss_ItemClick(object sender, ItemClickEventArgs e)
        {
            CurrentForm.GetBrowser().CalcLinkMinorLoss();
        }
 
 
 
 
 
 
 
 
    }
 
 
}