private void SaveAs(string fileName) { try { if (String.IsNullOrEmpty(fileName)) { FileSelector fileSelector = new FileSelector(FileSelectorFilters.Circuits); fileSelector.FileName = fileName; if (fileSelector.ExecuteSaveDialog()) { fileName = fileSelector.FileName; } } if (String.IsNullOrEmpty(fileName) == false) { CircuitData data = CircuitConverter.Instance.ConvertFromCircuit(circuitEditor.Circuit); data.Signals = SignalConverter.Instance.ConvertFromSignalList(circuitEditor.SignalList); CircuitSerializer.SerializeCircuit(fileName, data); m_Persistent = true; FileName = fileName; } } catch (Exception e) { string msg = e.Message; if (e.InnerException != null) { msg += "\n" + e.InnerException.Message; } MessageBox.Show(msg + "\n-----\n" + e.StackTrace, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }
private void SaveAs(string fileName) { try { if (String.IsNullOrEmpty(fileName)) { FileSelector fileSelector = new FileSelector(FileSelectorFilters.Symbols); fileSelector.FileName = fileName; if (fileSelector.ExecuteSaveDialog()) { fileName = fileSelector.FileName; } } if (String.IsNullOrEmpty(fileName) == false) { SymbolData data = SymbolConverter.Instance.ConvertFromSymbol(symbolEditor.Symbol); SymbolSerializer.SerializeSymbol(fileName, data); m_Persistent = true; FileName = fileName; } } catch (Exception e) { string msg = e.Message; if (e.InnerException != null) { msg += "\n" + e.InnerException.Message; } MessageBox.Show(msg + "\n-----\n" + e.StackTrace, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }