private void Item_Redo_Click(object sender, RoutedEventArgs e) { try { if (HistoryRedo.Count > 0) { int last = HistoryRedo.Count - 1; if (HistoryRedo[last] is His_RemovedControl) { SpecialRemoved = true; } HistoryRedo[last].DoRedoAction(DesignCanvas, data); HistoryCommand historyCommand = HistoryRedo[last]; HistoryRedo.RemoveAt(last); HistoryUndo.Add(historyCommand); Undo_MI.IsEnabled = true; if (HistoryRedo.Count == 0) { Redo_MI.IsEnabled = false; } } else { Redo_MI.IsEnabled = false; } } catch (Exception ex) { Debug.WriteLine("Redo Error: " + ex); } }
/* * string GetPageTypeName(TestTypeID.Test_Type type) * { * switch (type) * { * case TestTypeID.Test_Type.Classic: * return Strings.ResStrings.Answers; * case TestTypeID.Test_Type.Form: * return Strings.ResStrings.Page; * default: * return ""; * } * }*/ private void TestTypeCall_OnClick(int Pos, object sender) { SaveCanvas(); Debug.WriteLine("POS: " + Pos + " Sender:" + ((TestType_ControlN)sender).test_type); FrameEditor.NavigationService.LoadCompleted -= NavigationService_LoadCompleted; FrameEditor.NavigationService.LoadCompleted += NavigationService_LoadCompleted; FrameEditor.Content = new Page_Form(); FrameEditor.NavigationService.RemoveBackEntry(); if (LastSelected != null) { LastSelected.Select(false); } ((TestType_ControlN)sender).Select(true); LastSelected = (TestType_ControlN)sender; SelectedPosition = Pos; ValueEditor.Content = ""; HistoryRedo.Clear(); HistoryUndo.Clear(); Undo_MI.IsEnabled = false; Redo_MI.IsEnabled = false; LoadCanvas(); }
private void HistoryUndo_OnAdd(object sender, EventArgs e) { HistoryRedo.Clear(); Redo_MI.IsEnabled = false; Undo_MI.IsEnabled = true; MainWindow.IsChanged = true; if (HistoryUndo.Count >= HistoryLimit) { HistoryUndo.RemoveAt(0); } }