private void Export2survex_Click(object sender, RoutedEventArgs e) { SurvexSaveParameters dlgSurvex = new SurvexSaveParameters(this.MultipleTopFiles); dlgSurvex.Owner = this; dlgSurvex.ShowDialog(); if (dlgSurvex.DialogResult == true) { string name = dlgSurvex.tbName.Text; string xcoor = dlgSurvex.tbXCoor.Text; string ycoor = dlgSurvex.tbYCoor.Text; string elev = dlgSurvex.tbEntrancElev.Text; string refPointFile = dlgSurvex.lbFileName.SelectedItem.ToString(); string refPoint = dlgSurvex.lbStationName.SelectedItem.ToString(); refPoint = this.MultipleTopFiles.First(fl => fl.FileName == refPointFile).StationMappings.First(stat => stat.Key == refPoint).Value; if (refPoint.IndexOf(".") > 0) { refPoint.Replace(".", ","); } string sFile = ImportExportHelper.ExportMultipleFiles2SurvexFile(this.MultipleTopFiles, name, xcoor, ycoor, elev, refPoint); Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); dlg.FileName = "Document"; // Default file name dlg.DefaultExt = ".survex"; // Default file extension dlg.Filter = "Survex Documents (.svx)|*.svx"; Nullable <bool> result = dlg.ShowDialog(); // Process save file dialog box results if (result == true) { // Save document string filename = dlg.FileName; File.WriteAllText(filename, sFile); ImportExportHelper.WriteSurvexSaveConfig(new List <string>() { name, xcoor, ycoor, elev, refPointFile, refPoint }, Properties.Settings.Default.LastUsedMultipleFolder); MessageBox.Show("File successfully saved!"); } } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.MyWindow = ((TopFileEditor.SurvexSaveParameters)(target)); return; case 2: this.okButton = ((System.Windows.Controls.Button)(target)); #line 15 "..\..\SurvexSaveParameters.xaml" this.okButton.Click += new System.Windows.RoutedEventHandler(this.okButton_Click); #line default #line hidden return; case 3: this.cancelButton = ((System.Windows.Controls.Button)(target)); #line 16 "..\..\SurvexSaveParameters.xaml" this.cancelButton.Click += new System.Windows.RoutedEventHandler(this.cancelButton_Click); #line default #line hidden return; case 4: this.label = ((System.Windows.Controls.Label)(target)); return; case 5: this.label_Copy = ((System.Windows.Controls.Label)(target)); return; case 6: this.label_Copy1 = ((System.Windows.Controls.Label)(target)); return; case 7: this.label_Copy2 = ((System.Windows.Controls.Label)(target)); return; case 8: this.label_Copy3 = ((System.Windows.Controls.Label)(target)); return; case 9: this.tbName = ((System.Windows.Controls.TextBox)(target)); return; case 10: this.tbYCoor = ((System.Windows.Controls.TextBox)(target)); return; case 11: this.tbXCoor = ((System.Windows.Controls.TextBox)(target)); return; case 12: this.tbEntrancElev = ((System.Windows.Controls.TextBox)(target)); return; case 13: this.lbFileName = ((System.Windows.Controls.ListBox)(target)); #line 28 "..\..\SurvexSaveParameters.xaml" this.lbFileName.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.lbFileName_SelectionChanged_1); #line default #line hidden return; case 14: this.lbStationName = ((System.Windows.Controls.ListBox)(target)); #line 29 "..\..\SurvexSaveParameters.xaml" this.lbStationName.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ListBox_SelectionChanged); #line default #line hidden return; } this._contentLoaded = true; }
private void Export2survex_Click(object sender, RoutedEventArgs e) { SurvexSaveParameters dlgSurvex = new SurvexSaveParameters(this.MultipleTopFiles); dlgSurvex.Owner = this; dlgSurvex.ShowDialog(); if (dlgSurvex.DialogResult == true) { string name = dlgSurvex.tbName.Text; string xcoor = dlgSurvex.tbXCoor.Text; string ycoor = dlgSurvex.tbYCoor.Text; string elev = dlgSurvex.tbEntrancElev.Text; string refPointFile = dlgSurvex.lbFileName.SelectedItem.ToString(); string refPoint = dlgSurvex.lbStationName.SelectedItem.ToString(); refPoint = this.MultipleTopFiles.First(fl => fl.FileName == refPointFile).StationMappings.First(stat => stat.Key == refPoint).Value; if(refPoint.IndexOf(".") > 0) { refPoint.Replace(".", ","); } string sFile = ImportExportHelper.ExportMultipleFiles2SurvexFile(this.MultipleTopFiles, name, xcoor, ycoor, elev, refPoint); Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); dlg.FileName = "Document"; // Default file name dlg.DefaultExt = ".survex"; // Default file extension dlg.Filter = "Survex Documents (.svx)|*.svx"; Nullable<bool> result = dlg.ShowDialog(); // Process save file dialog box results if (result == true) { // Save document string filename = dlg.FileName; File.WriteAllText(filename, sFile); ImportExportHelper.WriteSurvexSaveConfig(new List<string>() {name, xcoor, ycoor, elev, refPointFile, refPoint }, Properties.Settings.Default.LastUsedMultipleFolder); MessageBox.Show("File successfully saved!"); } } }