private void btnOpen_Click(object sender, RoutedEventArgs e) { if (!QuerySave()) { return; } Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.DefaultExt = ".gcg"; dlg.Filter = "Gate Circuit Groups (.gcg)|*.gcg|All Files|*.*"; bool?result = dlg.ShowDialog(); if (result == true) { btnUserMode.IsChecked = false; foreach (Window w in Application.Current.Windows) { if (w != this) { w.Close(); } } gateCanvas.ClearSelection(); icl.Clear(); CircuitXML cxml = new CircuitXML(icl); try { slZoom.Value = 1; RefreshGateCanvas(cxml.Load(dlg.FileName, icl.Add)); btnSave.IsEnabled = true; _filename = dlg.FileName; UpdateTitle(); ((UndoRedo.UndoManager)Resources["undoManager"]).Clear(); ((UndoRedo.UndoManager)Resources["undoManager"]).SetSavePoint(); } catch (Exception ex) { MessageBox.Show("Unable to load circuit as requested: " + ex.ToString()); } } }
public Window1() : this(EditLevel.FULL) { AssemblyTitleAttribute title; AssemblyCopyrightAttribute copyright; Assembly aAssembly = Assembly.GetExecutingAssembly(); title = (AssemblyTitleAttribute) AssemblyTitleAttribute.GetCustomAttribute( aAssembly, typeof(AssemblyTitleAttribute)); copyright = (AssemblyCopyrightAttribute) AssemblyCopyrightAttribute.GetCustomAttribute( aAssembly, typeof(AssemblyCopyrightAttribute)); APP_TITLE = title.Title; APP_VERSION = aAssembly.GetName().Version.ToString(); APP_COPYRIGHT = copyright.Copyright; icl = new ICList(); gateCanvas.ICL = icl; gateCanvas.UndoProvider = (UndoRedo.UndoManager)Resources["undoManager"]; gateCanvas.SetCaptureICLChanges(); spGates.ICList = icl; spGates.UndoProvider = (UndoRedo.UndoManager)Resources["undoManager"]; this.Loaded += (s2, e2) => { Gates.IOGates.Clock.CalculatePrecession(); }; this.Closing += new CancelEventHandler(Window1_Closing); if (!string.IsNullOrEmpty(LOAD_ON_START)) { try { CircuitXML cxml = new CircuitXML(icl); RefreshGateCanvas(cxml.Load(LOAD_ON_START, icl.Add)); btnSave.IsEnabled = true; _filename = LOAD_ON_START; UpdateTitle(); } catch (Exception ex) { MessageBox.Show("Unable to load requested circuit, reason: " + ex.ToString()); } } }
private void btnImportIC_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.DefaultExt = ".ic"; dlg.Filter = "IC (.ic)|*.ic|All Files (*.*)|*.*"; bool?result = dlg.ShowDialog(); if (result == true) { CircuitXML cxml = new CircuitXML(icl); try { cxml.Load(dlg.FileName, icl.Add); } catch (Exception ex) { MessageBox.Show("Unable to load circuit as requested: " + ex.ToString()); } } }
private void btnOpen_Click(object sender, RoutedEventArgs e) { if (!QuerySave()) return; Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.DefaultExt = ".gcg"; dlg.Filter = "Gate Circuit Groups (.gcg)|*.gcg|All Files|*.*"; bool? result = dlg.ShowDialog(); if (result == true) { foreach (Window w in Application.Current.Windows) { if (w != this) w.Close(); } gateCanvas.ClearSelection(); icl.Clear(); CircuitXML cxml = new CircuitXML(icl); try { slZoom.Value = 1; RefreshGateCanvas(cxml.Load(dlg.FileName, icl.Add)); btnSave.IsEnabled = true; _filename = dlg.FileName; UpdateTitle(); ((UndoRedo.UndoManager)Resources["undoManager"]).Clear(); ((UndoRedo.UndoManager)Resources["undoManager"]).SetSavePoint(); } catch (Exception ex) { MessageBox.Show("Unable to load circuit as requested: " + ex.ToString()); } } }
//BOKANG public void loadXMLElement(string path) { gateCanvas.ClearSelection(); icl.Clear(); CircuitXML cxml = new CircuitXML(icl); try{ slZoom.Value = 0.5; RefreshGateCanvas(cxml.Load(path, icl.Add)); }catch (Exception ex){ MessageBox.Show("Unable to load circuit as requested: " + ex.ToString()); } }
private void btnImportIC_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.DefaultExt = ".ic"; dlg.Filter = "IC (.ic)|*.ic|All Files (*.*)|*.*"; bool? result = dlg.ShowDialog(); if (result == true) { CircuitXML cxml = new CircuitXML(icl); try { cxml.Load(dlg.FileName, icl.Add); } catch (Exception ex) { MessageBox.Show("Unable to load circuit as requested: " + ex.ToString()); } } }
//BOKANG public Window1() : this(EditLevel.EDIT) { AssemblyTitleAttribute title; AssemblyCopyrightAttribute copyright; Assembly aAssembly = Assembly.GetExecutingAssembly(); title = (AssemblyTitleAttribute) AssemblyTitleAttribute.GetCustomAttribute( aAssembly, typeof(AssemblyTitleAttribute)); copyright = (AssemblyCopyrightAttribute) AssemblyCopyrightAttribute.GetCustomAttribute( aAssembly, typeof(AssemblyCopyrightAttribute)); APP_TITLE = title.Title; APP_VERSION = aAssembly.GetName().Version.ToString(); APP_COPYRIGHT = copyright.Copyright; icl = new ICList(); gateCanvas.ICL = icl; gateCanvas.UndoProvider = (UndoRedo.UndoManager)Resources["undoManager"]; gateCanvas.SetCaptureICLChanges(); spGates.ICList = icl; spGates.UndoProvider = (UndoRedo.UndoManager)Resources["undoManager"]; this.Loaded += (s2, e2) => { Gates.IOGates.Clock.CalculatePrecession(); }; this.Closing += new CancelEventHandler(Window1_Closing); if (!string.IsNullOrEmpty(LOAD_ON_START)) { try { CircuitXML cxml = new CircuitXML(icl); RefreshGateCanvas(cxml.Load(LOAD_ON_START, icl.Add)); btnSave.IsEnabled = true; _filename = LOAD_ON_START; UpdateTitle(); } catch (Exception ex) { MessageBox.Show("Unable to load requested circuit, reason: " + ex.ToString()); } } }