protected override void OnClosing(CancelEventArgs e) { if (Editor.IsModified) { var ret = MessageBox.Show(Properties.Resources.RequestSave, Properties.Resources.RequestSaveTitle, MessageBoxButton.YesNo, MessageBoxImage.Question); if (ret == MessageBoxResult.Yes) { OnSave(null, null); } } ScaleRatio = Editor.ScacleRatio; IniFile.WriteValue("Editor", "IsHighLight", ButtonHighligh.IsChecked + ""); IniFile.WriteValue("Editor", "HighLightSpeed", (100 - SliderSpeeder.Value) + ""); int usedTime = 0; string v = IniFile.ReadValue("Editor", "UseCycle"); if (!string.IsNullOrEmpty(v)) { int.TryParse(v, out usedTime); } usedTime++; IniFile.WriteValue("Editor", "UseCycle", usedTime + ""); string review = IniFile.ReadValue("Editor", "Reviewed"); if (string.IsNullOrEmpty(review) && usedTime % 10 == 4) { } try { engine?.Stop(); } catch { } //Environment.Exit(0); base.OnClosing(e); }
private void Engine_EnterNode(object obj, ExecutionEnterEventArgs arg) { if (IsStackMonitored) { stackTrace.Push(arg.Location); if (stackTrace.Count > 1000) { MessageBox.Show(Properties.Resources.StackMessage, Properties.Resources.StackTitle, MessageBoxButton.OK, MessageBoxImage.Error); engine.Stop(); } } if (IsHighlightStep && arg.Location != null && arg.Location is Statement) { Control editor = null; double cycle = 100; Dispatcher.Invoke(() => { try { cycle = 100 - SliderSpeeder.Value; editor = Editor.FindEditorFor(arg.Location); if (editor != null) { Editor.Highlight(editor); } } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); } }); if (editor != null) { Thread.Sleep((int)(3000 * cycle / 100)); Dispatcher.Invoke(() => { Editor.ClearHighlight(); }); } } }