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();
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|