public KeyLayerParams(Document mainWindow) { this.mainWindow = mainWindow; }
public KeyLayerParams(Document mainWindow, BaseKeyLayerParams layer) { this.mainWindow = mainWindow; copyAndNoEvent(layer); }
public ZengYiParams(Document mainWindow) { this.mainWindow = mainWindow; }
public ZengYiParams(Document mainWindow, BaseZengYiParams param) { this.mainWindow = mainWindow; copyAndEvent(param); }
private void savetoFileHelper(Document window) { System.Windows.Forms.SaveFileDialog fileDialog = new System.Windows.Forms.SaveFileDialog(); var tabitem = tabControl.Items.GetItemAt(windows.IndexOf(window)) as TabItem; fileDialog.Title = "存为"; fileDialog.Filter = "数据文件(*.data)|*.data"; fileDialog.FileName = ((ContentControl)tabitem.Header).Content + ".data"; if (fileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string filePath = fileDialog.FileName; if (window.saveFile(filePath)) { MessageBox.Show("保存成功"); if (window.FilePath == null) { window.FilePath = filePath; ((ContentControl)tabitem.Header).Content = Path.GetFileNameWithoutExtension(filePath); } } else { MessageBox.Show("保存失败"); } } }
public ManuDesignParams(Document mainWindow) { this.mainWindow = mainWindow; }
//保存文件 private void saveFileHelper(Document window) { if (window.FilePath == null) { savetoFileHelper(window); return; } if (MessageBox.Show(Path.GetFileNameWithoutExtension(window.FilePath) + ":确定覆盖原文件吗?", "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { return; } if (window.saveFile(window.FilePath)) { MessageBox.Show("保存成功"); } else { MessageBox.Show("保存失败"); } }
//打开文件 private bool openFileHelper(string filePath) { Document document = new Document(); if (!document.openFile(filePath)) { return false; } TabItem tabitem = new TabItem(); ContentControl contentCtl = new ContentControl(); contentCtl.ContextMenu = tabControl.Resources["menu"] as ContextMenu; if (filePath == null) { contentCtl.Content = "新建文档" + newFileCount++; } else { contentCtl.Content = Path.GetFileNameWithoutExtension(filePath); } tabitem.Header = contentCtl; tabitem.Content = document.Content; windows.Add(document); tabControl.Items.Add(tabitem); tabControl.SelectedItem = tabitem; return true; }
public LayerBaseParams(Document mainWindow, BaseLayerBaseParams layer) { this.mainWindow = mainWindow; copyNoEvent(layer); }
public LayerBaseParams(Document mainWindow) { this.mainWindow = mainWindow; }
public static DataToSave getObject(Document document) { DataToSave data = new DataToSave(); //基本参数 data.Layers = new ObservableCollection<BaseLayerBaseParams>(); foreach (LayerBaseParams layerParam in document.layers) { data.Layers.Add(new BaseLayerBaseParams(layerParam)); } //人工设计数据 data.ManuDesignParams = new BaseManuDesignParams(document.manuDesignParams); //关键层参数 data.KeyLayers = new ObservableCollection<BaseKeyLayerParams>(); foreach (KeyLayerParams layerParam in document.keyLayers) { data.KeyLayers.Add(new BaseKeyLayerParams(layerParam)); } data.KeyLayerData = new List<double>(); //保存横三带竖三代数据 data.KeyLayerData.Add(document.Mcqj); data.KeyLayerData.Add(document.FuYanXCL); data.KeyLayerData.Add(document.CaiGao); data.KeyLayerData.Add(document.SuiZhangXS); double maoLuoDai, lieXiDai, wanQuDai; double.TryParse(document.maoLuoDaiTb.Text, out maoLuoDai); double.TryParse(document.lieXiDaiTb.Text, out lieXiDai); double.TryParse(document.wanQuDaiTb.Text, out wanQuDai); data.KeyLayerData.Add(maoLuoDai); data.KeyLayerData.Add(lieXiDai); data.KeyLayerData.Add(wanQuDai); //保存关键层计算相关数据 data.KeyLayerData.Add(document.Mchd); data.KeyLayerData.Add(document.Pjxsxz); data.KeyLayerData.Add(document.HcqZXcd); data.KeyLayerData.Add(document.HcqQXcd); data.KeyLayerData.Add(document.Gzmsd); data.KeyLayerData.Add(document.Jswzjl); //保存水泥环增益计算的数据 data.ZengYis = new ObservableCollection<BaseZengYiParams>(); foreach (ZengYiParams param in document.zengYis) { data.ZengYis.Add(new BaseZengYiParams(param)); } return data; }